Skip to content

Conversation

LucaBernstein
Copy link
Member

@LucaBernstein LucaBernstein commented Apr 4, 2025

How to categorize this PR?
/area usability
/kind cleanup enhancement

What this PR does / why we need it:
As we introduced shoot.spec.cloudProfile to support NamespacedCloudProfile references, the field shoot.spec.cloudProfileName is discouraged to use in favor of the newer and more flexible replacement shoot.spec.cloudProfile.name.
Since Gardener v1.101.0, a synchronization mechanism ensures that both fields are filled by the other value if empty and the referenced cloud profile is of kind CloudProfile.

  • Starting with Shoots of Kubernetes version v1.33 there will be a warning printed for clients creating and updating Shoots that still have the field .spec.cloudProfileName set.
  • Starting with Shoots of Kubernetes version v1.34 the creation of new Shoots will be blocked, if the field .spec.cloudProfileName is filled. For existing Shoots still having both fields filled the .spec.cloudProfileName field will be dropped once.

Example:

spec:
  cloudProfile:
    name: local
  # kind: CloudProfile # optional, defaults to 'CloudProfile'

Which issue(s) this PR fixes:
Part of #9504.

Special notes for your reviewer:
/cc @timuthy @rfranzke

Release note:

Starting with Kubernetes v1.33, there are API warnings for Shoots that have the `.spec.cloudProfileName` field set. Users are advised to drop this field and specify the cloud profile using the `.spec.cloudProfile.name` field instead.
Starting with Kubernetes v1.34, setting the field `.spec.cloudProfileName` is forbidden. The field will be dropped from existing Shoots once. Users are advised to drop this field and specify the cloud profile using the `.spec.cloudProfile.name` field instead.

@gardener-prow gardener-prow bot requested review from rfranzke and timuthy April 4, 2025 08:40
@gardener-prow gardener-prow bot added area/usability Usability related kind/cleanup Something that is not needed anymore and can be cleaned up kind/enhancement Enhancement, improvement, extension cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 4, 2025
@LucaBernstein LucaBernstein force-pushed the nscpfl-deprecate-cloudprofile branch from ca854aa to 9d1e799 Compare April 8, 2025 08:43
@LucaBernstein LucaBernstein requested a review from rfranzke April 8, 2025 08:43
@LucaBernstein
Copy link
Member Author

LucaBernstein commented Apr 8, 2025

Build [local-skaffold/gardener-extension-provider-local-node] failed: docker build failure: failed to set up container networking: failed to add interface veth130ffda to sandbox: check bridge port state: bridge port not forwarding after 200ms. Please fix the Dockerfile and try again..

Occurrence of #11511 .


/test pull-gardener-e2e-kind-ha-multi-zone-upgrade

@gardener gardener deleted a comment from gardener-prow bot Apr 8, 2025
Copy link
Member

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 9, 2025
Copy link
Contributor

gardener-prow bot commented Apr 9, 2025

LGTM label has been added.

Git tree hash: 2c9a87f5b3f357d29f36619b159d92bb7c59e370

Copy link
Member

@timuthy timuthy left a comment

Choose a reason for hiding this comment

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

As sent via chat, the deprecation (sync stop) might be too early if the gardener-dashboard doesn't use the new spec.cloudProfile field.

Let's hold for a while and discuss this prerequisite.
/hold

@gardener-prow gardener-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 9, 2025
@timuthy
Copy link
Member

timuthy commented Apr 15, 2025

We agreed on waiting for the dashboard to adapt to the new spec.cloudProfile field, see gardener/dashboard#1971.

The PR is blocked until then.

@gardener-prow gardener-prow bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2025
@gardener-prow gardener-prow bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 2, 2025
@LucaBernstein LucaBernstein force-pushed the nscpfl-deprecate-cloudprofile branch from ab1e4fe to 2fe8c91 Compare May 2, 2025 12:55
@gardener-prow gardener-prow bot removed the lgtm Indicates that a PR is ready to be merged. label May 2, 2025
@gardener-prow gardener-prow bot requested a review from rfranzke May 2, 2025 12:55
@gardener-prow gardener-prow bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 2, 2025
@gardener-prow gardener-prow bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 17, 2025
Add tests, including missing test for ConstraintK8sLess133.
… >= v1.34.

- Starting with k8s v1.33, no more syncing back to empty cloudProfileName fields happens.
- Starting with k8s v1.34, no more syncing back and forth between cloudProfileName and cloudProfile.Name fields happens. The only exception is that during a shoot update the cloudProfileName field is once set empty, if it does not conflict with the cloudProfile.

Refactor test CloudProfile(Name) field access
- Improve warning phrase
- Use named import alias `v1beta1constants`
@LucaBernstein LucaBernstein force-pushed the nscpfl-deprecate-cloudprofile branch from 6b8a7f7 to 94f3136 Compare July 10, 2025 08:59
Signed-off-by: Luca Bernstein <luca.bernstein@sap.com>
@LucaBernstein LucaBernstein force-pushed the nscpfl-deprecate-cloudprofile branch from 94f3136 to 89a175d Compare July 10, 2025 09:25
@LucaBernstein
Copy link
Member Author

#12510 has been opened including the latest dashboard release with .spec.cloudProfile field support.
/unhold

@gardener-prow gardener-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 11, 2025
Comment on lines +1242 to +1244
if k8sVersion != nil && versionutils.ConstraintK8sGreaterEqual134.Check(k8sVersion) && ptr.Deref(cloudProfileName, "") != "" {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("cloudProfileName"), "starting with k8s v1.34, cloudProfileName must not be set. Instead, use spec.cloudProfile.name"))
}
Copy link
Member

@ialidzhikov ialidzhikov Jul 11, 2025

Choose a reason for hiding this comment

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

You have to adapt the maintenance controller when doing forceful upgrade from 1.33 -> 1.34 to migration from spec.cloudProfileName to .spec.cloudProfile.name. Examples: #12413 and #12343

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you! I adapted the maintenance controller to drop the .spec.cloudProfileName field upon forceful upgrade. (Field synchronization is in place since g/g v1.101.0.)

Copy link
Member

Choose a reason for hiding this comment

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

When checking the PR in more depth, I see that there is already a logic in gardener-apiserver to set .spec.cloudProfileName to nil if .spec.cloudProfile.name is already set (it should be set based on the already existing logic for syncing both of the fields).

This makes me think that there is no need of extra coding in the maintenance controller as due to the above-mentioned logic the gardener-apiserver wouldn't fail an update from K8s 1.33 to 1.34.

I am letting to you to confirm/reject this. I am sorry for my suggestion if there was actually no need of the custom coding in the maintenance controller. 🙈

You could revert 5b1a680 if we don't need it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added revert commit to undo the last commit. Thanks for checking in-depth again. 👍

…nil` upon a forceful upgrade from k8s `< v1.34` to `>= v1.34`.

Signed-off-by: Luca Bernstein <luca.bernstein@sap.com>
@ialidzhikov
Copy link
Member

/assign

Copy link
Member

@ialidzhikov ialidzhikov left a comment

Choose a reason for hiding this comment

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

Only 1 comment (ref #11816 (comment)), otherwise lgtm

…me` to `nil` upon a forceful upgrade from k8s `< v1.34` to `>= v1.34`."

This reverts commit 5b1a680.
Copy link
Member

@ialidzhikov ialidzhikov left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2025
Copy link
Contributor

gardener-prow bot commented Jul 22, 2025

LGTM label has been added.

Git tree hash: 76cc1d3ecda7bc12f2dc5c04eaf1f64bb5aec389

Copy link
Contributor

gardener-prow bot commented Jul 22, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ialidzhikov

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

@gardener-prow gardener-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 22, 2025
@gardener-prow gardener-prow bot merged commit 48f2e5d into gardener:master Jul 22, 2025
19 checks passed
@LucaBernstein LucaBernstein deleted the nscpfl-deprecate-cloudprofile branch July 22, 2025 13:45
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/usability Usability related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/cleanup Something that is not needed anymore and can be cleaned up kind/enhancement Enhancement, improvement, extension lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants