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

feat: align GCPManagedControlPlane with CAPI >=v1.9 #1434

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

salasberryfin
Copy link
Contributor

/kind bug

What this PR does / why we need it:

To align GCPManagedControlPlane specification and status with CAPI >=v1.9 we need to introduce new control plane version fields and set existing ones for deprecation in coming releases. The list of changes, as agreed on Slack (thanks @damdo @richardcase @cpanato):

  • Introduce new Version fields in GCPManagedControlPlaneSpec and GCPManagedControlPlaneStatus as per the updated CAPI contract for control planes.
  • Mark ControlPlaneVersion and CurrentVersion as deprecated with a message saying to use Version instead.
  • Have a validation webhook that disallows setting Version and ControlPlaneVersion.
  • Update all templates and e2e tests to use Version.

Which issue(s) this PR fixes:
Fixes #1433

Special notes for your reviewer:

In the future, as the deprecated field is ultimately removed, we can add a conversion from ControlPlaneVersion to Version.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Add new GCPManagedControlPlane Version field and set ControlPlaneVersion for deprecation to align with core CAPI

@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/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 25, 2025
@k8s-ci-robot k8s-ci-robot requested review from damdo and dims February 25, 2025 10:09
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: salasberryfin
Once this PR has been reviewed and has the lgtm label, please assign richardcase for approval. For more information see the 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 25, 2025
Copy link

netlify bot commented Feb 25, 2025

Deploy Preview for kubernetes-sigs-cluster-api-gcp ready!

Name Link
🔨 Latest commit 153f13f
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-gcp/deploys/67bd986bc6a15000087e3fef
😎 Deploy Preview https://deploy-preview-1434--kubernetes-sigs-cluster-api-gcp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Carlos Salas <carlos.salas@suse.com>
@salasberryfin salasberryfin force-pushed the managed-control-plane-version-api-change branch from bf2c4da to 153f13f Compare February 25, 2025 10:16
Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

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

Hey @salasberryfin
Thanks a lot for working on implementing this!

Mostly LGTM, left a couple of things we need to change though.

Comment on lines 149 to +151
// +optional
//
// Deprecated: This field will soon be removed and you are expected to use Version instead.
Copy link
Member

Choose a reason for hiding this comment

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

I think the optional stylistically (and maybe even from an implementation standpoint) goes next to the field, whereas the Deprecated can also go above in the godoc comment.
Better be safe, example here:
https://github.com/kubernetes-sigs/cluster-api/blob/7a71f4b0ed71cb92fa751e48057df6bb672319bb/api/v1beta1/cluster_types.go#L533-L539

Comment on lines 192 to +195
// CurrentVersion shows the current version of the GKE control plane.
// +optional
//
// Deprecated: This field will soon be removed and you are expected to use Version instead.
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Comment on lines +197 to 201

// Version represents the version of the GKE control plane.
// +optional
Version *string `json:"version,omitempty"`
}
Copy link
Member

Choose a reason for hiding this comment

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

We want to populate this status.Version with whatever we currently populate the status.CurrentVersion with.
Then When in the future we remove the status.CurrentVersion, we will only have the status.Version to set.

One instance I saw of this is here:

s.scope.GCPManagedControlPlane.Status.CurrentVersion = convertToSdkMasterVersion(cluster.GetCurrentMasterVersion())

But there may be others.

@damdo
Copy link
Member

damdo commented Feb 25, 2025

@salasberryfin Also we will likely need to add an action required in the release-note for this PR,
similar to the one I added for CAPA here: kubernetes-sigs/cluster-api-provider-aws#5209 (comment)
(you should be able to mostly copy-paste it).

cc. @richardcase

@damdo
Copy link
Member

damdo commented Feb 26, 2025

@salasberryfin also we might need to silence the linter for errors like : cloud/services/container/clusters/reconcile.go:515:5: SA1019: spec.ControlPlaneVersion is deprecated: This field will soon be removed and you are expected to use Version instead. (staticcheck), as we still want to set/get those fields internally even if they are deprecated, until we remove them.

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. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Align managed control plane to latest CAPI changes
3 participants