Skip to content

Commit ac0be86

Browse files
committed
Add support for multiple Cinder Backups configuration
This patch integrates CinderBackup support into OpenStackControlPlane CRD and adds the corresponding logic. It enables configuration of multiple Cinder Backup services and deprecates the existing interface [1]. [1] openstack-k8s-operators/cinder-operator#575 Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 3aa569b commit ac0be86

14 files changed

+358
-14
lines changed

api/bases/core.openstack.org_openstackcontrolplanes.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,70 @@ spec:
877877
type: string
878878
type: object
879879
type: object
880+
cinderBackups:
881+
additionalProperties:
882+
properties:
883+
customServiceConfig:
884+
type: string
885+
customServiceConfigSecrets:
886+
items:
887+
type: string
888+
type: array
889+
networkAttachments:
890+
items:
891+
type: string
892+
type: array
893+
nodeSelector:
894+
additionalProperties:
895+
type: string
896+
type: object
897+
replicas:
898+
default: 1
899+
format: int32
900+
minimum: 0
901+
type: integer
902+
resources:
903+
properties:
904+
claims:
905+
items:
906+
properties:
907+
name:
908+
type: string
909+
request:
910+
type: string
911+
required:
912+
- name
913+
type: object
914+
type: array
915+
x-kubernetes-list-map-keys:
916+
- name
917+
x-kubernetes-list-type: map
918+
limits:
919+
additionalProperties:
920+
anyOf:
921+
- type: integer
922+
- type: string
923+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
924+
x-kubernetes-int-or-string: true
925+
type: object
926+
requests:
927+
additionalProperties:
928+
anyOf:
929+
- type: integer
930+
- type: string
931+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
932+
x-kubernetes-int-or-string: true
933+
type: object
934+
type: object
935+
topologyRef:
936+
properties:
937+
name:
938+
type: string
939+
namespace:
940+
type: string
941+
type: object
942+
type: object
943+
type: object
880944
cinderScheduler:
881945
properties:
882946
customServiceConfig:

api/core/v1beta1/openstackcontrolplane_webhook.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ func (r *OpenStackControlPlane) ValidateCreateServices(basePath *field.Path) (ad
316316
maps.Keys(r.Spec.Cinder.Template.CinderVolumes),
317317
cinderv1.GetCrMaxLengthCorrection(cinderName)) // omit issue with statefulset pod label "controller-revision-hash": "<statefulset_name>-<hash>"
318318
errors = append(errors, errs...)
319-
errors = append(errors, r.Spec.Cinder.Template.ValidateCreate(basePath.Child("cinder").Child("template"), r.Namespace)...)
319+
warns, errs := r.Spec.Cinder.Template.ValidateCreate(basePath.Child("cinder").Child("template"), r.Namespace)
320+
errors = append(errors, errs...)
321+
warnings = append(warnings, warns...)
320322
errors = append(errors, validateTLSOverrideSpec(&r.Spec.Cinder.APIOverride.Route, basePath.Child("cinder").Child("apiOverride").Child("route"))...)
321323
}
322324

@@ -501,7 +503,9 @@ func (r *OpenStackControlPlane) ValidateUpdateServices(old OpenStackControlPlane
501503
maps.Keys(r.Spec.Cinder.Template.CinderVolumes),
502504
cinderv1.GetCrMaxLengthCorrection(cinderName)) // omit issue with statefulset pod label "controller-revision-hash": "<statefulset_name>-<hash>"
503505
errors = append(errors, errs...)
504-
errors = append(errors, r.Spec.Cinder.Template.ValidateUpdate(*old.Cinder.Template, basePath.Child("cinder").Child("template"), r.Namespace)...)
506+
warns, errs := r.Spec.Cinder.Template.ValidateUpdate(*old.Cinder.Template, basePath.Child("cinder").Child("template"), r.Namespace)
507+
errors = append(errors, errs...)
508+
warnings = append(warnings, warns...)
505509
errors = append(errors, validateTLSOverrideSpec(&r.Spec.Cinder.APIOverride.Route, basePath.Child("cinder").Child("apiOverride").Child("route"))...)
506510
}
507511

api/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,5 @@ replace k8s.io/code-generator => k8s.io/code-generator v0.31.13 //allow-merging
144144
replace k8s.io/component-base => k8s.io/component-base v0.31.13 //allow-merging
145145

146146
replace github.com/cert-manager/cmctl/v2 => github.com/cert-manager/cmctl/v2 v2.1.2-0.20241127223932-88edb96860cf //allow-merging
147+
148+
replace github.com/openstack-k8s-operators/cinder-operator/api => github.com/fmount/cinder-operator/api v0.1.1-0.20251202091338-541711b0ad64

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ github.com/evanphx/json-patch v5.9.11+incompatible h1:ixHHqfcGvxhWkniF1tWxBHA0yb
1616
github.com/evanphx/json-patch v5.9.11+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
1717
github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU=
1818
github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
19+
github.com/fmount/cinder-operator/api v0.1.1-0.20251202085007-944d76aa2341 h1:Uj0p6UmVygA2J6wVubzI48LM9NVSltQOmDDT8yBDtvM=
20+
github.com/fmount/cinder-operator/api v0.1.1-0.20251202085007-944d76aa2341/go.mod h1:IrtEtP+mjH2pHLQvk9ZzKebtjMW50HKG0IhooZgmmDw=
1921
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
2022
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
2123
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
@@ -116,8 +118,6 @@ github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyU
116118
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
117119
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20251125115107-f489fa5ceb3c h1:cQRQbyBmYfS4Ubj/0hwj5IVs0AAZqMyhqA1i50r4oTI=
118120
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20251125115107-f489fa5ceb3c/go.mod h1:HURjuNEy1OrE7bn2snCYMzk148bHaD7u7JleEu9h5ws=
119-
github.com/openstack-k8s-operators/cinder-operator/api v0.6.1-0.20251125143015-0548029d9df0 h1:BfTkwCr4sP5PlsQu65CHO8ZTIDNK7BfB0UWbFTRh730=
120-
github.com/openstack-k8s-operators/cinder-operator/api v0.6.1-0.20251125143015-0548029d9df0/go.mod h1:IrtEtP+mjH2pHLQvk9ZzKebtjMW50HKG0IhooZgmmDw=
121121
github.com/openstack-k8s-operators/designate-operator/api v0.6.1-0.20251125143014-f2b7132f2963 h1:oMTI+YjFMxX2b2Ac9J/YSdpkB1egfSdFDype9sD2y2E=
122122
github.com/openstack-k8s-operators/designate-operator/api v0.6.1-0.20251125143014-f2b7132f2963/go.mod h1:qzxe5RJalpItYbD3+pDIGMrPer/P5M50LQQyuusU7lI=
123123
github.com/openstack-k8s-operators/glance-operator/api v0.6.1-0.20251127153827-e055abae3b33 h1:QwYA2HJKLxOsVBjtGURvhnx2m0yQUB0fN/7IPK1yI74=

bindata/crds/cinder.openstack.org_cinderapis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ spec:
6060
description: |-
6161
CustomServiceConfig - customize the service config using this parameter to change service defaults,
6262
or overwrite rendered information using raw OpenStack config format. The content gets added to
63-
to /etc/<service>/<service>.conf.d directory as a custom config file.
63+
the /etc/<service>/<service>.conf.d directory as a custom config file.
6464
type: string
6565
customServiceConfigSecrets:
6666
description: |-

bindata/crds/cinder.openstack.org_cinderbackups.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ spec:
6060
description: |-
6161
CustomServiceConfig - customize the service config using this parameter to change service defaults,
6262
or overwrite rendered information using raw OpenStack config format. The content gets added to
63-
to /etc/<service>/<service>.conf.d directory as a custom config file.
63+
the /etc/<service>/<service>.conf.d directory as a custom config file.
6464
type: string
6565
customServiceConfigSecrets:
6666
description: |-

bindata/crds/cinder.openstack.org_cinders.yaml

Lines changed: 137 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ spec:
6565
description: |-
6666
CustomServiceConfig - customize the service config using this parameter to change service defaults,
6767
or overwrite rendered information using raw OpenStack config format. The content gets added to
68-
to /etc/<service>/<service>.conf.d directory as a custom config file.
68+
the /etc/<service>/<service>.conf.d directory as a custom config file.
6969
type: string
7070
customServiceConfigSecrets:
7171
description: |-
@@ -377,7 +377,7 @@ spec:
377377
description: |-
378378
CustomServiceConfig - customize the service config using this parameter to change service defaults,
379379
or overwrite rendered information using raw OpenStack config format. The content gets added to
380-
to /etc/<service>/<service>.conf.d directory as a custom config file.
380+
the /etc/<service>/<service>.conf.d directory as a custom config file.
381381
type: string
382382
customServiceConfigSecrets:
383383
description: |-
@@ -488,6 +488,133 @@ spec:
488488
required:
489489
- containerImage
490490
type: object
491+
cinderBackups:
492+
additionalProperties:
493+
description: CinderBackupTemplate defines the input parameters for
494+
the Cinder Backup service
495+
properties:
496+
containerImage:
497+
description: ContainerImage - Cinder Container Image URL (will
498+
be set to environmental default if empty)
499+
type: string
500+
customServiceConfig:
501+
description: |-
502+
CustomServiceConfig - customize the service config using this parameter to change service defaults,
503+
or overwrite rendered information using raw OpenStack config format. The content gets added to
504+
the /etc/<service>/<service>.conf.d directory as a custom config file.
505+
type: string
506+
customServiceConfigSecrets:
507+
description: |-
508+
CustomServiceConfigSecrets - customize the service config using this parameter to specify Secrets
509+
that contain sensitive service config data. The content of each Secret gets added to the
510+
/etc/<service>/<service>.conf.d directory as a custom config file.
511+
items:
512+
type: string
513+
type: array
514+
networkAttachments:
515+
description: NetworkAttachments is a list of NetworkAttachment
516+
resource names to expose the services to the given network
517+
items:
518+
type: string
519+
type: array
520+
nodeSelector:
521+
additionalProperties:
522+
type: string
523+
description: |-
524+
NodeSelector to target subset of worker nodes running this service. Setting here overrides
525+
any global NodeSelector settings within the Cinder CR.
526+
type: object
527+
replicas:
528+
default: 1
529+
description: Replicas - Cinder Backup Replicas
530+
format: int32
531+
minimum: 0
532+
type: integer
533+
resources:
534+
description: |-
535+
Resources - Compute Resources required by this service (Limits/Requests).
536+
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
537+
properties:
538+
claims:
539+
description: |-
540+
Claims lists the names of resources, defined in spec.resourceClaims,
541+
that are used by this container.
542+
543+
This is an alpha field and requires enabling the
544+
DynamicResourceAllocation feature gate.
545+
546+
This field is immutable. It can only be set for containers.
547+
items:
548+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
549+
properties:
550+
name:
551+
description: |-
552+
Name must match the name of one entry in pod.spec.resourceClaims of
553+
the Pod where this field is used. It makes that resource available
554+
inside a container.
555+
type: string
556+
request:
557+
description: |-
558+
Request is the name chosen for a request in the referenced claim.
559+
If empty, everything from the claim is made available, otherwise
560+
only the result of this request.
561+
type: string
562+
required:
563+
- name
564+
type: object
565+
type: array
566+
x-kubernetes-list-map-keys:
567+
- name
568+
x-kubernetes-list-type: map
569+
limits:
570+
additionalProperties:
571+
anyOf:
572+
- type: integer
573+
- type: string
574+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
575+
x-kubernetes-int-or-string: true
576+
description: |-
577+
Limits describes the maximum amount of compute resources allowed.
578+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
579+
type: object
580+
requests:
581+
additionalProperties:
582+
anyOf:
583+
- type: integer
584+
- type: string
585+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
586+
x-kubernetes-int-or-string: true
587+
description: |-
588+
Requests describes the minimum amount of compute resources required.
589+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
590+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
591+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
592+
type: object
593+
type: object
594+
topologyRef:
595+
description: |-
596+
TopologyRef to apply the Topology defined by the associated CR referenced
597+
by name
598+
properties:
599+
name:
600+
description: Name - The Topology CR name that the Service
601+
references
602+
type: string
603+
namespace:
604+
description: |-
605+
Namespace - The Namespace to fetch the Topology CR referenced
606+
NOTE: Namespace currently points by default to the same namespace where
607+
the Service is deployed. Customizing the namespace is not supported and
608+
webhooks prevent editing this field to a value different from the
609+
current project
610+
type: string
611+
type: object
612+
required:
613+
- containerImage
614+
type: object
615+
description: CinderBackups - Spec definition for the Backup service
616+
of this Cinder deployment
617+
type: object
491618
cinderScheduler:
492619
description: CinderScheduler - Spec definition for the Scheduler service
493620
of this Cinder deployment
@@ -500,7 +627,7 @@ spec:
500627
description: |-
501628
CustomServiceConfig - customize the service config using this parameter to change service defaults,
502629
or overwrite rendered information using raw OpenStack config format. The content gets added to
503-
to /etc/<service>/<service>.conf.d directory as a custom config file.
630+
the /etc/<service>/<service>.conf.d directory as a custom config file.
504631
type: string
505632
customServiceConfigSecrets:
506633
description: |-
@@ -624,7 +751,7 @@ spec:
624751
description: |-
625752
CustomServiceConfig - customize the service config using this parameter to change service defaults,
626753
or overwrite rendered information using raw OpenStack config format. The content gets added to
627-
to /etc/<service>/<service>.conf.d directory as a custom config file.
754+
the /etc/<service>/<service>.conf.d directory as a custom config file.
628755
type: string
629756
customServiceConfigSecrets:
630757
description: |-
@@ -1988,6 +2115,12 @@ spec:
19882115
format: int32
19892116
minimum: 0
19902117
type: integer
2118+
cinderBackupsReadyCounts:
2119+
additionalProperties:
2120+
format: int32
2121+
type: integer
2122+
description: ReadyCounts of Cinder Backup instances
2123+
type: object
19912124
cinderSchedulerReadyCount:
19922125
default: 0
19932126
description: ReadyCount of Cinder Scheduler instance

bindata/crds/cinder.openstack.org_cinderschedulers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ spec:
6060
description: |-
6161
CustomServiceConfig - customize the service config using this parameter to change service defaults,
6262
or overwrite rendered information using raw OpenStack config format. The content gets added to
63-
to /etc/<service>/<service>.conf.d directory as a custom config file.
63+
the /etc/<service>/<service>.conf.d directory as a custom config file.
6464
type: string
6565
customServiceConfigSecrets:
6666
description: |-

0 commit comments

Comments
 (0)