Add DNS secret validation for AWS shoots#1612
Conversation
|
Created it as a draft since I haven't tested it yet. |
|
The Gardener project currently lacks enough active contributors to adequately respond to all PRs.
You can:
/lifecycle stale |
|
/remove-lifecycle stale |
|
@wpross Command |
|
/remove-lifecycle-stale |
|
@wpross Command |
AndreasBurger
left a comment
There was a problem hiding this comment.
Some remarks, generally lgtm
| return allErrs | ||
| } | ||
|
|
||
| providersPath := specPath.Child("dns").Child("providers") |
There was a problem hiding this comment.
Could also be moved to the initial declaration-block for consistency
| fmt.Sprintf("unsupported secret kind for secret %s, allowed values are %q and %q", | ||
| secretRef, SecretKindInfrastructure, SecretKindDns)), |
There was a problem hiding this comment.
Thats fine (great, even) if we don't expect to extend the kinds. If we do, I'd suggest to maintain a list of known kinds (somewhere around l.20) that can be the source of truth for known kinds. Higher likelihood of remembering to update that, in case of changes.
There was a problem hiding this comment.
Also, there seems to be a field.NotSupported for these cases
| allErrs = append(allErrs, field.Required(dataPath.Key(accessKeyIDKey), | ||
| fmt.Sprintf("missing required field %q in secret %s", accessKeyIDKey, secretRef))) | ||
| } else if len(accessKeyID) == 0 { | ||
| allErrs = append(allErrs, field.Invalid(dataPath.Key(accessKeyIDKey), "", |
There was a problem hiding this comment.
I think this should also be field.Required
| allErrs = append(allErrs, field.Required(dataPath.Key(secretAccessKeyKey), | ||
| fmt.Sprintf("missing required field %q in secret %s", secretAccessKeyKey, secretRef))) | ||
| } else if len(secretAccessKey) == 0 { | ||
| allErrs = append(allErrs, field.Invalid(dataPath.Key(secretAccessKeyKey), "", |
There was a problem hiding this comment.
(possibly) field.Required
* Validate aws-dns provider secrets in shoot spec * Refactor secret validation to use field.Path * Refactor shoot validator to return all field errors * Update tests accordingly
b99e568 to
509ee8d
Compare
|
This change enhances the AWS provider's secret validation system by implementing structured field-level validation with improved error handling and security measures. The update transitions from simple string-based error returns to a comprehensive field-based validation approach using Kubernetes' validation framework. Walkthrough
Model: claude-sonnet-4-20250514 | Prompt Tokens: 21173 | Completion Tokens: 226 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AndreasBurger, wpross The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
How to categorize this PR?
/area security
/kind enhancement
/platform aws
What this PR does / why we need it:
This PR adds input validation for DNS provider secrets for the
aws-dnsprovider added in the shoots specIt complements PR1479
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note: