return kind and apiVersion to validation and minor fixes

This commit is contained in:
Felix Kunde 2019-10-31 15:27:06 +01:00
parent 37f7b542f3
commit 9e942b4920
5 changed files with 100 additions and 24 deletions

View File

@ -56,9 +56,20 @@ spec:
status: {} status: {}
validation: validation:
openAPIV3Schema: openAPIV3Schema:
type: object
required: required:
- kind
- apiVersion
- spec - spec
properties: properties:
kind:
type: string
enum:
- postgresql
apiVersion:
type: string
enum:
- acid.zalan.do/v1
spec: spec:
type: object type: object
required: required:
@ -68,6 +79,7 @@ spec:
properties: properties:
allowedSourceRanges: allowedSourceRanges:
type: array type: array
nullable: true
items: items:
type: string type: string
pattern: '^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\/(\d|[1-2]\d|3[0-2])$' pattern: '^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\/(\d|[1-2]\d|3[0-2])$'
@ -148,6 +160,8 @@ spec:
type: integer type: integer
maximum_lag_on_failover: maximum_lag_on_failover:
type: integer type: integer
pod_priority_class_name: # deprecated
type: string
podPriorityClassName: podPriorityClassName:
type: string type: string
postgresql: postgresql:
@ -375,15 +389,25 @@ spec:
status: {} status: {}
validation: validation:
openAPIV3Schema: openAPIV3Schema:
type: object
required: required:
- kind
- apiVersion
- configuration - configuration
properties: properties:
kind:
type: string
enum:
- OperatorConfiguration
apiVersion:
type: string
enum:
- acid.zalan.do/v1
configuration: configuration:
type: object type: object
properties: properties:
etcd_host: etcd_host:
type: string type: string
nullable: true
docker_image: docker_image:
type: string type: string
max_instances: max_instances:
@ -466,7 +490,6 @@ spec:
type: string type: string
watched_namespace: watched_namespace:
type: string type: string
nullable: true
postgres_pod_resources: postgres_pod_resources:
type: object type: object
properties: properties:

View File

@ -16,15 +16,25 @@ spec:
status: {} status: {}
validation: validation:
openAPIV3Schema: openAPIV3Schema:
type: object
required: required:
- kind
- apiVersion
- configuration - configuration
properties: properties:
kind:
type: string
enum:
- OperatorConfiguration
apiVersion:
type: string
enum:
- acid.zalan.do/v1
configuration: configuration:
type: object type: object
properties: properties:
etcd_host: etcd_host:
type: string type: string
nullable: true
docker_image: docker_image:
type: string type: string
max_instances: max_instances:
@ -107,7 +117,6 @@ spec:
type: string type: string
watched_namespace: watched_namespace:
type: string type: string
nullable: true
postgres_pod_resources: postgres_pod_resources:
type: object type: object
properties: properties:

View File

@ -36,7 +36,7 @@ configuration:
oauth_token_secret_name: postgresql-operator oauth_token_secret_name: postgresql-operator
pdb_name_format: "postgres-{cluster}-pdb" pdb_name_format: "postgres-{cluster}-pdb"
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_role_label: spilo-role pod_role_label: spilo-role
pod_service_account_name: operator pod_service_account_name: operator
@ -44,8 +44,8 @@ configuration:
secret_name_template: "{username}.{cluster}.credentials.{tprkind}.{tprgroup}" secret_name_template: "{username}.{cluster}.credentials.{tprkind}.{tprgroup}"
# spilo_fsgroup: 103 # spilo_fsgroup: 103
spilo_privileged: false spilo_privileged: false
# toleration: {} toleration: {}
# watched_namespace: "" watched_namespace: ""
postgres_pod_resources: postgres_pod_resources:
default_cpu_limit: "3" default_cpu_limit: "3"
default_cpu_request: 100m default_cpu_request: 100m
@ -59,7 +59,7 @@ configuration:
resource_check_interval: 3s resource_check_interval: 3s
resource_check_timeout: 10m resource_check_timeout: 10m
load_balancer: load_balancer:
# db_hosted_zone: "" db_hosted_zone: ""
enable_master_load_balancer: false enable_master_load_balancer: false
enable_replica_load_balancer: false enable_replica_load_balancer: false
# custom_service_annotations: # custom_service_annotations:
@ -71,9 +71,9 @@ configuration:
# additional_secret_mount: "some-secret-name" # additional_secret_mount: "some-secret-name"
# additional_secret_mount_path: "/some/dir" # additional_secret_mount_path: "/some/dir"
aws_region: eu-central-1 aws_region: eu-central-1
# kube_iam_role: "" kube_iam_role: ""
# log_s3_bucket: "" log_s3_bucket: ""
# wal_s3_bucket: "" wal_s3_bucket: ""
logical_backup: logical_backup:
log_s3_bucket: "" log_s3_bucket: ""
logical_backup_docker_image: "registry.opensource.zalan.do/acid/logical-backup" logical_backup_docker_image: "registry.opensource.zalan.do/acid/logical-backup"
@ -90,7 +90,7 @@ configuration:
# enable_admin_role_for_users: true # enable_admin_role_for_users: true
enable_team_superuser: false enable_team_superuser: false
enable_teams_api: false enable_teams_api: false
# pam_configuration: "" pam_configuration: ""
pam_role_name: zalandos pam_role_name: zalandos
# postgres_superuser_teams: # postgres_superuser_teams:
# - postgres_superusers # - postgres_superusers

