Add maintenance_windows items schema to operatorconfiguration CRD

This commit is contained in:
Mitchell Murphy 2026-06-25 17:21:23 -04:00
parent 50d20bfd89
commit bd24953776
No known key found for this signature in database
GPG Key ID: 1C70009C536A9450
5 changed files with 32 additions and 0 deletions

View File

@ -73,6 +73,7 @@ $(GENERATED_CRDS): $(GENERATED)
@sed -i -e 's/listKind: PostgresqlList/listKind: postgresqlList/' manifests/postgresql.crd.yaml
@hack/adjust_postgresql_crd.sh
@mv manifests/acid.zalan.do_operatorconfigurations.yaml manifests/operatorconfiguration.crd.yaml
@hack/adjust_operatorconfiguration_crd.sh
@mv manifests/acid.zalan.do_postgresteams.yaml manifests/postgresteam.crd.yaml
@cp manifests/postgresql.crd.yaml pkg/apis/acid.zalan.do/v1/postgresql.crd.yaml
@cp manifests/operatorconfiguration.crd.yaml pkg/apis/acid.zalan.do/v1/operatorconfiguration.crd.yaml

View File

@ -709,6 +709,9 @@ spec:
type: integer
type: object
maintenance_windows:
items:
pattern: '^\ *((Mon|Tue|Wed|Thu|Fri|Sat|Sun):(2[0-3]|[01]?\d):([0-5]?\d)|(2[0-3]|[01]?\d):([0-5]?\d))-((2[0-3]|[01]?\d):([0-5]?\d)|(2[0-3]|[01]?\d):([0-5]?\d))\ *$'
type: string
type: array
major_version_upgrade:
description: MajorVersionUpgradeConfiguration defines how to execute

View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Hack to adjust the generated operatorconfiguration CRD YAML file and add
# missing field settings which can not be expressed via kubebuilder markers.
#
# Injections:
#
# * type: string and pattern for the maintenance_windows items.
# The MaintenanceWindow type marshals to/from a string (see marshal.go) but
# the field is declared `+kubebuilder:validation:Schemaless` /
# `+kubebuilder:validation:Type=array`, so controller-gen emits a bare
# `type: array` without the required `items` schema. A structural CRD must
# specify `items` for every array, so the generated CRD is rejected with:
# spec.validation.openAPIV3Schema.properties[configuration]
# .properties[maintenance_windows].items: Required value: must be specified
file="${1:-"manifests/operatorconfiguration.crd.yaml"}"
sed -i '/^[[:space:]]*maintenance_windows:$/{
# Capture the indentation
s/^\([[:space:]]*\)maintenance_windows:$/\1maintenance_windows:\n\1 items:\n\1 pattern: '\''^\\ *((Mon|Tue|Wed|Thu|Fri|Sat|Sun):(2[0-3]|[01]?\\d):([0-5]?\\d)|(2[0-3]|[01]?\\d):([0-5]?\\d))-((2[0-3]|[01]?\\d):([0-5]?\\d)|(2[0-3]|[01]?\\d):([0-5]?\\d))\\ *$'\''\n\1 type: string/
}' "$file"

View File

@ -704,6 +704,9 @@ spec:
type: integer
type: object
maintenance_windows:
items:
pattern: '^\ *((Mon|Tue|Wed|Thu|Fri|Sat|Sun):(2[0-3]|[01]?\d):([0-5]?\d)|(2[0-3]|[01]?\d):([0-5]?\d))-((2[0-3]|[01]?\d):([0-5]?\d)|(2[0-3]|[01]?\d):([0-5]?\d))\ *$'
type: string
type: array
major_version_upgrade:
description: MajorVersionUpgradeConfiguration defines how to execute

View File

@ -704,6 +704,9 @@ spec:
type: integer
type: object
maintenance_windows:
items:
pattern: '^\ *((Mon|Tue|Wed|Thu|Fri|Sat|Sun):(2[0-3]|[01]?\d):([0-5]?\d)|(2[0-3]|[01]?\d):([0-5]?\d))-((2[0-3]|[01]?\d):([0-5]?\d)|(2[0-3]|[01]?\d):([0-5]?\d))\ *$'
type: string
type: array
major_version_upgrade:
description: MajorVersionUpgradeConfiguration defines how to execute