Skip to content

Commit e3eb277

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 <[email protected]>
1 parent 3aa569b commit e3eb277

File tree

10 files changed

+348
-6
lines changed

10 files changed

+348
-6
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.20251129140305-509169b1ebe0

api/go.sum

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ 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.20251129140305-509169b1ebe0 h1:YZjRrV8ZdE01IHZAHRtxPl2SHBZWpxslJBdBZxc5DLI=
1920
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
2021
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
2122
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
@@ -116,8 +117,6 @@ github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyU
116117
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
117118
github.com/openstack-k8s-operators/barbican-operator/api v0.6.1-0.20251125115107-f489fa5ceb3c h1:cQRQbyBmYfS4Ubj/0hwj5IVs0AAZqMyhqA1i50r4oTI=
118119
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=
121120
github.com/openstack-k8s-operators/designate-operator/api v0.6.1-0.20251125143014-f2b7132f2963 h1:oMTI+YjFMxX2b2Ac9J/YSdpkB1egfSdFDype9sD2y2E=
122121
github.com/openstack-k8s-operators/designate-operator/api v0.6.1-0.20251125143014-f2b7132f2963/go.mod h1:qzxe5RJalpItYbD3+pDIGMrPer/P5M50LQQyuusU7lI=
123122
github.com/openstack-k8s-operators/glance-operator/api v0.6.1-0.20251127153827-e055abae3b33 h1:QwYA2HJKLxOsVBjtGURvhnx2m0yQUB0fN/7IPK1yI74=

bindata/crds/cinder.openstack.org_cinders.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
to /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: CinderBackup - 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
@@ -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/crds.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,70 @@ spec:
10431043
type: string
10441044
type: object
10451045
type: object
1046+
cinderBackups:
1047+
additionalProperties:
1048+
properties:
1049+
customServiceConfig:
1050+
type: string
1051+
customServiceConfigSecrets:
1052+
items:
1053+
type: string
1054+
type: array
1055+
networkAttachments:
1056+
items:
1057+
type: string
1058+
type: array
1059+
nodeSelector:
1060+
additionalProperties:
1061+
type: string
1062+
type: object
1063+
replicas:
1064+
default: 1
1065+
format: int32
1066+
minimum: 0
1067+
type: integer
1068+
resources:
1069+
properties:
1070+
claims:
1071+
items:
1072+
properties:
1073+
name:
1074+
type: string
1075+
request:
1076+
type: string
1077+
required:
1078+
- name
1079+
type: object
1080+
type: array
1081+
x-kubernetes-list-map-keys:
1082+
- name
1083+
x-kubernetes-list-type: map
1084+
limits:
1085+
additionalProperties:
1086+
anyOf:
1087+
- type: integer
1088+
- type: string
1089+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1090+
x-kubernetes-int-or-string: true
1091+
type: object
1092+
requests:
1093+
additionalProperties:
1094+
anyOf:
1095+
- type: integer
1096+
- type: string
1097+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1098+
x-kubernetes-int-or-string: true
1099+
type: object
1100+
type: object
1101+
topologyRef:
1102+
properties:
1103+
name:
1104+
type: string
1105+
namespace:
1106+
type: string
1107+
type: object
1108+
type: object
1109+
type: object
10461110
cinderScheduler:
10471111
properties:
10481112
customServiceConfig:

0 commit comments

Comments
 (0)