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

use cluster name for managed cluster spec's name #2654

Conversation

nawazkh
Copy link
Member

@nawazkh nawazkh commented Sep 15, 2022

What type of PR is this?
/kind bug

What this PR does / why we need it:

  • With this PR ManagedClusterSpec.name will be set as ManagedControlPlaneScope.Cluster.Name instead of ManagedControlPlaneScope.ControlPlane.Name.
  • By doing this, the AzureManagedCluster's Name is independent of AzureManagedControlPlane's Name value.

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

Special notes for your reviewer:

Current Code flow
  1. managedClusterSpec is fetched/formed at this line.
  2. kubeConfigData, err := s.GetCredentials(ctx, managedClusterSpec.ResourceGroupName(), managedClusterSpec.ResourceName())
  3. func (ac *azureClient) GetCredentials(ctx context.Context, resourceGroupName, name string) ([]byte, error) {
  4. credentialList, err := ac.managedclusters.ListClusterAdminCredentials(ctx, resourceGroupName, name, "")
Reasoning behind this change.
  • Changing the managedClusterSpec.Name's value to ManagedControlPlaneScope.ClusterName() makes managedClusterSpec.Name' independent of ManagedControlPlaneScope.ControlPlane.Name

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

None

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 15, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cecilerobertmichon for approval by writing /assign @cecilerobertmichon in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 15, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @nawazkh. 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 the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 15, 2022
@nawazkh
Copy link
Member Author

nawazkh commented Sep 15, 2022

holding the PR for now to add an e2e test case to validate the change.

@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 Sep 15, 2022
@nawazkh
Copy link
Member Author

nawazkh commented Sep 15, 2022

/hold

@jackfrancis
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 Sep 15, 2022
@nawazkh
Copy link
Member Author

nawazkh commented Sep 15, 2022

/retest

@nawazkh nawazkh force-pushed the aks_clustername_match_control_plane_name branch from 441affe to 1f31307 Compare September 22, 2022 15:33
- adds a new test case TestManagedControlPlaneScope_ManagedClusterName()
to test ManagedClusterSpec.Name is independent of
AzureManagedControlPlane.Name
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 22, 2022
@nawazkh
Copy link
Member Author

nawazkh commented Sep 22, 2022

/unhold

@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 Sep 22, 2022
@nawazkh
Copy link
Member Author

nawazkh commented Sep 26, 2022

Paired with @CecileRobertMichon to investigate when #2438 issue was not showing up on main branch. We found that #2438 was fixed as part of PR #2168.
Will advise the user to use latest version of CAPZ.

Thank you Cecile!

@nawazkh nawazkh closed this Sep 26, 2022
@nawazkh nawazkh deleted the aks_clustername_match_control_plane_name branch August 31, 2023 20:48
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. kind/bug Categorizes issue or PR as related to a bug. 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/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.

AKS cluster name must match-control plane name
4 participants