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

Allow skipping Linux profile on managed clusters #3677

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

maciaszczykm
Copy link
Member

@maciaszczykm maciaszczykm commented Jun 29, 2023

What type of PR is this?
/kind feature

What this PR does / why we need it:
In order to be able to not set LinuxProfile in AKS I have changed AzureManagedControlPlane SSHPublicKey to be optional. If it is null then new key will not be autogenerated and LinuxProfile will not be set, if it is set to empty string then new key will be generated just like it was done until now.

See Slack thread: https://kubernetes.slack.com/archives/CEX9HENG7/p1687961825757119

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

Special notes for your reviewer:

  • cherry-pick candidate

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Allow skipping Linux profile on managed clusters

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. 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 Jun 29, 2023
@maciaszczykm
Copy link
Member Author

maciaszczykm commented Jun 29, 2023

What do you think about this approach?

I was also considering adding another field like AutogenerateSSHKey that would be true by default, but once disabled then SSH key would not be autogenerated. Then we would not be changing PublicSSHKey type but adding new field instead.

Edit: Not sure if the solution from above is possible as we would need to make PublicSSHKey optional anyways.

Edit 2: Another idea that comes to my mind is detecting if there is existing cluster that does not have SSH key, if that is the case then autogenerate could be skipped. As above, we would need to make PublicSSHKey optional.

cc @jackfrancis

@maciaszczykm maciaszczykm marked this pull request as draft June 29, 2023 09:26
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 29, 2023
@maciaszczykm maciaszczykm marked this pull request as ready for review June 29, 2023 09:49
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 29, 2023
@maciaszczykm maciaszczykm changed the title Allow skipping Linux profile on managed clusters [WIP] Allow skipping Linux profile on managed clusters Jun 29, 2023
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 29, 2023
@maciaszczykm maciaszczykm changed the title [WIP] Allow skipping Linux profile on managed clusters Allow skipping Linux profile on managed clusters Jun 29, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 29, 2023
@codecov
Copy link

codecov bot commented Jun 29, 2023

Codecov Report

Patch coverage: 76.92% and project coverage change: -0.04 ⚠️

Comparison is base (a32e1dc) 54.09% compared to head (49f8572) 54.05%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3677      +/-   ##
==========================================
- Coverage   54.09%   54.05%   -0.04%     
==========================================
  Files         185      186       +1     
  Lines       18751    18839      +88     
==========================================
+ Hits        10143    10184      +41     
- Misses       8063     8107      +44     
- Partials      545      548       +3     
Impacted Files Coverage Δ
api/v1beta1/azuremanagedcontrolplane_types.go 20.00% <ø> (ø)
azure/scope/managedcontrolplane.go 24.31% <0.00%> (-0.32%) ⬇️
azure/services/managedclusters/spec.go 46.70% <84.21%> (+0.71%) ⬆️
api/v1beta1/azuremanagedcontrolplane_default.go 96.70% <100.00%> (ø)
api/v1beta1/azuremanagedcontrolplane_webhook.go 82.30% <100.00%> (-0.04%) ⬇️

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

.golangci.yml Outdated Show resolved Hide resolved
@maciaszczykm
Copy link
Member Author

Is there anything that I can do to push it forward?

/retest

@CecileRobertMichon
Copy link
Contributor

Is there anything that I can do to push it forward?

@maciaszczykm I think the remaining open items are:

  1. the gocyclo linter bump discussion
  2. the backwards compatibility of the pointer change
  3. the aks e2e test is failing

Once all of this is resolved, please squash commits

@CecileRobertMichon
Copy link
Contributor

/test ls

@k8s-ci-robot
Copy link
Contributor

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

  • /test pull-cluster-api-provider-azure-build
  • /test pull-cluster-api-provider-azure-ci-entrypoint
  • /test pull-cluster-api-provider-azure-e2e
  • /test pull-cluster-api-provider-azure-e2e-aks
  • /test pull-cluster-api-provider-azure-test
  • /test pull-cluster-api-provider-azure-verify

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-azure-apidiff
  • /test pull-cluster-api-provider-azure-apiversion-upgrade
  • /test pull-cluster-api-provider-azure-capi-e2e
  • /test pull-cluster-api-provider-azure-conformance
  • /test pull-cluster-api-provider-azure-conformance-with-ci-artifacts
  • /test pull-cluster-api-provider-azure-e2e-optional
  • /test pull-cluster-api-provider-azure-e2e-workload-upgrade
  • /test pull-cluster-api-provider-azure-windows-containerd-upstream-with-ci-artifacts
  • /test pull-cluster-api-provider-azure-windows-containerd-upstream-with-ci-artifacts-serial-slow

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

  • pull-cluster-api-provider-azure-apidiff
  • pull-cluster-api-provider-azure-build
  • pull-cluster-api-provider-azure-ci-entrypoint
  • pull-cluster-api-provider-azure-e2e
  • pull-cluster-api-provider-azure-e2e-aks
  • pull-cluster-api-provider-azure-test
  • pull-cluster-api-provider-azure-verify

