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

🐛 Skip checking clusterConfiguration.dns fields when KCP checking MachineNeedRollout #9857

Merged

Conversation

Levi080513
Copy link
Contributor

@Levi080513 Levi080513 commented Dec 12, 2023

What this PR does / why we need it:

KCP uses the following method to update the coredns version, this does not require rolling updates of control plane nodes, and we can optimize it.

// Update CoreDNS deployment.
if err := workloadCluster.UpdateCoreDNS(ctx, controlPlane.KCP, parsedVersion); err != nil {
return ctrl.Result{}, errors.Wrap(err, "failed to update CoreDNS deployment")
}

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes # #9832

Test:

  1. Create CAPI Cluster with dns config.
kc get kcp -n default hw-sks-test-no-gpu-controlplane -ojson | jq '.spec.kubeadmConfigSpec.clusterConfiguration.dns'
{
  "imageRepository": "registry.smtx.io/kubesmart/coredns",
  "imageTag": "v1.10.1"
}
  1. Then update the dns config.
kc get kcp -n default hw-sks-test-no-gpu-controlplane -ojson | jq '.spec.kubeadmConfigSpec.clusterConfiguration.dns'

{
  "imageRepository": "registry.smtx.io/kubesmart/coredns",
  "imageTag": "v1.11.0"
}
  1. KCP is ready and CP Machine no need rolling update.
kc get kcp -n default hw-sks-test-no-gpu-controlplane
NAME                              CLUSTER              INITIALIZED   API SERVER AVAILABLE   REPLICAS   READY   UPDATED   UNAVAILABLE   AGE   VERSION
hw-sks-test-no-gpu-controlplane   hw-sks-test-no-gpu   true          true                   3          3       3         0             17h   v1.25.15

kc get machine -n default -l cluster.x-k8s.io/cluster-name=hw-sks-test-no-gpu,cluster.x-k8s.io/control-plane=
NAME                                    CLUSTER              NODENAME                                PROVIDERID                                   PHASE     AGE   VERSION
hw-sks-test-no-gpu-controlplane-2gmhm   hw-sks-test-no-gpu   hw-sks-test-no-gpu-controlplane-nw86c   elf:https://d29afee9-03ab-440c-a294-64afd5b67adf   Running   17h   v1.25.15
hw-sks-test-no-gpu-controlplane-f4x7n   hw-sks-test-no-gpu   hw-sks-test-no-gpu-controlplane-h2k4j   elf:https://c663ea39-865d-473b-8a30-56b4dc22a032   Running   17h   v1.25.15
hw-sks-test-no-gpu-controlplane-mzph8   hw-sks-test-no-gpu   hw-sks-test-no-gpu-controlplane-pztmt   elf:https://0f0ef45c-7b95-4b68-8a58-06b9235a1ae7   Running   17h   v1.25.15
  1. Workload cluster DNS config has been updated.
kc get deploy coredns -n kube-system -ojson | jq '.spec.template.spec.containers[].image'
"registry.smtx.io/kubesmart/coredns/coredns:v1.11.0"

kc get cm kubeadm-config -n kube-system -oyaml | yq '.data.ClusterConfiguration'  | yq '.dns'
imageRepository: registry.smtx.io/kubesmart/coredns
imageTag: v1.11.0

/area provider/control-plane-kubeadm

@k8s-ci-robot k8s-ci-robot added area/provider/control-plane-kubeadm Issues or PRs related to KCP cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 12, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @Levi080513. 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/test-infra repository.

Copy link
Contributor

@g-gaston g-gaston left a comment

Choose a reason for hiding this comment

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

looks good, thanks for the change!

controlplane/kubeadm/internal/filters.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 14, 2023
@g-gaston
Copy link
Contributor

/ok-to-test
/lgtm

thanks for this fix!

@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 Dec 14, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 14, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 19458370dc6e3198ed88ac98d1e3d9345f95cdb6

@sbueringer
Copy link
Member

Thx!

/assign @fabriziopandini

@fabriziopandini
Copy link
Member

Nice change!
Sorry for taking a little bit longer than usual to get to this
/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 Jan 15, 2024
@fabriziopandini
Copy link
Member

/hold
for squash

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 15, 2024
@sbueringer sbueringer added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 15, 2024
@sbueringer
Copy link
Member

Enabled squash :)

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 15, 2024
@k8s-ci-robot k8s-ci-robot merged commit d48b35b into kubernetes-sigs:main Jan 15, 2024
24 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.7 milestone Jan 15, 2024
@Levi080513
Copy link
Contributor Author

@sbueringer
Sorry to bother you, can this PR be picked up to the release-1.5 ? We still use CAPI 1.5 internally, but this improvement is needed for us.

@sbueringer
Copy link
Member

/cherry-pick release-1.6

@sbueringer
Copy link
Member

/cherry-pick release-1.5

@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #10303

In response to this:

/cherry-pick release-1.6

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/test-infra repository.

@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #10304

In response to this:

/cherry-pick release-1.5

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/test-infra repository.

Dhairya-Arora01 pushed a commit to Dhairya-Arora01/cluster-api that referenced this pull request May 25, 2024
…achineNeedRollout (kubernetes-sigs#9857)

* Skip checking DNS filed when checking KCP MachineNeedRollout

* fix comment
Dhairya-Arora01 pushed a commit to Dhairya-Arora01/cluster-api that referenced this pull request May 25, 2024
…achineNeedRollout (kubernetes-sigs#9857)

* Skip checking DNS filed when checking KCP MachineNeedRollout

* fix comment
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. area/provider/control-plane-kubeadm Issues or PRs related to KCP cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants