add missing fields to OperatorConfiguration CRD validation

This commit is contained in:
Felix Kunde 2019-12-16 16:05:47 +01:00
parent 97e0d6d388
commit f9fc55cfe0
9 changed files with 109 additions and 110 deletions

View File

@ -121,6 +121,8 @@ spec:
type: array type: array
items: items:
type: string type: string
master_pod_move_timeout:
type: string
node_readiness_label: node_readiness_label:
type: object type: object
additionalProperties: additionalProperties:
@ -138,10 +140,16 @@ spec:
enum: enum:
- "ordered_ready" - "ordered_ready"
- "parallel" - "parallel"
pod_priority_class_name:
type: string
pod_role_label: pod_role_label:
type: string type: string
pod_service_account_definition:
type: string
pod_service_account_name: pod_service_account_name:
type: string type: string
pod_service_account_role_binding_definition:
type: string
pod_terminate_grace_period: pod_terminate_grace_period:
type: string type: string
secret_name_template: secret_name_template:
@ -189,16 +197,16 @@ spec:
load_balancer: load_balancer:
type: object type: object
properties: properties:
custom_service_annotations:
type: object
additionalProperties:
type: string
db_hosted_zone: db_hosted_zone:
type: string type: string
enable_master_load_balancer: enable_master_load_balancer:
type: boolean type: boolean
enable_replica_load_balancer: enable_replica_load_balancer:
type: boolean type: boolean
custom_service_annotations:
type: object
additionalProperties:
type: string
master_dns_name_format: master_dns_name_format:
type: string type: string
replica_dns_name_format: replica_dns_name_format:
@ -221,21 +229,21 @@ spec:
logical_backup: logical_backup:
type: object type: object
properties: properties:
logical_backup_schedule:
type: string
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
logical_backup_docker_image: logical_backup_docker_image:
type: string type: string
logical_backup_s3_access_key_id:
type: string
logical_backup_s3_bucket: logical_backup_s3_bucket:
type: string type: string
logical_backup_s3_endpoint: logical_backup_s3_endpoint:
type: string type: string
logical_backup_s3_sse:
type: string
logical_backup_s3_access_key_id:
type: string
logical_backup_s3_secret_access_key: logical_backup_s3_secret_access_key:
type: string type: string
logical_backup_s3_sse:
type: string
logical_backup_schedule:
type: string
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
debug: debug:
type: object type: object
properties: properties:

View File

@ -6,10 +6,6 @@ metadata:
# environment: demo # environment: demo
spec: spec:
dockerImage: registry.opensource.zalan.do/acid/spilo-11:1.6-p1 dockerImage: registry.opensource.zalan.do/acid/spilo-11:1.6-p1
initContainers:
- name: date
image: busybox
command: [ "/bin/date" ]
teamId: "acid" teamId: "acid"
volume: volume:
size: 1Gi size: 1Gi
@ -25,18 +21,22 @@ spec:
- 127.0.0.1/32 - 127.0.0.1/32
databases: databases:
foo: zalando foo: zalando
# podAnnotations:
# annotation.key: value
# Expert section
enableShmVolume: true
# spiloFSGroup: 103
postgresql: postgresql:
version: "11" version: "11"
parameters: parameters: # Expert section
shared_buffers: "32MB" shared_buffers: "32MB"
max_connections: "10" max_connections: "10"
log_statement: "all" log_statement: "all"
enableShmVolume: true
# spiloFSGroup: 103
# podAnnotations:
# annotation.key: value
# podPriorityClassName: "spilo-pod-priority"
# tolerations:
# - key: postgres
# operator: Exists
# effect: NoSchedule
resources: resources:
requests: requests:
cpu: 10m cpu: 10m
@ -63,6 +63,7 @@ spec:
loop_wait: &loop_wait 10 loop_wait: &loop_wait 10
retry_timeout: 10 retry_timeout: 10
maximum_lag_on_failover: 33554432 maximum_lag_on_failover: 33554432
# restore a Postgres DB with point-in-time-recovery # restore a Postgres DB with point-in-time-recovery
# with a non-empty timestamp, clone from an S3 bucket using the latest backup before the timestamp # with a non-empty timestamp, clone from an S3 bucket using the latest backup before the timestamp
# with an empty/absent timestamp, clone from an existing alive cluster using pg_basebackup # with an empty/absent timestamp, clone from an existing alive cluster using pg_basebackup
@ -75,9 +76,15 @@ spec:
# run periodic backups with k8s cron jobs # run periodic backups with k8s cron jobs
# enableLogicalBackup: true # enableLogicalBackup: true
# logicalBackupSchedule: "30 00 * * *" # logicalBackupSchedule: "30 00 * * *"
maintenanceWindows:
- 01:00-06:00 #UTC # maintenanceWindows:
- Sat:00:00-04:00 # - 01:00-06:00 #UTC
# - Sat:00:00-04:00
initContainers:
- name: date
image: busybox
command: [ "/bin/date" ]
# sidecars: # sidecars:
# - name: "telegraf-sidecar" # - name: "telegraf-sidecar"
# image: "telegraf:latest" # image: "telegraf:latest"

View File

@ -97,6 +97,8 @@ spec:
type: array type: array
items: items:
type: string type: string
master_pod_move_timeout:
type: string
node_readiness_label: node_readiness_label:
type: object type: object
additionalProperties: additionalProperties:
@ -114,10 +116,16 @@ spec:
enum: enum:
- "ordered_ready" - "ordered_ready"
- "parallel" - "parallel"
pod_priority_class_name:
type: string
pod_role_label: pod_role_label:
type: string type: string
pod_service_account_definition:
type: string
pod_service_account_name: pod_service_account_name:
type: string type: string
pod_service_account_role_binding_definition:
type: string
pod_terminate_grace_period: pod_terminate_grace_period:
type: string type: string
secret_name_template: secret_name_template:
@ -165,16 +173,16 @@ spec:
load_balancer: load_balancer:
type: object type: object
properties: properties:
custom_service_annotations:
type: object
additionalProperties:
type: string
db_hosted_zone: db_hosted_zone:
type: string type: string
enable_master_load_balancer: enable_master_load_balancer:
type: boolean type: boolean
enable_replica_load_balancer: enable_replica_load_balancer:
type: boolean type: boolean
custom_service_annotations:
type: object
additionalProperties:
type: string
master_dns_name_format: master_dns_name_format:
type: string type: string
replica_dns_name_format: replica_dns_name_format:
@ -197,21 +205,21 @@ spec:
logical_backup: logical_backup:
type: object type: object
properties: properties:
logical_backup_schedule:
type: string
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
logical_backup_docker_image: logical_backup_docker_image:
type: string type: string
logical_backup_s3_access_key_id:
type: string
logical_backup_s3_bucket: logical_backup_s3_bucket:
type: string type: string
logical_backup_s3_endpoint: logical_backup_s3_endpoint:
type: string type: string
logical_backup_s3_sse:
type: string
logical_backup_s3_access_key_id:
type: string
logical_backup_s3_secret_access_key: logical_backup_s3_secret_access_key:
type: string type: string
logical_backup_s3_sse:
type: string
logical_backup_schedule:
type: string
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
debug: debug:
type: object type: object
properties: properties:

View File

@ -21,7 +21,7 @@ configuration:
kubernetes: kubernetes:
cluster_domain: cluster.local cluster_domain: cluster.local
cluster_labels: cluster_labels:
application: spilo application: spilo
cluster_name_label: cluster-name cluster_name_label: cluster-name
# custom_pod_annotations: # custom_pod_annotations:
# keya: valuea # keya: valuea
@ -34,6 +34,7 @@ configuration:
# inherited_labels: # inherited_labels:
# - application # - application
# - environment # - environment
master_pod_move_timeout: 20m
# node_readiness_label: # node_readiness_label:
# status: ready # status: ready
oauth_token_secret_name: postgresql-operator oauth_token_secret_name: postgresql-operator
@ -41,8 +42,11 @@ configuration:
pod_antiaffinity_topology_key: "kubernetes.io/hostname" pod_antiaffinity_topology_key: "kubernetes.io/hostname"
# pod_environment_configmap: "" # pod_environment_configmap: ""
pod_management_policy: "ordered_ready" pod_management_policy: "ordered_ready"
# pod_priority_class_name: ""
pod_role_label: spilo-role pod_role_label: spilo-role
# pod_service_account_definition: ""
pod_service_account_name: zalando-postgres-operator pod_service_account_name: zalando-postgres-operator
# pod_service_account_role_binding_definition: ""
pod_terminate_grace_period: 5m pod_terminate_grace_period: 5m
secret_name_template: "{username}.{cluster}.credentials.{tprkind}.{tprgroup}" secret_name_template: "{username}.{cluster}.credentials.{tprkind}.{tprgroup}"
# spilo_fsgroup: 103 # spilo_fsgroup: 103
@ -79,10 +83,10 @@ configuration:
# wal_s3_bucket: "" # wal_s3_bucket: ""
logical_backup: logical_backup:
logical_backup_docker_image: "registry.opensource.zalan.do/acid/logical-backup" logical_backup_docker_image: "registry.opensource.zalan.do/acid/logical-backup"
logical_backup_s3_access_key_id: "" # logical_backup_s3_access_key_id: ""
logical_backup_s3_bucket: "my-bucket-url" logical_backup_s3_bucket: "my-bucket-url"
logical_backup_s3_endpoint: "" # logical_backup_s3_endpoint: ""
logical_backup_s3_secret_access_key: "" # logical_backup_s3_secret_access_key: ""
logical_backup_s3_sse: "AES256" logical_backup_s3_sse: "AES256"
logical_backup_schedule: "30 00 * * *" logical_backup_schedule: "30 00 * * *"
debug: debug:

View File

@ -13,7 +13,3 @@ spec:
# Make this a standby cluster and provide the s3 bucket path of source cluster for continuous streaming. # Make this a standby cluster and provide the s3 bucket path of source cluster for continuous streaming.
standby: standby:
s3_wal_path: "s3://path/to/bucket/containing/wal/of/source/cluster/" s3_wal_path: "s3://path/to/bucket/containing/wal/of/source/cluster/"
maintenanceWindows:
- 01:00-06:00 #UTC
- Sat:00:00-04:00

View File

@ -717,6 +717,9 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
}, },
}, },
"master_pod_move_timeout": {
Type: "string",
},
"node_readiness_label": { "node_readiness_label": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{
@ -748,12 +751,21 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
}, },
}, },
"pod_priority_class_name": {
Type: "string",
},
"pod_role_label": { "pod_role_label": {
Type: "string", Type: "string",
}, },
"pod_service_account_definition": {
Type: "string",
},
"pod_service_account_name": { "pod_service_account_name": {
Type: "string", Type: "string",
}, },
"pod_service_account_role_binding_definition": {
Type: "string",
},
"pod_terminate_grace_period": { "pod_terminate_grace_period": {
Type: "string", Type: "string",
}, },
@ -826,6 +838,14 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
"load_balancer": { "load_balancer": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1beta1.JSONSchemaProps{
"custom_service_annotations": {
Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{
Type: "string",
},
},
},
"db_hosted_zone": { "db_hosted_zone": {
Type: "string", Type: "string",
}, },
@ -835,14 +855,6 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
"enable_replica_load_balancer": { "enable_replica_load_balancer": {
Type: "boolean", Type: "boolean",
}, },
"custom_service_annotations": {
Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{
Type: "string",
},
},
},
"master_dns_name_format": { "master_dns_name_format": {
Type: "string", Type: "string",
}, },
@ -877,27 +889,27 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
"logical_backup": { "logical_backup": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1beta1.JSONSchemaProps{
"logical_backup_schedule": {
Type: "string",
Pattern: "^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$",
},
"logical_backup_docker_image": { "logical_backup_docker_image": {
Type: "string", Type: "string",
}, },
"logical_backup_s3_access_key_id": {
Type: "string",
},
"logical_backup_s3_bucket": { "logical_backup_s3_bucket": {
Type: "string", Type: "string",
}, },
"logical_backup_s3_endpoint": { "logical_backup_s3_endpoint": {
Type: "string", Type: "string",
}, },
"logical_backup_s3_secret_access_key": {
Type: "string",
},
"logical_backup_s3_sse": { "logical_backup_s3_sse": {
Type: "string", Type: "string",
}, },
"logical_backup_s3_access_key_id": { "logical_backup_schedule": {
Type: "string", Type: "string",
}, Pattern: "^(\\d+|\\*)(/\\d+)?(\\s+(\\d+|\\*)(/\\d+)?){4}$",
"logical_backup_s3_secret_access_key": {
Type: "string",
}, },
}, },
}, },

View File