In response to this:

/test ls

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.

@CecileRobertMichon
Copy link
Contributor

Also going to start an apiversion upgrade test:

/test pull-cluster-api-provider-azure-apiversion-upgrade

@maciaszczykm
Copy link
Member Author

@CecileRobertMichon E2E failure might just be flaky test. I will rerun it a few times as I saw similar thing in my other PRs.

/test pull-cluster-api-provider-azure-e2e-aks

@nawazkh
Copy link
Member

nawazkh commented Jul 11, 2023

One more question, the implemented UX of this PR looks a little cramped to me(although completely justified). Do you think we could add a new field selfGenerateSSHKey bool (or something analogous to it) to generate a new SSHKey instead of relying on different behaviors of SSHPublicKey = nil and SSHPublicKey = ?

Its just a thought but I am completely ok with this current implementation as well.

@maciaszczykm
Copy link
Member Author

@nawazkh I considered adding new field in my comment above:

I was also considering adding another field like AutogenerateSSHKey that would be true by default, but once disabled then SSH key would not be autogenerated. Then we would not be changing PublicSSHKey type but adding new field instead.

But after thinking longer about it, all fields that are part of control plane spec map somehow to AKS fields. This would be used only by CAPZ and it would be used only once during init, after that it would be redundant. I prefer current solution but if you would like then I can change it. Both ways should work.

@maciaszczykm
Copy link
Member Author

/retest

Copy link
Member

@nawazkh nawazkh left a comment

Choose a reason for hiding this comment

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

Just one final suggestion from my end :) Everything else looks great to me! Thank you

azure/services/managedclusters/spec_test.go Outdated Show resolved Hide resolved
@nawazkh
Copy link
Member

nawazkh commented Jul 13, 2023

@nawazkh I considered adding new field in my comment above:

I was also considering adding another field like AutogenerateSSHKey that would be true by default, but once disabled then SSH key would not be autogenerated. Then we would not be changing PublicSSHKey type but adding new field instead.

But after thinking longer about it, all fields that are part of control plane spec map somehow to AKS fields. This would be used only by CAPZ and it would be used only once during init, after that it would be redundant. I prefer current solution but if you would like then I can change it. Both ways should work.

"This would be used only by CAPZ and it would be used only once during init, after that it would be redundant." Makes sense, thanks for sharing the context again!

@maciaszczykm
Copy link
Member Author

@nawazkh Done, PTAL.

@maciaszczykm
Copy link
Member Author

@nawazkh PTAL.

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jul 14, 2023

@maciaszczykm: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-azure-apidiff 49f8572 link false /test pull-cluster-api-provider-azure-apidiff

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@nawazkh
Copy link
Member

nawazkh commented Jul 14, 2023

Thank you for putting this together and working through the conversations. Let's get this merged! 🚀
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 14, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 60c96b64916993fed31f10f87e0476c2557a5fc3

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon

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 Jul 18, 2023
@k8s-ci-robot k8s-ci-robot merged commit dd4d34c into kubernetes-sigs:main Jul 18, 2023
12 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.11 milestone Jul 18, 2023
@maciaszczykm maciaszczykm deleted the linux-profile branch July 19, 2023 07:29
@nawazkh
Copy link
Member

nawazkh commented Aug 7, 2023

Should this PR be cherry-picked to other release branches ?

@CecileRobertMichon
Copy link
Contributor

@nawazkh IMO it's not eligible for cherry-pick because it's a feature

see https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/docs/book/src/developers/releasing.md#release-support

@nawazkh
Copy link
Member

nawazkh commented Aug 7, 2023

Makes sense, thank you!

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/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants