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

🐛 MD controller: use regular random suffix for MachineSets, ensure max length 63 #9298

Merged

Conversation

chrischdi
Copy link
Member

What this PR does / why we need it:

This PR drops the templateHash from the MachineSet Name inside the controller for MachineDeployments (responsible to create MachineSets).

It also adjusts computeNewMachineSetName(...) to generate and return the suffix with the length of the const so we always return a string of max length 63.

All in all this helps keeping the length of the name of a MachineSet lower or equal to 63, same as we nowadays do for Machines.

Example Created MD, MS and Machine before and afterwards (with maximum name length):

before:

❯ kubectl get md,ms,ma -o custom-columns=KIND:kind,NAME:.metadata.name
KIND                NAME
MachineDeployment   development-12400-md-0000000000000000000000000000000000000g6wzr
MachineSet          development-12400-md-00000000000000000000000000000000000006b7fcf948bxpdzkz
Machine             development-12400-md-0000000000000000000000000000000000000nqmkl

after:

❯ kubectl get md,ms,ma -o custom-columns=KIND:kind,NAME:.metadata.name
KIND                NAME
MachineDeployment   development-12400-md-00000000000000000000000000000000000006bl9r
MachineSet          development-12400-md-00000000000000000000000000000000000005pjqf
Machine             development-12400-md-00000000000000000000000000000000000009gnst

Example Created MD, MS and Machine before and afterwards (with "normal" name length):

before:

❯ kubectl get md,ms,ma -o custom-columns=KIND:kind,NAME:.metadata.name
KIND                NAME
MachineDeployment   development-12400-md-0-xmv5l
MachineSet          development-12400-md-0-xmv5l-786f45bb8dxdg99b
Machine             development-12400-md-0-xmv5l-786f45bb8dxdg99b-jpqr4

after:

❯ kubectl get md,ms,ma -o custom-columns=KIND:kind,NAME:.metadata.name
KIND                NAME
MachineDeployment   development-12400-md-0-9zxmd
MachineSet          development-12400-md-0-9zxmd-zmjsh
Machine             development-12400-md-0-9zxmd-zmjsh-8dgvn

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 #8585

/area machinedeployment

@k8s-ci-robot k8s-ci-robot added area/machinedeployment Issues or PRs related to machinedeployments cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 24, 2023
@chrischdi
Copy link
Member Author

/test help

@k8s-ci-robot
Copy link
Contributor

@chrischdi: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-build-main
  • /test pull-cluster-api-e2e-main
  • /test pull-cluster-api-test-main
  • /test pull-cluster-api-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-apidiff-main
  • /test pull-cluster-api-e2e-full-dualstack-and-ipv6-main
  • /test pull-cluster-api-e2e-full-main
  • /test pull-cluster-api-e2e-informing-main
  • /test pull-cluster-api-e2e-mink8s-main
  • /test pull-cluster-api-e2e-scale-main-experimental
  • /test pull-cluster-api-e2e-workload-upgrade-1-28-latest-main
  • /test pull-cluster-api-test-mink8s-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-apidiff-main
  • pull-cluster-api-build-main
  • pull-cluster-api-e2e-informing-main
  • pull-cluster-api-e2e-main
  • pull-cluster-api-test-main
  • pull-cluster-api-verify-main

In response to this:

/test help

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.

@chrischdi chrischdi changed the title md: drop templatesuffix from machineset names ✨ md: drop templatesuffix from machineset names Aug 24, 2023
@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-informing-main

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

Awesome - if I'm right the clusterctl upgrade tests should give us a smoke signal that this is working correctly.

/test pull-cluster-api-e2e-full-main

@chrischdi
Copy link
Member Author

Note: I did also test clusterctl alpha rollout restart machinedeployment/foo

@chrischdi chrischdi force-pushed the pr-shorter-machineset-names branch from 72fbba9 to af137e2 Compare August 24, 2023 13:35
@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-informing-main

@chrischdi
Copy link
Member Author

/assign @sbueringer

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/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 29, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: db9df12581c4f636ea082a97aeeea89dfee71f3f

@sbueringer
Copy link
Member

Also checked e2e tests:

clusterctl upgrade:

MD: clusterctl-upgrade-v0h2bf-md-0-gwkxb
MS: clusterctl-upgrade-v0h2bf-md-0-gwkxb-fd84f8dcbxkh99w

Names generated by previous CAPI version are preserved and no rollout is triggered

quickstart on current PR:

MD: quick-start-2hy8m8-md-0
MS: quick-start-2hy8m8-md-0-kwm6z

New name generation works as expected

@sbueringer sbueringer changed the title ✨ md: drop templatesuffix from machineset names 🐛 MD controller: use regular random suffix for MachineSets, ensure max length 63 Aug 29, 2023
@sbueringer
Copy link
Member

sbueringer commented Aug 29, 2023

Considering that with the previous code we could end up with invalid MachineSet names (i.e. MachineSet creation for MDs with long names simply did not work), I consider this a bug fix so I'm going to backport it.

The change is safe to be backported as it only affects new MachineSets and doesn't trigger rollouts on existing MachineSets.

@sbueringer
Copy link
Member

/lgtm
/approve

@sbueringer
Copy link
Member

/cherry-pick release-1.5

@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.5 in a new PR and assign it to you.

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.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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

@sbueringer
Copy link
Member

/cherry-pick release-1.4

@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 29, 2023
@k8s-infra-cherrypick-robot

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.4 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.4

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.

@sbueringer
Copy link
Member

cc @g-gaston @furkatgofurov7 regarding release notes

@k8s-ci-robot k8s-ci-robot merged commit 441e8a5 into kubernetes-sigs:main Aug 29, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.6 milestone Aug 29, 2023
@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #9329

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.

@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #9330

In response to this:

/cherry-pick release-1.4

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.

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/machinedeployment Issues or PRs related to machinedeployments 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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shorter machineset names
5 participants