Skip to content

Commit 3420f43

Browse files
authored
feat: forbid usage of .spec.configuration.serverName in ObjectStore (#336)
Closes #334 Signed-off-by: Marco Nenciarini <[email protected]>
1 parent c59043a commit 3420f43

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

api/v1/objectstore_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type InstanceSidecarConfiguration struct {
3838
// ObjectStoreSpec defines the desired state of ObjectStore.
3939
type ObjectStoreSpec struct {
4040
// The configuration for the barman-cloud tool suite
41+
// +kubebuilder:validation:XValidation:rule="!has(self.serverName)",fieldPath=".serverName",reason="FieldValueForbidden",message="use the 'serverName' plugin parameter in the Cluster resource"
4142
Configuration barmanapi.BarmanObjectStoreConfiguration `json:"configuration"`
4243

4344
// RetentionPolicy is the retention policy to be used for backups

config/crd/bases/barmancloud.cnpg.io_objectstores.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ spec:
382382
required:
383383
- destinationPath
384384
type: object
385+
x-kubernetes-validations:
386+
- fieldPath: .serverName
387+
message: use the 'serverName' plugin parameter in the Cluster resource
388+
reason: FieldValueForbidden
389+
rule: '!has(self.serverName)'
385390
instanceSidecarConfiguration:
386391
description: The configuration for the sidecar that runs in the instance
387392
pods

manifest.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,11 @@ spec:
381381
required:
382382
- destinationPath
383383
type: object
384+
x-kubernetes-validations:
385+
- fieldPath: .serverName
386+
message: use the 'serverName' plugin parameter in the Cluster resource
387+
reason: FieldValueForbidden
388+
rule: '!has(self.serverName)'
384389
instanceSidecarConfiguration:
385390
description: The configuration for the sidecar that runs in the instance
386391
pods

0 commit comments

Comments
 (0)