Skip to content

Commit 182e3bc

Browse files
authored
add missing fields to OperatorConfiguration CRD validation (#767)
1 parent 629feac commit 182e3bc

File tree

9 files changed

+106
-107
lines changed

9 files changed

+106
-107
lines changed

charts/postgres-operator/crds/operatorconfigurations.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ spec:
121121
type: array
122122
items:
123123
type: string
124+
master_pod_move_timeout:
125+
type: string
124126
node_readiness_label:
125127
type: object
126128
additionalProperties:
@@ -138,10 +140,16 @@ spec:
138140
enum:
139141
- "ordered_ready"
140142
- "parallel"
143+
pod_priority_class_name:
144+
type: string
141145
pod_role_label:
142146
type: string
147+
pod_service_account_definition:
148+
type: string
143149
pod_service_account_name:
144150
type: string
151+
pod_service_account_role_binding_definition:
152+
type: string
145153
pod_terminate_grace_period:
146154
type: string
147155
secret_name_template:
@@ -189,16 +197,16 @@ spec:
189197
load_balancer:
190198
type: object
191199
properties:
200+
custom_service_annotations:
201+
type: object
202+
additionalProperties:
203+
type: string
192204
db_hosted_zone:
193205
type: string
194206
enable_master_load_balancer:
195207
type: boolean
196208
enable_replica_load_balancer:
197209
type: boolean
198-
custom_service_annotations:
199-
type: object
200-
additionalProperties:
201-
type: string
202210
master_dns_name_format:
203211
type: string
204212
replica_dns_name_format:
@@ -221,21 +229,21 @@ spec:
221229
logical_backup:
222230
type: object
223231
properties:
224-
logical_backup_schedule:
225-
type: string
226-
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
227232
logical_backup_docker_image:
228233
type: string
234+
logical_backup_s3_access_key_id:
235+
type: string
229236
logical_backup_s3_bucket:
230237
type: string
231238
logical_backup_s3_endpoint:
232239
type: string
233-
logical_backup_s3_sse:
240+
logical_backup_s3_secret_access_key:
234241
type: string
235-
logical_backup_s3_access_key_id:
242+
logical_backup_s3_sse:
236243
type: string
237-
logical_backup_s3_secret_access_key:
244+
logical_backup_schedule:
238245
type: string
246+
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
239247
debug:
240248
type: object
241249
properties:

manifests/complete-postgres-manifest.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ metadata:
66
# environment: demo
77
spec:
88
dockerImage: registry.opensource.zalan.do/acid/spilo-11:1.6-p1
9-
initContainers:
10-
- name: date
11-
image: busybox
12-
command: [ "/bin/date" ]
139
teamId: "acid"
1410
volume:
1511
size: 1Gi
@@ -25,18 +21,22 @@ spec:
2521
- 127.0.0.1/32
2622
databases:
2723
foo: zalando
28-
# podAnnotations:
29-
# annotation.key: value
30-
# Expert section
31-
32-
enableShmVolume: true
33-
# spiloFSGroup: 103
3424
postgresql:
3525
version: "11"
36-
parameters:
26+
parameters: # Expert section
3727
shared_buffers: "32MB"
3828
max_connections: "10"
3929
log_statement: "all"
30+
31+
enableShmVolume: true
32+
# spiloFSGroup: 103
33+
# podAnnotations:
34+
# annotation.key: value
35+
# podPriorityClassName: "spilo-pod-priority"
36+
# tolerations:
37+
# - key: postgres
38+
# operator: Exists
39+
# effect: NoSchedule
4040
resources:
4141
requests:
4242
cpu: 10m
@@ -63,6 +63,7 @@ spec:
6363
loop_wait: &loop_wait 10
6464
retry_timeout: 10
6565
maximum_lag_on_failover: 33554432
66+
6667
# restore a Postgres DB with point-in-time-recovery
6768
# with a non-empty timestamp, clone from an S3 bucket using the latest backup before the timestamp
6869
# with an empty/absent timestamp, clone from an existing alive cluster using pg_basebackup
@@ -75,9 +76,15 @@ spec:
7576
# run periodic backups with k8s cron jobs
7677
# enableLogicalBackup: true
7778
# logicalBackupSchedule: "30 00 * * *"
78-
maintenanceWindows:
79-
- 01:00-06:00 #UTC
80-
- Sat:00:00-04:00
79+
80+
# maintenanceWindows:
81+
# - 01:00-06:00 #UTC
82+
# - Sat:00:00-04:00
83+
84+
initContainers:
85+
- name: date
86+
image: busybox
87+
command: [ "/bin/date" ]
8188
# sidecars:
8289
# - name: "telegraf-sidecar"
8390
# image: "telegraf:latest"

manifests/operatorconfiguration.crd.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ spec:
9797
type: array
9898
items:
9999
type: string
100+
master_pod_move_timeout:
101+
type: string
100102
node_readiness_label:
101103
type: object
102104
additionalProperties:
@@ -114,10 +116,16 @@ spec:
114116
enum:
115117
- "ordered_ready"
116118
- "parallel"
119+
pod_priority_class_name:
120+
type: string
117121
pod_role_label:
118122
type: string
123+
pod_service_account_definition:
124+
type: string
119125
pod_service_account_name:
120126
type: string
127+
pod_service_account_role_binding_definition:
128+
type: string
121129
pod_terminate_grace_period:
122130
type: string
123131
secret_name_template:
@@ -165,16 +173,16 @@ spec:
165173
load_balancer:
166174
type: object
167175
properties:
176+
custom_service_annotations:
177+
type: object
178+
additionalProperties:
179+
type: string
168180
db_hosted_zone:
169181
type: string
170182
enable_master_load_balancer:
171183
type: boolean
172184
enable_replica_load_balancer:
173185
type: boolean
174-
custom_service_annotations:
175-
type: object
176-
additionalProperties:
177-
type: string
178186
master_dns_name_format:
179187
type: string
180188
replica_dns_name_format:
@@ -197,21 +205,21 @@ spec:
197205
logical_backup:
198206
type: object
199207
properties:
200-
logical_backup_schedule:
201-
type: string
202-
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
203208
logical_backup_docker_image:
204209
type: string
210+
logical_backup_s3_access_key_id:
211+
type: string
205212
logical_backup_s3_bucket:
206213
type: string
207214
logical_backup_s3_endpoint:
208215
type: string
209-
logical_backup_s3_sse:
216+
logical_backup_s3_secret_access_key:
210217
type: string
211-
logical_backup_s3_access_key_id:
218+
logical_backup_s3_sse:
212219
type: string
213-
logical_backup_s3_secret_access_key:
220+
logical_backup_schedule:
214221
type: string
222+
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
215223
debug:
216224
type: object
217225
properties:

manifests/postgresql-operator-default-configuration.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ configuration:
2121
kubernetes:
2222
cluster_domain: cluster.local
2323
cluster_labels:
24-
application: spilo
24+
application: spilo
2525
cluster_name_label: cluster-name
2626
# custom_pod_annotations:
2727
# keya: valuea
@@ -34,15 +34,19 @@ configuration:
3434
# inherited_labels:
3535
# - application
3636
# - environment
37+
master_pod_move_timeout: 20m
3738
# node_readiness_label:
3839
# status: ready
3940
oauth_token_secret_name: postgresql-operator
4041
pdb_name_format: "postgres-{cluster}-pdb"
4142
pod_antiaffinity_topology_key: "kubernetes.io/hostname"
4243
# pod_environment_configmap: ""
4344
pod_management_policy: "ordered_ready"
45+
# pod_priority_class_name: ""
4446
pod_role_label: spilo-role
47+
# pod_service_account_definition: ""
4548
pod_service_account_name: zalando-postgres-operator
49+
# pod_service_account_role_binding_definition: ""
4650
pod_terminate_grace_period: 5m
4751
secret_name_template: "{username}.{cluster}.credentials.{tprkind}.{tprgroup}"
4852
# spilo_fsgroup: 103
@@ -79,10 +83,10 @@ configuration:
7983
# wal_s3_bucket: ""
8084
logical_backup:
8185
logical_backup_docker_image: "registry.opensource.zalan.do/acid/logical-backup"
82-
logical_backup_s3_access_key_id: ""
86+
# logical_backup_s3_access_key_id: ""
8387
logical_backup_s3_bucket: "my-bucket-url"
84-
logical_backup_s3_endpoint: ""
85-
logical_backup_s3_secret_access_key: ""
88+
# logical_backup_s3_endpoint: ""
89+
# logical_backup_s3_secret_access_key: ""
8690
logical_backup_s3_sse: "AES256"
8791
logical_backup_schedule: "30 00 * * *"
8892
debug:

manifests/standby-manifest.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,3 @@ spec:
1313
# Make this a standby cluster and provide the s3 bucket path of source cluster for continuous streaming.
1414
standby:
1515
s3_wal_path: "s3://path/to/bucket/containing/wal/of/source/cluster/"
16-
17-
maintenanceWindows:
18-
- 01:00-06:00 #UTC
19-
- Sat:00:00-04:00

pkg/apis/acid.zalan.do/v1/crds.go

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,9 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
717717
},
718718
},
719719
},
720+
"master_pod_move_timeout": {
721+
Type: "string",
722+
},
720723
"node_readiness_label": {
721724
Type: "object",
722725
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{
@@ -748,12 +751,21 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
748751
},
749752
},
750753
},
754+
"pod_priority_class_name": {
755+
Type: "string",
756+
},
751757
"pod_role_label": {
752758
Type: "string",
753759
},
760+
"pod_service_account_definition": {
761+
Type: "string",
762+
},
754763
"pod_service_account_name": {
755764
Type: "string",
756765
},
766+
"pod_service_account_role_binding_definition": {
767+
Type: "string",
768+
},
757769
"pod_terminate_grace_period": {
758770
Type: "string",
759771
},
@@ -826,6 +838,14 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
826838
"load_balancer": {
827839
Type: "object",
828840
Properties: map[string]apiextv1beta1.JSONSchemaProps{
841+
"custom_service_annotations": {
842+
Type: "object",
843+
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{
844+
Schema: &apiextv1beta1.JSONSchemaProps{
845+
Type: "string",
846+
},
847+
},
848+
},
829849
"db_hosted_zone": {
830850
Type: "string",
831851
},
@@ -835,14 +855,6 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
835855
"enable_replica_load_balancer": {
836856
Type: "boolean",
837857
},
838-
"custom_service_annotations": {
839-
Type: "object",
840-
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{
841-
Schema: &apiextv1beta1.JSONSchemaProps{
842-
Type: "string",
843-
},
844-
},
845-
},
846858
"master_dns_name_format": {
847859
Type: "string",
848860
},
@@ -877,27 +889,27 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
877889
"logical_backup": {
878890
Type: "object",
879891
Properties: map[string]apiextv1beta1.JSONSchemaProps{
880-
"logical_backup_schedule": {
881-
Type: "string",
882-
Pattern: "^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$",
883-
},
884892
"logical_backup_docker_image": {
885893
Type: "string",
886894
},
895+
"logical_backup_s3_access_key_id": {
896+
Type: "string",
897+
},
887898
"logical_backup_s3_bucket": {
888899
Type: "string",
889900
},
890901
"logical_backup_s3_endpoint": {
891902
Type: "string",
892903
},
893-
"logical_backup_s3_sse": {
904+
"logical_backup_s3_secret_access_key": {
894905
Type: "string",
895906
},
896-
"logical_backup_s3_access_key_id": {
907+
"logical_backup_s3_sse": {
897908
Type: "string",
898909
},
899-
"logical_backup_s3_secret_access_key": {
900-
Type: "string",
910+
"logical_backup_schedule": {
911+
Type: "string",
912+
Pattern: "^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$",
901913
},
902914
},
903915
},

0 commit comments

Comments
 (0)