Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix envvars in args #4037

Closed
wants to merge 3 commits into from

Conversation

LuckySB
Copy link
Contributor

@LuckySB LuckySB commented Jan 12, 2019

fix env vars substitution error in hostnameOverride-patch.json

https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#use-environment-variables-to-define-arguments

I also want to note that in version 1.13.0, this patch is no longer necessary to apply.
https://github.com/kubernetes/kubernetes/pull/71283/files

#4036

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 12, 2019
@LuckySB
Copy link
Contributor Author

LuckySB commented Jan 12, 2019

ci check this

@LuckySB
Copy link
Contributor Author

LuckySB commented Jan 12, 2019

/assign @woopstar

@chadswen
Copy link
Member

@LuckySB Do you have a fix for the other roles also? I haven't searched for the root cause elsewhere, but this PR looks like it's only applicable to windows nodes. We should be able to set hostnameOverride in the config used by kubeadm if that's not working properly yet.

@LuckySB
Copy link
Contributor Author

LuckySB commented Jan 17, 2019

/assign @chadswen

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: LuckySB
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: chadswen

If they are not already assigned, you can assign the PR to them by writing /assign @chadswen in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@LuckySB
Copy link
Contributor Author

LuckySB commented Jan 17, 2019

@LuckySB Do you have a fix for the other roles also? I haven't searched for the root cause elsewhere, but this PR looks like it's only applicable to windows nodes. We should be able to set hostnameOverride in the config used by kubeadm if that's not working properly yet.

The win_nodes role adds restrictions to the daemonset kube_proxy, so that it runs only on linux-based nodes.
As far as I know, a kubespray does not know how to add nodes to the Windows.

I also want to note that in version 1.13.0, this patch is no longer necessary to apply.
https://github.com/kubernetes/kubernetes/pull/71283/files

@dannyk81
Copy link
Contributor

@LuckySB just hit this when deployed v1.13.2 with Kubespray (from master branch).

kubeadm already sets --hostname-override=$(NODE_NAME) and the current patch add the incorrect one and causes the error/warning.

      spec:
        containers:
        - command:
          - /usr/local/bin/kube-proxy
          - --config=/var/lib/kube-proxy/config.conf
          - --hostname-override=$(NODE_NAME)
          - --hostname-override=${NODE_NAME}

@chadswen I'm a bit confused here as well, but this patch seems to be applied on linux nodes as well 🤷‍♂️ not sure why it's called win_nodes 😄

@dannyk81
Copy link
Contributor

@LuckySB with this PR, I get the following result after deployment:

    Command:
      /usr/local/bin/kube-proxy
      --config=/var/lib/kube-proxy/config.conf
      --hostname-override=$(NODE_NAME)
      --hostname-override=$(NODE_NAME)

This is better, but there's still duplicate entries.

@LuckySB LuckySB force-pushed the fix_kube_proxy_patch branch from 3542728 to b61777a Compare January 26, 2019 17:13
@LuckySB
Copy link
Contributor Author

LuckySB commented Jan 26, 2019

@LuckySB with this PR, I get the following result after deployment:

    Command:
      /usr/local/bin/kube-proxy
      --config=/var/lib/kube-proxy/config.conf
      --hostname-override=$(NODE_NAME)
      --hostname-override=$(NODE_NAME)

This is better, but there's still duplicate entries.

Thank you very much.
I added escaping special characters to regexp search
and now it correctly checks the arguments of kube-proxy and does not duplicate them.

@dannyk81
Copy link
Contributor

@LuckySB with this PR, I get the following result after deployment:

    Command:
      /usr/local/bin/kube-proxy
      --config=/var/lib/kube-proxy/config.conf
      --hostname-override=$(NODE_NAME)
      --hostname-override=$(NODE_NAME)

This is better, but there's still duplicate entries.

Thank you very much.
I added escaping special characters to regexp search
and now it correctly checks the arguments of kube-proxy and does not duplicate them.

You're welcome @LuckySB

I was also thinking that considering that this patch is only needed for k8s version < 1.13.0, it may be easier to just apply a conditional on the whole task block, here:

when:
- not kube_proxy_remove

by adding:

  - kube_version is version('v1.13.0', '<')

and remove the search conditional entirely.

@LuckySB
Copy link
Contributor Author

LuckySB commented Jan 26, 2019

I was also thinking that considering that this patch is only needed for k8s version < 1.13.0, it may be easier to just apply a conditional on the whole task block, here:

kubespray/roles/win_nodes/kubernetes_patch/tasks/main.yml

Lines 34 to 35 in 0888f65

when:

  • not kube_proxy_remove
    by adding:
  - kube_version is version('v1.13.0', '<')

and remove the search conditional entirely.

Of course you are right. from version 1.13 this patch will not be needed

But if you add this condition and remove the condition with the search, then on the version less than 1.13 every time you start the kubespray, the line '--hostname-override' will be added

@dannyk81
Copy link
Contributor

dannyk81 commented Jan 26, 2019 via email

@dannyk81
Copy link
Contributor

Hey @chadswen! following our slack chat about this, do you think we can get this merged?

@LuckySB LuckySB deleted the fix_kube_proxy_patch branch April 16, 2020 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants