-
Notifications
You must be signed in to change notification settings - Fork 527
[release-v1.118] Ensure extension admission webhooks validated WorkloadIdentity
s and Secret
s when used
#12075
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
Merged
gardener-prow
merged 8 commits into
gardener:release-v1.118
from
gardener-ci-robot:cherry-pick-12061-to-release-v1.118
May 13, 2025
Merged
[release-v1.118] Ensure extension admission webhooks validated WorkloadIdentity
s and Secret
s when used
#12075
gardener-prow
merged 8 commits into
gardener:release-v1.118
from
gardener-ci-robot:cherry-pick-12061-to-release-v1.118
May 13, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for local testing Co-Authored-By: Tim Usner <tim.usner@sap.com>
For `WorkoadIdentity`s, there is already https://github.com/gardener/gardener/blob/b9622262d10177c185e26b4a6551414cc236ac51/plugin/pkg/global/extensionlabels/admission.go#L157-L165 which takes care of syncing the provider label based on the type in the `spec`.
This way, we ensure that all `*Binding` resources can be considered "safe to be used" UNDER THE CONDITION that the provider type of the `*Binding` matches with the provider type of the target resource (e.g., a `Shoot` with provider type `foo` must ensure that it only references a `*Binding` with provider type `foo`). This is already ensured by https://github.com/gardener/gardener/blob/2a9c566f89a6a16e654193945250f60755c560b9/plugin/pkg/shoot/validator/admission.go#L1073-L1091. As of today, the `Shoot` API is the only one using `*Binding` resources. Note that we don't need to do this dry-run-create for `WorkloadIdentity`s because we already ensure that the provider types of it and the `CredentialsBinding` match (see previous commit). This way, we ensure that a `WorkloadIdentity` must have already successfully passed the provider extension check when referenced in a `CredentialsBinding` with the same type. Co-Authored-By: Tim Usner <tim.usner@sap.com>
…ing`s Co-Authored-By: Rafael Franzke <rafael.franzke@sap.com>
When `CredentialsBinding`s or `SecretBinding`s are created with `generateName`, the `metadata.name` field is not populated, causing the admission plugin to miss validating that the providers between the binding and the shoot match. In addition, the `ResourceReferenceManager` needs to be a validating admission plugin in order to see the changes applied by `PrepareForCreate`.
/lgtm |
LGTM label has been added. Git tree hash: e113db72afe1cc79ca460024dcf90b0c39ead980
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rfranzke 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 |
timebertt
pushed a commit
to stackitcloud/gardener
that referenced
this pull request
May 14, 2025
…oadIdentity`s and `Secret`s when used (gardener#12075) backport of gardener#12061 Can be dropped when upgrading to g/g@v1.119 * Implement dummy `Secret`/`WorkloadIdentity` validator for provider-local for local testing Co-Authored-By: Tim Usner <tim.usner@sap.com> * New webhook for syncing provider secrets For `WorkoadIdentity`s, there is already https://github.com/gardener/gardener/blob/b9622262d10177c185e26b4a6551414cc236ac51/plugin/pkg/global/extensionlabels/admission.go#L157-L165 which takes care of syncing the provider label based on the type in the `spec`. * Dry-run provider secret creation to ensure it is sane This way, we ensure that all `*Binding` resources can be considered "safe to be used" UNDER THE CONDITION that the provider type of the `*Binding` matches with the provider type of the target resource (e.g., a `Shoot` with provider type `foo` must ensure that it only references a `*Binding` with provider type `foo`). This is already ensured by https://github.com/gardener/gardener/blob/2a9c566f89a6a16e654193945250f60755c560b9/plugin/pkg/shoot/validator/admission.go#L1073-L1091. As of today, the `Shoot` API is the only one using `*Binding` resources. Note that we don't need to do this dry-run-create for `WorkloadIdentity`s because we already ensure that the provider types of it and the `CredentialsBinding` match (see previous commit). This way, we ensure that a `WorkloadIdentity` must have already successfully passed the provider extension check when referenced in a `CredentialsBinding` with the same type. Co-Authored-By: Tim Usner <tim.usner@sap.com> * New admission plugin preventing undesired finalizer removal of `*Binding`s Co-Authored-By: Rafael Franzke <rafael.franzke@sap.com> * Ensure provider types match * Support `generateName` field When `CredentialsBinding`s or `SecretBinding`s are created with `generateName`, the `metadata.name` field is not populated, causing the admission plugin to miss validating that the providers between the binding and the shoot match. In addition, the `ResourceReferenceManager` needs to be a validating admission plugin in order to see the changes applied by `PrepareForCreate`. * Handle unset `provider` field in `SecretBinding`s * Address PR review feedback --------- Co-authored-by: rfranzke <rafael.franzke@sap.com> Co-authored-by: Tim Usner <tim.usner@sap.com>
ske-prow bot
pushed a commit
to stackitcloud/gardener
that referenced
this pull request
May 14, 2025
…oadIdentity`s and `Secret`s when used (gardener#12075) backport of gardener#12061 Can be dropped when upgrading to g/g@v1.119 * Implement dummy `Secret`/`WorkloadIdentity` validator for provider-local for local testing Co-Authored-By: Tim Usner <tim.usner@sap.com> * New webhook for syncing provider secrets For `WorkoadIdentity`s, there is already https://github.com/gardener/gardener/blob/b9622262d10177c185e26b4a6551414cc236ac51/plugin/pkg/global/extensionlabels/admission.go#L157-L165 which takes care of syncing the provider label based on the type in the `spec`. * Dry-run provider secret creation to ensure it is sane This way, we ensure that all `*Binding` resources can be considered "safe to be used" UNDER THE CONDITION that the provider type of the `*Binding` matches with the provider type of the target resource (e.g., a `Shoot` with provider type `foo` must ensure that it only references a `*Binding` with provider type `foo`). This is already ensured by https://github.com/gardener/gardener/blob/2a9c566f89a6a16e654193945250f60755c560b9/plugin/pkg/shoot/validator/admission.go#L1073-L1091. As of today, the `Shoot` API is the only one using `*Binding` resources. Note that we don't need to do this dry-run-create for `WorkloadIdentity`s because we already ensure that the provider types of it and the `CredentialsBinding` match (see previous commit). This way, we ensure that a `WorkloadIdentity` must have already successfully passed the provider extension check when referenced in a `CredentialsBinding` with the same type. Co-Authored-By: Tim Usner <tim.usner@sap.com> * New admission plugin preventing undesired finalizer removal of `*Binding`s Co-Authored-By: Rafael Franzke <rafael.franzke@sap.com> * Ensure provider types match * Support `generateName` field When `CredentialsBinding`s or `SecretBinding`s are created with `generateName`, the `metadata.name` field is not populated, causing the admission plugin to miss validating that the providers between the binding and the shoot match. In addition, the `ResourceReferenceManager` needs to be a validating admission plugin in order to see the changes applied by `PrepareForCreate`. * Handle unset `provider` field in `SecretBinding`s * Address PR review feedback --------- Co-authored-by: rfranzke <rafael.franzke@sap.com> Co-authored-by: Tim Usner <tim.usner@sap.com>
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/enhancement
Enhancement, improvement, extension
lgtm
Indicates that a PR is ready to be merged.
size/XXL
Denotes a PR that changes 1000+ lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an automated cherry-pick of #12061
/assign rfranzke