@ -118,7 +118,7 @@ type OperatorDebugConfiguration struct {
EnableDBAccess bool `json:"enable_database_access,omitempty"` EnableDBAccess bool `json:"enable_database_access,omitempty"`
} }
// TeamsAPIConfiguration defines the configration of TeamsAPI // TeamsAPIConfiguration defines the configuration of TeamsAPI
type TeamsAPIConfiguration struct { type TeamsAPIConfiguration struct {
EnableTeamsAPI bool `json:"enable_teams_api,omitempty"` EnableTeamsAPI bool `json:"enable_teams_api,omitempty"`
TeamsAPIUrl string `json:"teams_api_url,omitempty"` TeamsAPIUrl string `json:"teams_api_url,omitempty"`
@ -150,6 +150,17 @@ type ScalyrConfiguration struct {
ScalyrMemoryLimit string `json:"scalyr_memory_limit,omitempty"` ScalyrMemoryLimit string `json:"scalyr_memory_limit,omitempty"`
} }
// OperatorLogicalBackupConfiguration defines configuration for logical backup
type OperatorLogicalBackupConfiguration struct {
Schedule string `json:"logical_backup_schedule,omitempty"`
DockerImage string `json:"logical_backup_docker_image,omitempty"`
S3Bucket string `json:"logical_backup_s3_bucket,omitempty"`
S3Endpoint string `json:"logical_backup_s3_endpoint,omitempty"`
S3AccessKeyID string `json:"logical_backup_s3_access_key_id,omitempty"`
S3SecretAccessKey string `json:"logical_backup_s3_secret_access_key,omitempty"`
S3SSE string `json:"logical_backup_s3_sse,omitempty"`
}
// OperatorConfigurationData defines the operation config // OperatorConfigurationData defines the operation config
type OperatorConfigurationData struct { type OperatorConfigurationData struct {
EnableCRDValidation *bool `json:"enable_crd_validation,omitempty"` EnableCRDValidation *bool `json:"enable_crd_validation,omitempty"`
@ -176,24 +187,5 @@ type OperatorConfigurationData struct {
LogicalBackup OperatorLogicalBackupConfiguration `json:"logical_backup"` LogicalBackup OperatorLogicalBackupConfiguration `json:"logical_backup"`
} }
// OperatorConfigurationUsers defines configration for super user
type OperatorConfigurationUsers struct {
SuperUserName string `json:"superuser_name,omitempty"`
Replication string `json:"replication_user_name,omitempty"`
ProtectedRoles []string `json:"protected_roles,omitempty"`
TeamAPIRoleConfiguration map[string]string `json:"team_api_role_configuration,omitempty"`
}
//Duration shortens this frequently used name //Duration shortens this frequently used name
type Duration time.Duration type Duration time.Duration
// OperatorLogicalBackupConfiguration defines configration for logical backup
type OperatorLogicalBackupConfiguration struct {
Schedule string `json:"logical_backup_schedule,omitempty"`
DockerImage string `json:"logical_backup_docker_image,omitempty"`
S3Bucket string `json:"logical_backup_s3_bucket,omitempty"`
S3Endpoint string `json:"logical_backup_s3_endpoint,omitempty"`
S3AccessKeyID string `json:"logical_backup_s3_access_key_id,omitempty"`
S3SecretAccessKey string `json:"logical_backup_s3_secret_access_key,omitempty"`
S3SSE string `json:"logical_backup_s3_sse,omitempty"`
}

View File

@ -300,34 +300,6 @@ func (in *OperatorConfigurationList) DeepCopyObject() runtime.Object {
return nil return nil
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OperatorConfigurationUsers) DeepCopyInto(out *OperatorConfigurationUsers) {
*out = *in
if in.ProtectedRoles != nil {
in, out := &in.ProtectedRoles, &out.ProtectedRoles
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.TeamAPIRoleConfiguration != nil {
in, out := &in.TeamAPIRoleConfiguration, &out.TeamAPIRoleConfiguration
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorConfigurationUsers.
func (in *OperatorConfigurationUsers) DeepCopy() *OperatorConfigurationUsers {
if in == nil {
return nil
}
out := new(OperatorConfigurationUsers)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OperatorDebugConfiguration) DeepCopyInto(out *OperatorDebugConfiguration) { func (in *OperatorDebugConfiguration) DeepCopyInto(out *OperatorDebugConfiguration) {
*out = *in *out = *in

View File

@ -69,7 +69,7 @@ type Scalyr struct {
ScalyrMemoryLimit string `name:"scalyr_memory_limit" default:"1Gi"` ScalyrMemoryLimit string `name:"scalyr_memory_limit" default:"1Gi"`
} }
// LogicalBackup defines configration for logical backup // LogicalBackup defines configuration for logical backup
type LogicalBackup struct { type LogicalBackup struct {
LogicalBackupSchedule string `name:"logical_backup_schedule" default:"30 00 * * *"` LogicalBackupSchedule string `name:"logical_backup_schedule" default:"30 00 * * *"`
LogicalBackupDockerImage string `name:"logical_backup_docker_image" default:"registry.opensource.zalan.do/acid/logical-backup"` LogicalBackupDockerImage string `name:"logical_backup_docker_image" default:"registry.opensource.zalan.do/acid/logical-backup"`