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

🌱 Add ClusterTopologyMachineDeploymentLabelName to MachineDeployment templates #5209

Merged

Conversation

anusha94
Copy link
Contributor

@anusha94 anusha94 commented Sep 4, 2021

Adding ClusterTopologyMachineDeploymentLabelName to the generated
Bootstrap and Infrastructure Machine templates

What this PR does / why we need it:
ClusterTopologyMachineDeploymentLabelName has to be added on the generated MachineDeployment objects to track the name of the MD topology it represents. Bootstrap and InfrastructureMachine templates are also generated as part of computeMachineDeployment. Hence, adding the label on these templates as well.

Fixes #5193

@k8s-ci-robot
Copy link
Contributor

Hi @anusha94. 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 4, 2021
@anusha94
Copy link
Contributor Author

anusha94 commented Sep 4, 2021

I thought of adding an assertion after assert on MD object label

But the Spec.InfrastructureRef and Spec.Bootstrap.ConfigRef are of type *corev1.ObjectReference. I wasn't quite sure of how to get the Labels on these templates for assertion.

lmk how can I test this? Thanks!

@geetikabatra
Copy link

LGTM

@fabriziopandini
Copy link
Member

/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 Sep 6, 2021
controllers/topology/desired_state.go Outdated Show resolved Hide resolved
controllers/topology/desired_state.go Outdated Show resolved Hide resolved
@fabriziopandini
Copy link
Member

/test pull-cluster-api-test-main-mink8s

@fabriziopandini
Copy link
Member

lmk how can I test this?

A possible solution is to extend the test case implemented at

t.Run("Generates the machine deployment and the referenced templates", func(t *testing.T) {
by adding assertions on actual.InfrastructureMachineTemplate.GetLabels() and actual.BootstrapTemplate.GetLabels(), similar to what we are already doing at
g.Expect(actualMd.Labels).To(HaveKeyWithValue(clusterv1.ClusterTopologyMachineDeploymentLabelName, "big-pool-of-machines"))

@sbueringer
Copy link
Member

/lgtm (I think you can squash)

- Adding ClusterTopologyMachineDeploymentLabelName to the generated
  Bootstrap and Infrastructure Machine templates
- Adding assertions to verify the label name and value on the generated
  templates
@anusha94 anusha94 force-pushed the add-cluster-topology-md-label branch from c4b570e to ea5ac6b Compare September 6, 2021 13:54
@anusha94
Copy link
Contributor Author

anusha94 commented Sep 6, 2021

/test pull-cluster-api-test-main-mink8s

@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 6, 2021
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 6, 2021
@fabriziopandini
Copy link
Member

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini, vincepri

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:
  • OWNERS [fabriziopandini,vincepri]

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

/retest

@k8s-ci-robot k8s-ci-robot merged commit 2798730 into kubernetes-sigs:master Sep 6, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone Sep 6, 2021
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. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Managed topology should add topology.cluster.x-k8s.io/deployment-name to machineDeployment templates
6 participants