View File

@ -16,18 +16,31 @@ spec:
status: {} status: {}
validation: validation:
openAPIV3Schema: openAPIV3Schema:
type: object
required: required:
- kind
- apiVersion
- spec - spec
properties: properties:
kind:
type: string
enum:
- postgresql
apiVersion:
type: string
enum:
- acid.zalan.do/v1
spec: spec:
type: object type: object
required: required:
- numberOfInstances - numberOfInstances
- teamId - teamId
- postgresql - postgresql
additionalProperties: true
properties: properties:
allowedSourceRanges: allowedSourceRanges:
type: array type: array
nullable: true
items: items:
type: string type: string
pattern: '^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\/(\d|[1-2]\d|3[0-2])$' pattern: '^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\/(\d|[1-2]\d|3[0-2])$'
@ -108,6 +121,8 @@ spec:
type: integer type: integer
maximum_lag_on_failover: maximum_lag_on_failover:
type: integer type: integer
pod_priority_class_name: # deprecated
type: string
podPriorityClassName: podPriorityClassName:
type: string type: string
postgresql: postgresql:

View File

@ -1,7 +1,7 @@
package v1 package v1
import ( import (
"github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do" acidzalando "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do"
apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -110,14 +110,31 @@ var minDisable = -1.0
// PostgresCRDResourceValidation to check applied manifest parameters // PostgresCRDResourceValidation to check applied manifest parameters
var PostgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ var PostgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{
Type: "object", Type: "object",
Required: []string{"spec"}, Required: []string{"kind", "apiVersion", "spec"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1beta1.JSONSchemaProps{
"kind": {
Type: "string",
Enum: []apiextv1beta1.JSON{
{
Raw: []byte(`"postgresql"`),
},
},
},
"apiVersion": {
Type: "string",
Enum: []apiextv1beta1.JSON{
{
Raw: []byte(`"acid.zalan.do/v1"`),
},
},
},
"spec": { "spec": {
Type: "object", Type: "object",
Required: []string{"numberOfInstances", "teamId", "postgresql"}, Required: []string{"numberOfInstances", "teamId", "postgresql"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1beta1.JSONSchemaProps{
"allowedSourceRanges": { "allowedSourceRanges": {
Type: "array", Type: "array",
Nullable: true,
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1beta1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1beta1.JSONSchemaProps{
Type: "string", Type: "string",
@ -524,14 +541,29 @@ var PostgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{
// OperatorConfigCRDResourceValidation to check applied manifest parameters // OperatorConfigCRDResourceValidation to check applied manifest parameters
var OperatorConfigCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ var OperatorConfigCRDResourceValidation = apiextv1beta1.JSONSchemaProps{
Type: "object", Type: "object",
Required: []string{"configuration"}, Required: []string{"kind", "apiVersion", "configuration"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1beta1.JSONSchemaProps{
"kind": {
Type: "string",
Enum: []apiextv1beta1.JSON{
{
Raw: []byte(`"OperatorConfiguration"`),
},
},
},
"apiVersion": {
Type: "string",
Enum: []apiextv1beta1.JSON{
{
Raw: []byte(`"acid.zalan.do/v1"`),
},
},
},
"configuration": { "configuration": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1beta1.JSONSchemaProps{
"etcd_host": { "etcd_host": {
Type: "string", Type: "string",
Nullable: true,
}, },
"docker_image": { "docker_image": {
Type: "string", Type: "string",
@ -663,8 +695,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.JSONSchemaProps{
}, },
}, },
"watched_namespace": { "watched_namespace": {
Type: "string", Type: "string",
Nullable: true,
}, },
}, },
}, },
@ -808,8 +839,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
"postgres_superuser_teams": { "postgres_superuser_teams": {
Type: "array", Type: "array",
Nullable: true,
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1beta1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1beta1.JSONSchemaProps{
Type: "string", Type: "string",
@ -817,8 +847,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.JSONSchemaProps{
}, },
}, },
"protected_role_names": { "protected_role_names": {
Type: "array", Type: "array",
Nullable: true,
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1beta1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1beta1.JSONSchemaProps{
Type: "string", Type: "string",