Skip to content

fix: Put KubeletExtraArgs in double quotes for Windows#1082

Merged
antonbabenko merged 1 commit into
terraform-aws-modules:masterfrom
yveslaroche:windows-kubelet-extra-args-quotes
Sep 3, 2021
Merged

fix: Put KubeletExtraArgs in double quotes for Windows#1082
antonbabenko merged 1 commit into
terraform-aws-modules:masterfrom
yveslaroche:windows-kubelet-extra-args-quotes

Conversation

@yveslaroche

@yveslaroche yveslaroche commented Nov 3, 2020

Copy link
Copy Markdown
Contributor

PR o'clock

Description

Put KubeletExtraArgs in double quotes for Windows, it is already double quoted in the Bash script. This allows for variable substitution within the string e.g.

kubelet_extra_args = "node.kubernetes.io/lifecycle=$(Invoke-WebRequest -Uri http://169.254.169.254/latest/meta-data/instance-life-cycle | Select-Object -ExpandProperty Content)"

Checklist

@bogdan-alov bogdan-alov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@barryib

barryib commented Nov 3, 2020

Copy link
Copy Markdown
Member

Is this different from #1046 ? Because the double quote in linux introduce a bug for multiple taints support. See FAQ update for variable substitution in linux. Does it work for windows ?

See also #1004

@barryib

barryib commented Nov 4, 2020

Copy link
Copy Markdown
Member

/ping @yveslaroche and @bogdanalov-sw

@yveslaroche

Copy link
Copy Markdown
Contributor Author

I have successfully tested applying multiple labels and taints for both Linux and Windows nodes using double quotes in the bootstrap scripts with the examples below.

# Linux
kubelet_extra_args = "--node-labels=node.kubernetes.io/role=worker,node.kubernetes.io/lifecycle=$(curl -s http://169.254.169.254/latest/meta-data/instance-life-cycle) --register-with-taints=somekey=somevalue:NoSchedule,anotherkey=anothervalue:NoSchedule"

# Windows
kubelet_extra_args = "--node-labels=node.kubernetes.io/role=windows,node.kubernetes.io/lifecycle=$(Invoke-WebRequest -Uri http://169.254.169.254/latest/meta-data/instance-life-cycle | Select-Object -ExpandProperty Content) --register-with-taints=os=windows:NoSchedule,anotherkey=anothervalue:NoSchedule"

In addition, I tested the taints applied in #1004. In this case the node won't register, but if I change the name of one of the keys to something else, it works. Hence, I believe the problem is applying two taints with the same key and effect, but different values.

@barryib

barryib commented Nov 4, 2020

Copy link
Copy Markdown
Member

By reading this awslabs/amazon-eks-ami#179 it sounds like we should use '' (single quotes) to surround kubelet_extra_args and "" (double quotes) to surround arguments.

Something like: '--register-with-taints="os=windows:NoSchedule,anotherkey=anothervalue:NoSchedule"'

I haven’t test it yet, but I'm going to dig a bit.

When we use single quotes for KubeletExtraAgrs, in linux, you should escape variable:

$ echo 'my name is ${USER}'
my name is ${USER}

$ echo 'my name is '${USER}''
my name is foo

In addition, I tested the taints applied in #1004. In this case the node won't register, but if I change the name of one of the keys to something else, it works. Hence, I believe the problem is applying two taints with the same key and effect, but different values.

I think you can normally provide multiple taints with the same key (by example key1=value1:NoSchedule and key1=value1:NoExecute) https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/

@yveslaroche

Copy link
Copy Markdown
Contributor Author

@barryib

I think you can normally provide multiple taints with the same key (by example key1=value1:NoSchedule and key1=value1:NoExecute)
Yes, but that's a different effect that's set which is allowed. Setting the same key and effect, but with a different value multiple times is not allowed. If you apply it manually you'd get:

error: node ip-xx-xx-xx-xx.us-west-2.compute.internal already has env taint(s) with same effect(s)

@barryib

barryib commented Nov 4, 2020

Copy link
Copy Markdown
Member

@barryib

I think you can normally provide multiple taints with the same key (by example key1=value1:NoSchedule and key1=value1:NoExecute)
Yes, but that's a different effect that's set which is allowed. Setting the same key and effect, but with a different value multiple times is not allowed. If you apply it manually you'd get:

error: node ip-xx-xx-xx-xx.us-west-2.compute.internal already has env taint(s) with same effect(s)

Sorry for the typo. I was thinking about key1=value1:NoSchedule and key1=value2:NoSchedule. I'll make some tests also.

@barryib

barryib commented Nov 4, 2020

Copy link
Copy Markdown
Member

@yveslaroche just made some tests and I can confirm your point.

It is already quoted in the Bash script. This allows for variable substitution within the string e.g.
kubelet_extra_args = "node.kubernetes.io/lifecycle=$(Invoke-WebRequest -Uri http://169.254.169.254/latest/meta-data/instance-life-cycle | Select-Object -ExpandProperty Content)"
@stale

stale Bot commented Feb 10, 2021

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
To track this PR (even if closed), please open a corresponding issue if one does not already exist.

@stale stale Bot added the stale label Feb 10, 2021
@stale

stale Bot commented Mar 12, 2021

Copy link
Copy Markdown

This PR has been automatically closed because it has not had recent activity since being marked as stale.
Please reopen when work resumes.

@stale stale Bot closed this Mar 12, 2021
@sebas-w

sebas-w commented May 27, 2021

Copy link
Copy Markdown

Are we able to reopen this? What additional items were needed to get this merged? @barryib

@barryib

barryib commented May 27, 2021

Copy link
Copy Markdown
Member

I don't use windows at all, so the point is how this different from #1082 (comment) ? There is already a PR to put back single quote for linux workers #1046.

I need people to test this.

@barryib barryib reopened this May 27, 2021
@stale stale Bot removed the stale label May 27, 2021
@stale

stale Bot commented Aug 25, 2021

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
To track this PR (even if closed), please open a corresponding issue if one does not already exist.

@antonbabenko

Copy link
Copy Markdown
Member

Thanks @yveslaroche !

v17.8.0 has been just released.

@github-actions

Copy link
Copy Markdown

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants