[b/r] Add singleton webhook for OpenStackBackupConfig#1904
Conversation
Add a validating webhook that enforces only one OpenStackBackupConfig instance per namespace. On create, the webhook lists existing instances and rejects the request if one already exists. Update ReconcileBackupConfig to check for a pre-existing BackupConfig before creating the default. If a user has pre-created one, the controller uses it instead of creating a new one. Jira: OSPRH-22912 Jira: OSPRH-22913 Jira: OSPRH-29193 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
OpenStackControlPlane CRD Size Report
Threshold reference
|
| return nil, apierrors.NewForbidden( | ||
| schema.GroupResource{ | ||
| Group: backupv1beta1.GroupVersion.WithKind("OpenStackBackupConfig").Group, | ||
| Resource: backupv1beta1.GroupVersion.WithKind("OpenStackBackupConfig").Kind, | ||
| }, backupConfig.GetName(), &field.Error{ | ||
| Type: field.ErrorTypeForbidden, | ||
| Detail: err.Error(), | ||
| }, |
There was a problem hiding this comment.
Not really important, but is there some other type of general error that would make more sense here instead of Forbidden? Or is this just the pattern we've used in webhook error handling across all operators?
There was a problem hiding this comment.
its the same as we also use in other places, like the osversion https://github.com/openstack-k8s-operators/openstack-operator/blob/main/api/core/v1beta1/openstackversion_webhook.go#L97 . maybe NewConflict is better. maybe we follow up to make them all the same.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abays, stuggi 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 |
c506004
into
openstack-k8s-operators:main
Add a validating webhook that enforces only one OpenStackBackupConfig instance per namespace. On create, the webhook lists existing instances and rejects the request if one already exists.
Update ReconcileBackupConfig to check for a pre-existing BackupConfig before creating the default. If a user has pre-created one, the controller uses it instead of creating a new one.
Jira: OSPRH-22912
Jira: OSPRH-22913
Jira: OSPRH-29193