Skip to content

[b/r] Add singleton webhook for OpenStackBackupConfig#1904

Merged
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
stuggi:backup_restore_webhook
Apr 30, 2026
Merged

[b/r] Add singleton webhook for OpenStackBackupConfig#1904
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
stuggi:backup_restore_webhook

Conversation

@stuggi

@stuggi stuggi commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

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

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>
@openshift-ci openshift-ci Bot requested review from rabi and slagle April 29, 2026 06:20
@stuggi stuggi requested review from abays and removed request for rabi and slagle April 29, 2026 06:20
@github-actions

Copy link
Copy Markdown

OpenStackControlPlane CRD Size Report

Metric Value
CRD JSON size 322464 bytes (315KB)
Base branch size 322464 bytes
Change +0.00%
Status yellow — growing
Threshold reference
Color Range Meaning
🟢 green < 300KB Comfortable
🟡 yellow 300–400KB Growing
🟠 orange 400–750KB Concerning
🔴 red > 750KB Approaching 1.5MB etcd limit (cut in half to allow space for update)

Comment on lines +73 to +80
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(),
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@abays abays left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci

openshift-ci Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

[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

Details 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

@openshift-merge-bot openshift-merge-bot Bot merged commit c506004 into openstack-k8s-operators:main Apr 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants