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: use super-admin.conf for kube-vip on first master when it exists #11422

Merged
merged 4 commits into from
Aug 11, 2024

Conversation

Seljuke
Copy link
Contributor

@Seljuke Seljuke commented Aug 7, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #11229

Special notes for your reviewer:

Tested manually for fresh ha cluster install, cluster upgrade, worker node add/remove, control plane node add/remove, first control plane reordering and remove.

Does this PR introduce a user-facing change?:

Added workarounds to support initial k8s v1.29+ installation with kube-vip enabled

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 7, 2024
Copy link

linux-foundation-easycla bot commented Aug 7, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Aug 7, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @Seljuke!

It looks like this is your first PR to kubernetes-sigs/kubespray 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubespray has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 7, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @Seljuke. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 7, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Aug 7, 2024
Copy link
Contributor

@cyclinder cyclinder left a comment

Choose a reason for hiding this comment

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

If you can add @sathieu as co-author, that would be great! Did you test your changes?

@@ -6,6 +6,21 @@
- kube_proxy_mode == 'ipvs' and not kube_proxy_strict_arp
- kube_vip_arp_enabled

- name: Kube-vip | Check if super-admin.conf exists
stat:
path: "{{ kube_config_dir }}/super-admin.conf"
Copy link
Contributor

Choose a reason for hiding this comment

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

super-admin.conf will be created in each cp node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it does't get created on each cp node and only on first node, after first cp node initialize RBAC fully configured and we can use the admin.conf on other nodes.

Copy link
Contributor

Choose a reason for hiding this comment

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

The kube-vip pod run on all the cp node, right? you mean that the kube-vip pod on the first cp node is use the super-admin.conf, and the kube-vip pod on the other cp nodes is use the admin.conf, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

@cyclinder Yes.

NB: But this is only necessary on bootstrap, i.e before admin.conf has cluster-admin privileges.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got, thank you for your clarification!

Copy link
Contributor

Choose a reason for hiding this comment

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

/lgtm

@cyclinder
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 7, 2024
Co-authored-by: Mathieu Parent <math.parent@gmail.com>
@Seljuke
Copy link
Contributor Author

Seljuke commented Aug 7, 2024

If you can add @sathieu as co-author, that would be great! Did you test your changes?

@sathieu added as co-author and yes I tested manually for fresh ha cluster install, cluster upgrade, worker node add/remove, control plane node add/remove, first control plane reordering and remove.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2024
@@ -119,6 +119,6 @@ spec:
hostNetwork: true
volumes:
- hostPath:
path: /etc/kubernetes/admin.conf
path: /etc/kubernetes/{% if inventory_hostname == (groups['kube_control_plane'] | first) and ((stat_kube_vip_super_admin.stat.exists and stat_kube_vip_super_admin.stat.isreg) or (not kubeadm_already_run.stat.exists )) %}super-{% endif %}admin.conf
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather have a variable elsewhere so it doesn't make the template hard to read.

# default value for all nodes
set_fact: 
  kube_vip_admin_conf:  admin.conf

# special case
set_fact:
  kube_vip_admin_conf: super-admin.conf
when:
  - inventory_hostname == groups['kube_control_plane'] | first
  - (stat_kube_vip_super_admin.stat.exists and stat_kube_vip_super_admin.stat.isreg) or ((not kubeadm_already_run.stat.exists )

The template is then:

  volumes:
 - hostPath:
     path: /etc/kubernetes/{{kube_vip_admin_conf}}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, updated template with your suggestion

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2024
@ant31
Copy link
Contributor

ant31 commented Aug 8, 2024

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ant31, Seljuke

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 8, 2024
@sathieu
Copy link
Contributor

sathieu commented Aug 8, 2024

@Seljuke Have you seen the failing tests?

 ./roles/kubernetes/node/tasks/loadbalancer/kube-vip.yml
  25:12     error    trailing spaces  (trailing-spaces)
  26:26     error    too many spaces after colon  (colons) 

Copy link
Contributor

@cyclinder cyclinder left a comment

Choose a reason for hiding this comment

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

Overall LGTM, Can you squash the comments? thanks!

@Seljuke
Copy link
Contributor Author

Seljuke commented Aug 9, 2024

Do you mean squashing commits? Or resolving conversations?

@ant31
Copy link
Contributor

ant31 commented Aug 9, 2024

The merge bot will squash the commit before merge.

@cyclinder
Copy link
Contributor

The merge bot will squash the commit before merge.

Got.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 9, 2024
@sathieu
Copy link
Contributor

sathieu commented Aug 9, 2024

@Seljuke Please add release notes section 🙏 .

@Seljuke
Copy link
Contributor Author

Seljuke commented Aug 9, 2024

@sathieu As I read from here I added release notes under Does this PR introduce a user-facing change?: but do-not-merge/release-note-label-needed tag still stays and I don't know how to change it.

@sathieu
Copy link
Contributor

sathieu commented Aug 9, 2024

@Seljuke Don't know. @cyclinder ?

Trying:

/remove do-not-merge/release-note-label-needed

@cyclinder
Copy link
Contributor

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 11, 2024
@k8s-ci-robot k8s-ci-robot merged commit e43e08c into kubernetes-sigs:master Aug 11, 2024
39 checks passed
@Mazorius
Copy link

@cyclinder any idea when this change will be released?

@cyclinder
Copy link
Contributor

@Mazorius We can add it manually when we release it.

@sathieu
Copy link
Contributor

sathieu commented Aug 12, 2024

@Seljuke Could you create a backport PR for release-2.25 branch?

@Seljuke
Copy link
Contributor Author

Seljuke commented Aug 12, 2024

@cyclinder can you run /cherry-pick release-2.25 command?

@cyclinder
Copy link
Contributor

/cherry-pick release-2.25

@k8s-infra-cherrypick-robot

@cyclinder: #11422 failed to apply on top of branch "release-2.25":

Applying: fix: use super-admin.conf for kube-vip when it exists
Patch is empty.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To record the empty patch as an empty commit, run "git am --allow-empty".
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-2.25

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@cyclinder
Copy link
Contributor

@Seljuke failed to apply this patch to release-2.25, can you create a backport PR manually?

sathieu pushed a commit to sathieu/kubespray that referenced this pull request Aug 13, 2024
…kubernetes-sigs#11422)

* fix: use super-admin.conf for kube-vip when it exists

* Mathieu Parent add as co-author

Co-authored-by: Mathieu Parent <math.parent@gmail.com>

* template change for readability

* fix lint error

---------

Co-authored-by: Mathieu Parent <math.parent@gmail.com>
(cherry picked from commit e43e08c)
@sathieu
Copy link
Contributor

sathieu commented Aug 13, 2024

@cyclinder @Seljuke I created the backport PR: #11444

k8s-ci-robot pushed a commit that referenced this pull request Aug 15, 2024
…#11422) (#11444)

* fix: use super-admin.conf for kube-vip when it exists

* Mathieu Parent add as co-author

Co-authored-by: Mathieu Parent <math.parent@gmail.com>

* template change for readability

* fix lint error

---------

Co-authored-by: Mathieu Parent <math.parent@gmail.com>
(cherry picked from commit e43e08c)

Co-authored-by: Selçuk Arıbalı <selcukaribali@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initial setup of a k8s cluster with kubespray breaks if kube-vip is enabled
7 participants