move to apiextensions from v1beta1 to v1 (#746)

* move to apiextensions from v1beta1 to v1

* remove metadata from CRD validation

* some forgotten change
This commit is contained in:
Felix Kunde 2020-11-02 10:49:29 +01:00 committed by GitHub
parent 7f7beba66b
commit d76419565b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 2459 additions and 1915 deletions

View File

@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: operatorconfigurations.acid.zalan.do name: operatorconfigurations.acid.zalan.do
@ -15,6 +15,13 @@ spec:
singular: operatorconfiguration singular: operatorconfiguration
shortNames: shortNames:
- opconfig - opconfig
scope: Namespaced
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
additionalPrinterColumns: additionalPrinterColumns:
- name: Image - name: Image
type: string type: string
@ -35,11 +42,7 @@ spec:
- name: Age - name: Age
type: date type: date
JSONPath: .metadata.creationTimestamp JSONPath: .metadata.creationTimestamp
scope: Namespaced schema:
subresources:
status: {}
version: v1
validation:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
required: required:
@ -208,6 +211,12 @@ spec:
type: integer type: integer
spilo_privileged: spilo_privileged:
type: boolean type: boolean
storage_resize_mode:
type: string
enum:
- "ebs"
- "pvc"
- "off"
toleration: toleration:
type: object type: object
additionalProperties: additionalProperties:
@ -250,6 +259,132 @@ spec:
type: string type: string
resource_check_timeout: resource_check_timeout:
type: string type: string
load_balancer:
type: object
properties:
custom_service_annotations:
type: object
additionalProperties:
type: string
db_hosted_zone:
type: string
enable_master_load_balancer:
type: boolean
enable_replica_load_balancer:
type: boolean
master_dns_name_format:
type: string
replica_dns_name_format:
type: string
aws_or_gcp:
type: object
properties:
additional_secret_mount:
type: string
additional_secret_mount_path:
type: string
aws_region:
type: string
gcp_credentials:
type: string
kube_iam_role:
type: string
log_s3_bucket:
type: string
wal_gs_bucket:
type: string
wal_s3_bucket:
type: string
logical_backup:
type: object
properties:
logical_backup_docker_image:
type: string
logical_backup_s3_access_key_id:
type: string
logical_backup_s3_bucket:
type: string
logical_backup_s3_endpoint:
type: string
logical_backup_s3_region:
type: string
logical_backup_s3_secret_access_key:
type: string
logical_backup_s3_sse:
type: string
logical_backup_schedule:
type: string
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
debug:
type: object
properties:
debug_logging:
type: boolean
enable_database_access:
type: boolean
teams_api:
type: object
properties:
enable_admin_role_for_users:
type: boolean
enable_team_superuser:
type: boolean
enable_teams_api:
type: boolean
pam_configuration:
type: string
pam_role_name:
type: string
postgres_superuser_teams:
type: array
items:
type: string
pod_service_account_name:
type: string
pod_terminate_grace_period:
type: string
secret_name_template:
type: string
spilo_fsgroup:
type: integer
spilo_privileged:
type: boolean
toleration:
type: object
additionalProperties:
type: string
watched_namespace:
type: string
postgres_pod_resources:
type: object
properties:
default_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
default_cpu_request:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
default_memory_limit:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
default_memory_request:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
timeouts:
type: object
properties:
pod_label_wait_timeout:
type: string
pod_deletion_wait_timeout:
type: string
ready_wait_interval:
type: string
ready_wait_timeout:
type: string
resource_check_interval:
type: string
resource_check_timeout:
type: string
load_balancer: load_balancer:
type: object type: object
properties: properties:
@ -290,23 +425,21 @@ spec:
logical_backup: logical_backup:
type: object type: object
properties: properties:
logical_backup_docker_image: logical_backup_schedule:
type: string type: string
logical_backup_s3_access_key_id: pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
logical_backup_docker_image:
type: string 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_region: logical_backup_s3_sse:
type: string
logical_backup_s3_access_key_id:
type: string 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:
@ -356,6 +489,38 @@ spec:
type: integer type: integer
ring_log_lines: ring_log_lines:
type: integer type: integer
scalyr:
type: object
properties:
scalyr_api_key:
type: string
scalyr_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
scalyr_cpu_request:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
scalyr_image:
type: string
scalyr_memory_limit:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
scalyr_memory_request:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
scalyr_server_url:
type: string
teams_api_url:
type: string
logging_rest_api:
type: object
properties:
api_port:
type: integer
cluster_history_entries:
type: integer
ring_log_lines:
type: integer
scalyr: # deprecated scalyr: # deprecated
type: object type: object
properties: properties:

View File

@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: postgresqls.acid.zalan.do name: postgresqls.acid.zalan.do
@ -15,6 +15,13 @@ spec:
singular: postgresql singular: postgresql
shortNames: shortNames:
- pg - pg
scope: Namespaced
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
additionalPrinterColumns: additionalPrinterColumns:
- name: Team - name: Team
type: string type: string
@ -47,17 +54,12 @@ spec:
type: string type: string
description: Current sync status of postgresql resource description: Current sync status of postgresql resource
JSONPath: .status.PostgresClusterStatus JSONPath: .status.PostgresClusterStatus
scope: Namespaced schema:
subresources:
status: {}
version: v1
validation:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
required: required:
- kind - kind
- apiVersion - apiVersion
- metadata
- spec - spec
properties: properties:
kind: kind:
@ -68,14 +70,6 @@ spec:
type: string type: string
enum: enum:
- acid.zalan.do/v1 - acid.zalan.do/v1
metadata:
type: object
required:
- name
properties:
name:
type: string
maxLength: 53
spec: spec:
type: object type: object
required: required:
@ -204,6 +198,50 @@ spec:
type: boolean type: boolean
enableShmVolume: enableShmVolume:
type: boolean type: boolean
init_containers: # deprecated
type: array
nullable: true
items:
type: object
required:
- cluster
properties:
cluster:
type: string
s3_endpoint:
type: string
s3_access_key_id:
type: string
s3_secret_access_key:
type: string
s3_force_path_style:
type: string
s3_wal_path:
type: string
timestamp:
type: string
pattern: '^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([+-]([01][0-9]|2[0-3]):[0-5][0-9]))$'
# The regexp matches the date-time format (RFC 3339 Section 5.6) that specifies a timezone as an offset relative to UTC
# Example: 1996-12-19T16:39:57-08:00
# Note: this field requires a timezone
uid:
format: uuid
type: string
databases:
type: object
additionalProperties:
type: string
# Note: usernames specified here as database owners must be declared in the users key of the spec key.
dockerImage:
type: string
enableLogicalBackup:
type: boolean
enableMasterLoadBalancer:
type: boolean
enableReplicaLoadBalancer:
type: boolean
enableShmVolume:
type: boolean
init_containers: # deprecated init_containers: # deprecated
type: array type: array
nullable: true nullable: true
@ -234,28 +272,18 @@ spec:
type: object type: object
additionalProperties: additionalProperties:
type: string type: string
pg_hba:
type: array
items:
type: string
slots:
type: object
additionalProperties:
type: object
additionalProperties:
type: string
ttl: ttl:
type: integer type: integer
loop_wait: loop_wait:
type: integer type: integer
retry_timeout: retry_timeout:
type: integer type: integer
maximum_lag_on_failover:
type: integer
synchronous_mode: synchronous_mode:
type: boolean type: boolean
synchronous_mode_strict: synchronous_mode_strict:
type: boolean type: boolean
maximum_lag_on_failover:
type: integer
podAnnotations: podAnnotations:
type: object type: object
additionalProperties: additionalProperties:
@ -264,6 +292,17 @@ spec:
type: string type: string
podPriorityClassName: podPriorityClassName:
type: string type: string
postgresql:
type: object
required:
- version
properties:
version:
type: string
pod_priority_class_name: # deprecated
type: string
podPriorityClassName:
type: string
postgresql: postgresql:
type: object type: object
required: required:
@ -283,6 +322,91 @@ spec:
type: object type: object
additionalProperties: additionalProperties:
type: string type: string
replicaLoadBalancer: # deprecated
type: boolean
resources:
type: object
required:
- requests
- limits
properties:
limits:
type: object
required:
- cpu
- memory
properties:
cpu:
type: string
# Decimal natural followed by m, or decimal natural followed by
# dot followed by up to three decimal digits.
#
# This is because the Kubernetes CPU resource has millis as the
# maximum precision. The actual values are checked in code
# because the regular expression would be huge and horrible and
# not very helpful in validation error messages; this one checks
# only the format of the given number.
#
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu
pattern: '^(\d+m|\d+\.\d{1,3})$'
# Note: the value specified here must not be zero or be lower
# than the corresponding request.
memory:
type: string
# You can express memory as a plain integer or as a fixed-point
# integer using one of these suffixes: E, P, T, G, M, k. You can
# also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki
#
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
# Note: the value specified here must not be zero or be lower
# than the corresponding request.
requests:
type: object
required:
- cpu
- memory
properties:
cpu:
type: string
# Decimal natural followed by m, or decimal natural followed by
# dot followed by up to three decimal digits.
#
# This is because the Kubernetes CPU resource has millis as the
# maximum precision. The actual values are checked in code
# because the regular expression would be huge and horrible and
# not very helpful in validation error messages; this one checks
# only the format of the given number.
#
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu
pattern: '^(\d+m|\d+\.\d{1,3})$'
# Note: the value specified here must not be zero or be higher
# than the corresponding limit.
memory:
type: string
# You can express memory as a plain integer or as a fixed-point
# integer using one of these suffixes: E, P, T, G, M, k. You can
# also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki
#
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
# Note: the value specified here must not be zero or be higher
# than the corresponding limit.
sidecars:
type: array
nullable: true
items:
type: object
additionalProperties: true
spiloFSGroup:
type: integer
standby:
type: object
required:
- s3_wal_path
properties:
s3_wal_path:
type: string
preparedDatabases: preparedDatabases:
type: object type: object
additionalProperties: additionalProperties:
@ -314,10 +438,11 @@ spec:
limits: limits:
type: object type: object
required: required:
- cpu - key
- memory - operator
- effect
properties: properties:
cpu: key:
type: string type: string
# Decimal natural followed by m, or decimal natural followed by # Decimal natural followed by m, or decimal natural followed by
# dot followed by up to three decimal digits. # dot followed by up to three decimal digits.
@ -334,21 +459,10 @@ spec:
# than the corresponding request. # than the corresponding request.
memory: memory:
type: string type: string
# You can express memory as a plain integer or as a fixed-point enum:
# integer using one of these suffixes: E, P, T, G, M, k. You can - Equal
# also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki - Exists
# value:
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
# Note: the value specified here must not be zero or be lower
# than the corresponding request.
requests:
type: object
required:
- cpu
- memory
properties:
cpu:
type: string type: string
# Decimal natural followed by m, or decimal natural followed by # Decimal natural followed by m, or decimal natural followed by
# dot followed by up to three decimal digits. # dot followed by up to three decimal digits.
@ -418,20 +532,15 @@ spec:
items: items:
type: object type: object
required: required:
- key - size
- operator
- effect
properties: properties:
key: size:
type: string type: string
operator: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
# Note: the value specified here must not be zero.
storageClass:
type: string type: string
enum: subPath:
- Equal
- Exists
value:
type: string
effect:
type: string type: string
enum: enum:
- NoExecute - NoExecute
@ -491,3 +600,7 @@ spec:
type: string type: string
subPath: subPath:
type: string type: string
status:
type: object
additionalProperties:
type: string

View File

@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: postgresteams.acid.zalan.do name: postgresteams.acid.zalan.do
@ -16,10 +16,13 @@ spec:
shortNames: shortNames:
- pgteam - pgteam
scope: Namespaced scope: Namespaced
versions:
- name: v1
served: true
storage: true
subresources: subresources:
status: {} status: {}
version: v1 schema:
validation:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
required: required:

View File

@ -24,12 +24,13 @@ package cmd
import ( import (
"fmt" "fmt"
"log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
postgresConstants "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1" postgresConstants "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextbeta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" apiextv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"log"
) )
// checkCmd represent kubectl pg check. // checkCmd represent kubectl pg check.
@ -47,9 +48,9 @@ kubectl pg check
} }
// check validates postgresql CRD registered or not. // check validates postgresql CRD registered or not.
func check() *v1beta1.CustomResourceDefinition { func check() *v1.CustomResourceDefinition {
config := getConfig() config := getConfig()
apiExtClient, err := apiextbeta1.NewForConfig(config) apiExtClient, err := apiextv1.NewForConfig(config)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: fake-teams-api name: fake-teams-api

View File

@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: operatorconfigurations.acid.zalan.do name: operatorconfigurations.acid.zalan.do
@ -11,6 +11,13 @@ spec:
singular: operatorconfiguration singular: operatorconfiguration
shortNames: shortNames:
- opconfig - opconfig
scope: Namespaced
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
additionalPrinterColumns: additionalPrinterColumns:
- name: Image - name: Image
type: string type: string
@ -31,11 +38,7 @@ spec:
- name: Age - name: Age
type: date type: date
JSONPath: .metadata.creationTimestamp JSONPath: .metadata.creationTimestamp
scope: Namespaced schema:
subresources:
status: {}
version: v1
validation:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
required: required:
@ -265,11 +268,6 @@ spec:
type: boolean type: boolean
enable_replica_load_balancer: enable_replica_load_balancer:
type: boolean type: boolean
external_traffic_policy:
type: string
enum:
- "Cluster"
- "Local"
master_dns_name_format: master_dns_name_format:
type: string type: string
replica_dns_name_format: replica_dns_name_format:
@ -320,6 +318,131 @@ spec:
type: boolean type: boolean
enable_database_access: enable_database_access:
type: boolean type: boolean
teams_api:
type: object
properties:
enable_admin_role_for_users:
type: boolean
enable_team_superuser:
type: boolean
enable_teams_api:
type: boolean
pam_configuration:
type: string
pam_role_name:
type: string
postgres_superuser_teams:
type: array
items:
type: string
pod_service_account_name:
type: string
pod_terminate_grace_period:
type: string
secret_name_template:
type: string
spilo_fsgroup:
type: integer
spilo_privileged:
type: boolean
toleration:
type: object
additionalProperties:
type: string
watched_namespace:
type: string
postgres_pod_resources:
type: object
properties:
default_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
default_cpu_request:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
default_memory_limit:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
default_memory_request:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
timeouts:
type: object
properties:
pod_label_wait_timeout:
type: string
pod_deletion_wait_timeout:
type: string
ready_wait_interval:
type: string
ready_wait_timeout:
type: string
resource_check_interval:
type: string
resource_check_timeout:
type: string
load_balancer:
type: object
properties:
custom_service_annotations:
type: object
additionalProperties:
type: string
db_hosted_zone:
type: string
enable_master_load_balancer:
type: boolean
enable_replica_load_balancer:
type: boolean
external_traffic_policy:
type: string
enum:
- "Cluster"
- "Local"
master_dns_name_format:
type: string
replica_dns_name_format:
type: string
aws_or_gcp:
type: object
properties:
additional_secret_mount:
type: string
additional_secret_mount_path:
type: string
aws_region:
type: string
kube_iam_role:
type: string
log_s3_bucket:
type: string
wal_s3_bucket:
type: string
logical_backup:
type: object
properties:
logical_backup_schedule:
type: string
pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
logical_backup_docker_image:
type: string
logical_backup_s3_bucket:
type: string
logical_backup_s3_endpoint:
type: string
logical_backup_s3_sse:
type: string
logical_backup_s3_access_key_id:
type: string
logical_backup_s3_secret_access_key:
type: string
debug:
type: object
properties:
debug_logging:
type: boolean
enable_database_access:
type: boolean
teams_api: teams_api:
type: object type: object
properties: properties:
@ -362,6 +485,38 @@ spec:
type: integer type: integer
ring_log_lines: ring_log_lines:
type: integer type: integer
scalyr:
type: object
properties:
scalyr_api_key:
type: string
scalyr_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
scalyr_cpu_request:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
scalyr_image:
type: string
scalyr_memory_limit:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
scalyr_memory_request:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
scalyr_server_url:
type: string
teams_api_url:
type: string
logging_rest_api:
type: object
properties:
api_port:
type: integer
cluster_history_entries:
type: integer
ring_log_lines:
type: integer
scalyr: # deprecated scalyr: # deprecated
type: object type: object
properties: properties:

View File

@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: postgresqls.acid.zalan.do name: postgresqls.acid.zalan.do
@ -11,6 +11,13 @@ spec:
singular: postgresql singular: postgresql
shortNames: shortNames:
- pg - pg
scope: Namespaced
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
additionalPrinterColumns: additionalPrinterColumns:
- name: Team - name: Team
type: string type: string
@ -43,17 +50,12 @@ spec:
type: string type: string
description: Current sync status of postgresql resource description: Current sync status of postgresql resource
JSONPath: .status.PostgresClusterStatus JSONPath: .status.PostgresClusterStatus
scope: Namespaced schema:
subresources:
status: {}
version: v1
validation:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
required: required:
- kind - kind
- apiVersion - apiVersion
- metadata
- spec - spec
properties: properties:
kind: kind:
@ -64,14 +66,6 @@ spec:
type: string type: string
enum: enum:
- acid.zalan.do/v1 - acid.zalan.do/v1
metadata:
type: object
required:
- name
properties:
name:
type: string
maxLength: 53
spec: spec:
type: object type: object
required: required:
@ -200,6 +194,50 @@ spec:
type: boolean type: boolean
enableShmVolume: enableShmVolume:
type: boolean type: boolean
init_containers: # deprecated
type: array
nullable: true
items:
type: object
required:
- cluster
properties:
cluster:
type: string
s3_endpoint:
type: string
s3_access_key_id:
type: string
s3_secret_access_key:
type: string
s3_force_path_style:
type: string
s3_wal_path:
type: string
timestamp:
type: string
pattern: '^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([+-]([01][0-9]|2[0-3]):[0-5][0-9]))$'
# The regexp matches the date-time format (RFC 3339 Section 5.6) that specifies a timezone as an offset relative to UTC
# Example: 1996-12-19T16:39:57-08:00
# Note: this field requires a timezone
uid:
format: uuid
type: string
databases:
type: object
additionalProperties:
type: string
# Note: usernames specified here as database owners must be declared in the users key of the spec key.
dockerImage:
type: string
enableLogicalBackup:
type: boolean
enableMasterLoadBalancer:
type: boolean
enableReplicaLoadBalancer:
type: boolean
enableShmVolume:
type: boolean
init_containers: # deprecated init_containers: # deprecated
type: array type: array
nullable: true nullable: true
@ -230,16 +268,6 @@ spec:
type: object type: object
additionalProperties: additionalProperties:
type: string type: string
pg_hba:
type: array
items:
type: string
slots:
type: object
additionalProperties:
type: object
additionalProperties:
type: string
ttl: ttl:
type: integer type: integer
loop_wait: loop_wait:
@ -260,6 +288,17 @@ spec:
type: string type: string
podPriorityClassName: podPriorityClassName:
type: string type: string
postgresql:
type: object
required:
- version
properties:
version:
type: string
pod_priority_class_name: # deprecated
type: string
podPriorityClassName:
type: string
postgresql: postgresql:
type: object type: object
required: required:
@ -279,6 +318,91 @@ spec:
type: object type: object
additionalProperties: additionalProperties:
type: string type: string
replicaLoadBalancer: # deprecated
type: boolean
resources:
type: object
required:
- requests
- limits
properties:
limits:
type: object
required:
- cpu
- memory
properties:
cpu:
type: string
# Decimal natural followed by m, or decimal natural followed by
# dot followed by up to three decimal digits.
#
# This is because the Kubernetes CPU resource has millis as the
# maximum precision. The actual values are checked in code
# because the regular expression would be huge and horrible and
# not very helpful in validation error messages; this one checks
# only the format of the given number.
#
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu
pattern: '^(\d+m|\d+\.\d{1,3})$'
# Note: the value specified here must not be zero or be lower
# than the corresponding request.
memory:
type: string
# You can express memory as a plain integer or as a fixed-point
# integer using one of these suffixes: E, P, T, G, M, k. You can
# also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki
#
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
# Note: the value specified here must not be zero or be lower
# than the corresponding request.
requests:
type: object
required:
- cpu
- memory
properties:
cpu:
type: string
# Decimal natural followed by m, or decimal natural followed by
# dot followed by up to three decimal digits.
#
# This is because the Kubernetes CPU resource has millis as the
# maximum precision. The actual values are checked in code
# because the regular expression would be huge and horrible and
# not very helpful in validation error messages; this one checks
# only the format of the given number.
#
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu
pattern: '^(\d+m|\d+\.\d{1,3})$'
# Note: the value specified here must not be zero or be higher
# than the corresponding limit.
memory:
type: string
# You can express memory as a plain integer or as a fixed-point
# integer using one of these suffixes: E, P, T, G, M, k. You can
# also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki
#
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
# Note: the value specified here must not be zero or be higher
# than the corresponding limit.
sidecars:
type: array
nullable: true
items:
type: object
additionalProperties: true
spiloFSGroup:
type: integer
standby:
type: object
required:
- s3_wal_path
properties:
s3_wal_path:
type: string
preparedDatabases: preparedDatabases:
type: object type: object
additionalProperties: additionalProperties:
@ -310,10 +434,11 @@ spec:
limits: limits:
type: object type: object
required: required:
- cpu - key
- memory - operator
- effect
properties: properties:
cpu: key:
type: string type: string
# Decimal natural followed by m, or decimal natural followed by # Decimal natural followed by m, or decimal natural followed by
# dot followed by up to three decimal digits. # dot followed by up to three decimal digits.
@ -330,21 +455,10 @@ spec:
# than the corresponding request. # than the corresponding request.
memory: memory:
type: string type: string
# You can express memory as a plain integer or as a fixed-point enum:
# integer using one of these suffixes: E, P, T, G, M, k. You can - Equal
# also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki - Exists
# value:
# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
# Note: the value specified here must not be zero or be lower
# than the corresponding request.
requests:
type: object
required:
- cpu
- memory
properties:
cpu:
type: string type: string
# Decimal natural followed by m, or decimal natural followed by # Decimal natural followed by m, or decimal natural followed by
# dot followed by up to three decimal digits. # dot followed by up to three decimal digits.
@ -414,20 +528,15 @@ spec:
items: items:
type: object type: object
required: required:
- key - size
- operator
- effect
properties: properties:
key: size:
type: string type: string
operator: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
# Note: the value specified here must not be zero.
storageClass:
type: string type: string
enum: subPath:
- Equal
- Exists
value:
type: string
effect:
type: string type: string
enum: enum:
- NoExecute - NoExecute

View File

@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: postgresteams.acid.zalan.do name: postgresteams.acid.zalan.do
@ -12,10 +12,13 @@ spec:
shortNames: shortNames:
- pgteam - pgteam
scope: Namespaced scope: Namespaced
versions:
- name: v1
served: true
storage: true
subresources: subresources:
status: {} status: {}
version: v1 schema:
validation:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
required: required:

View File

@ -2,7 +2,7 @@ package v1
import ( import (
acidzalando "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" apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -20,7 +20,7 @@ const (
) )
// PostgresCRDResourceColumns definition of AdditionalPrinterColumns for postgresql CRD // PostgresCRDResourceColumns definition of AdditionalPrinterColumns for postgresql CRD
var PostgresCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{ var PostgresCRDResourceColumns = []apiextv1.CustomResourceColumnDefinition{
{ {
Name: "Team", Name: "Team",
Type: "string", Type: "string",
@ -71,7 +71,7 @@ var PostgresCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{
} }
// OperatorConfigCRDResourceColumns definition of AdditionalPrinterColumns for OperatorConfiguration CRD // OperatorConfigCRDResourceColumns definition of AdditionalPrinterColumns for OperatorConfiguration CRD
var OperatorConfigCRDResourceColumns = []apiextv1beta1.CustomResourceColumnDefinition{ var OperatorConfigCRDResourceColumns = []apiextv1.CustomResourceColumnDefinition{
{ {
Name: "Image", Name: "Image",
Type: "string", Type: "string",
@ -107,17 +107,16 @@ var min0 = 0.0
var min1 = 1.0 var min1 = 1.0
var min2 = 2.0 var min2 = 2.0
var minDisable = -1.0 var minDisable = -1.0
var maxLength = int64(53)
// PostgresCRDResourceValidation to check applied manifest parameters // PostgresCRDResourceValidation to check applied manifest parameters
var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{ OpenAPIV3Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
Required: []string{"kind", "apiVersion", "metadata", "spec"}, Required: []string{"kind", "apiVersion", "spec"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"kind": { "kind": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"postgresql"`), Raw: []byte(`"postgresql"`),
}, },
@ -125,31 +124,21 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"apiVersion": { "apiVersion": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"acid.zalan.do/v1"`), Raw: []byte(`"acid.zalan.do/v1"`),
}, },
}, },
}, },
"metadata": {
Type: "object",
Required: []string{"name"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{
"name": {
Type: "string",
MaxLength: &maxLength,
},
},
},
"spec": { "spec": {
Type: "object", Type: "object",
Required: []string{"numberOfInstances", "teamId", "postgresql", "volume"}, Required: []string{"numberOfInstances", "teamId", "postgresql", "volume"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"allowedSourceRanges": { "allowedSourceRanges": {
Type: "array", Type: "array",
Nullable: true, Nullable: true,
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
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])$",
}, },
@ -158,7 +147,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"clone": { "clone": {
Type: "object", Type: "object",
Required: []string{"cluster"}, Required: []string{"cluster"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"cluster": { "cluster": {
Type: "string", Type: "string",
}, },
@ -190,7 +179,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"connectionPooler": { "connectionPooler": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"dockerImage": { "dockerImage": {
Type: "string", Type: "string",
}, },
@ -199,7 +188,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"mode": { "mode": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"session"`), Raw: []byte(`"session"`),
}, },
@ -215,11 +204,11 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"resources": { "resources": {
Type: "object", Type: "object",
Required: []string{"requests", "limits"}, Required: []string{"requests", "limits"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"limits": { "limits": {
Type: "object", Type: "object",
Required: []string{"cpu", "memory"}, Required: []string{"cpu", "memory"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"cpu": { "cpu": {
Type: "string", Type: "string",
Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0", Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0",
@ -235,7 +224,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"requests": { "requests": {
Type: "object", Type: "object",
Required: []string{"cpu", "memory"}, Required: []string{"cpu", "memory"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"cpu": { "cpu": {
Type: "string", Type: "string",
Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0", Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0",
@ -260,8 +249,8 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"databases": { "databases": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
Description: "User names specified here as database owners must be declared in the users key of the spec key", Description: "User names specified here as database owners must be declared in the users key of the spec key",
}, },
@ -288,10 +277,10 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"init_containers": { "init_containers": {
Type: "array", Type: "array",
Description: "Deprecated", Description: "Deprecated",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Allows: true, Allows: true,
}, },
}, },
@ -299,10 +288,10 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"initContainers": { "initContainers": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Allows: true, Allows: true,
}, },
}, },
@ -314,8 +303,8 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"maintenanceWindows": { "maintenanceWindows": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
Pattern: "^\\ *((Mon|Tue|Wed|Thu|Fri|Sat|Sun):(2[0-3]|[01]?\\d):([0-5]?\\d)|(2[0-3]|[01]?\\d):([0-5]?\\d))-((Mon|Tue|Wed|Thu|Fri|Sat|Sun):(2[0-3]|[01]?\\d):([0-5]?\\d)|(2[0-3]|[01]?\\d):([0-5]?\\d))\\ *$", Pattern: "^\\ *((Mon|Tue|Wed|Thu|Fri|Sat|Sun):(2[0-3]|[01]?\\d):([0-5]?\\d)|(2[0-3]|[01]?\\d):([0-5]?\\d))-((Mon|Tue|Wed|Thu|Fri|Sat|Sun):(2[0-3]|[01]?\\d):([0-5]?\\d)|(2[0-3]|[01]?\\d):([0-5]?\\d))\\ *$",
}, },
@ -327,30 +316,30 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"patroni": { "patroni": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"initdb": { "initdb": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
}, },
"pg_hba": { "pg_hba": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
}, },
"slots": { "slots": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -379,8 +368,8 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"podAnnotations": { "podAnnotations": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -395,10 +384,10 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"postgresql": { "postgresql": {
Type: "object", Type: "object",
Required: []string{"version"}, Required: []string{"version"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"version": { "version": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"9.3"`), Raw: []byte(`"9.3"`),
}, },
@ -424,8 +413,8 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"parameters": { "parameters": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -434,27 +423,27 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"preparedDatabases": { "preparedDatabases": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"defaultUsers": { "defaultUsers": {
Type: "boolean", Type: "boolean",
}, },
"extensions": { "extensions": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
}, },
"schemas": { "schemas": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"defaultUsers": { "defaultUsers": {
Type: "boolean", Type: "boolean",
}, },
@ -476,11 +465,11 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"resources": { "resources": {
Type: "object", Type: "object",
Required: []string{"requests", "limits"}, Required: []string{"requests", "limits"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"limits": { "limits": {
Type: "object", Type: "object",
Required: []string{"cpu", "memory"}, Required: []string{"cpu", "memory"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"cpu": { "cpu": {
Type: "string", Type: "string",
Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0", Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0",
@ -496,7 +485,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"requests": { "requests": {
Type: "object", Type: "object",
Required: []string{"cpu", "memory"}, Required: []string{"cpu", "memory"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"cpu": { "cpu": {
Type: "string", Type: "string",
Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0", Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0",
@ -513,18 +502,18 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"serviceAnnotations": { "serviceAnnotations": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
}, },
"sidecars": { "sidecars": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Allows: true, Allows: true,
}, },
}, },
@ -542,7 +531,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"standby": { "standby": {
Type: "object", Type: "object",
Required: []string{"s3_wal_path"}, Required: []string{"s3_wal_path"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"s3_wal_path": { "s3_wal_path": {
Type: "string", Type: "string",
}, },
@ -554,7 +543,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"tls": { "tls": {
Type: "object", Type: "object",
Required: []string{"secretName"}, Required: []string{"secretName"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"secretName": { "secretName": {
Type: "string", Type: "string",
}, },
@ -574,17 +563,17 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"tolerations": { "tolerations": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
Required: []string{"key", "operator", "effect"}, Required: []string{"key", "operator", "effect"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"key": { "key": {
Type: "string", Type: "string",
}, },
"operator": { "operator": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"Equal"`), Raw: []byte(`"Equal"`),
}, },
@ -598,7 +587,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"effect": { "effect": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"NoExecute"`), Raw: []byte(`"NoExecute"`),
}, },
@ -623,15 +612,15 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"users": { "users": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "array", Type: "array",
Description: "Role flags specified here must not contradict each other", Description: "Role flags specified here must not contradict each other",
Nullable: true, Nullable: true,
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"bypassrls"`), Raw: []byte(`"bypassrls"`),
}, },
@ -725,7 +714,7 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
"volume": { "volume": {
Type: "object", Type: "object",
Required: []string{"size"}, Required: []string{"size"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"size": { "size": {
Type: "string", Type: "string",
Description: "Value must not be zero", Description: "Value must not be zero",
@ -741,11 +730,11 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"additionalVolumes": { "additionalVolumes": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
Required: []string{"name", "mountPath", "volumeSource"}, Required: []string{"name", "mountPath", "volumeSource"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"name": { "name": {
Type: "string", Type: "string",
}, },
@ -754,8 +743,8 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"targetContainers": { "targetContainers": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -774,8 +763,8 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
}, },
"status": { "status": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -785,14 +774,14 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
} }
// OperatorConfigCRDResourceValidation to check applied manifest parameters // OperatorConfigCRDResourceValidation to check applied manifest parameters
var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation{ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{ OpenAPIV3Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
Required: []string{"kind", "apiVersion", "configuration"}, Required: []string{"kind", "apiVersion", "configuration"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"kind": { "kind": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"OperatorConfiguration"`), Raw: []byte(`"OperatorConfiguration"`),
}, },
@ -800,7 +789,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"apiVersion": { "apiVersion": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"acid.zalan.do/v1"`), Raw: []byte(`"acid.zalan.do/v1"`),
}, },
@ -808,7 +797,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"configuration": { "configuration": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"docker_image": { "docker_image": {
Type: "string", Type: "string",
}, },
@ -848,18 +837,18 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"sidecar_docker_images": { "sidecar_docker_images": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
}, },
"sidecars": { "sidecars": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Allows: true, Allows: true,
}, },
}, },
@ -871,7 +860,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"users": { "users": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"replication_username": { "replication_username": {
Type: "string", Type: "string",
}, },
@ -882,14 +871,14 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"kubernetes": { "kubernetes": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"cluster_domain": { "cluster_domain": {
Type: "string", Type: "string",
}, },
"cluster_labels": { "cluster_labels": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -899,8 +888,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"custom_pod_annotations": { "custom_pod_annotations": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -913,8 +902,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"downscaler_annotations": { "downscaler_annotations": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -936,11 +925,11 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"infrastructure_roles_secrets": { "infrastructure_roles_secrets": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "object", Type: "object",
Required: []string{"secretname", "userkey", "passwordkey"}, Required: []string{"secretname", "userkey", "passwordkey"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"secretname": { "secretname": {
Type: "string", Type: "string",
}, },
@ -971,8 +960,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"inherited_labels": { "inherited_labels": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -982,8 +971,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"node_readiness_label": { "node_readiness_label": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -1005,7 +994,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"pod_management_policy": { "pod_management_policy": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"ordered_ready"`), Raw: []byte(`"ordered_ready"`),
}, },
@ -1049,7 +1038,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"storage_resize_mode": { "storage_resize_mode": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"ebs"`), Raw: []byte(`"ebs"`),
}, },
@ -1063,8 +1052,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"toleration": { "toleration": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -1076,7 +1065,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"postgres_pod_resources": { "postgres_pod_resources": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"default_cpu_limit": { "default_cpu_limit": {
Type: "string", Type: "string",
Pattern: "^(\\d+m|\\d+(\\.\\d{1,3})?)$", Pattern: "^(\\d+m|\\d+(\\.\\d{1,3})?)$",
@ -1105,7 +1094,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"timeouts": { "timeouts": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"pod_label_wait_timeout": { "pod_label_wait_timeout": {
Type: "string", Type: "string",
}, },
@ -1128,11 +1117,11 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"load_balancer": { "load_balancer": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"custom_service_annotations": { "custom_service_annotations": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -1148,7 +1137,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"external_traffic_policy": { "external_traffic_policy": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"Cluster"`), Raw: []byte(`"Cluster"`),
}, },
@ -1167,7 +1156,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"aws_or_gcp": { "aws_or_gcp": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"additional_secret_mount": { "additional_secret_mount": {
Type: "string", Type: "string",
}, },
@ -1190,7 +1179,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"logical_backup": { "logical_backup": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"logical_backup_docker_image": { "logical_backup_docker_image": {
Type: "string", Type: "string",
}, },
@ -1220,7 +1209,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"debug": { "debug": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"debug_logging": { "debug_logging": {
Type: "boolean", Type: "boolean",
}, },
@ -1231,7 +1220,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"teams_api": { "teams_api": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"enable_admin_role_for_users": { "enable_admin_role_for_users": {
Type: "boolean", Type: "boolean",
}, },
@ -1255,16 +1244,16 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"postgres_superuser_teams": { "postgres_superuser_teams": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
}, },
"protected_role_names": { "protected_role_names": {
Type: "array", Type: "array",
Items: &apiextv1beta1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -1274,8 +1263,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"team_api_role_configuration": { "team_api_role_configuration": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -1287,7 +1276,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"logging_rest_api": { "logging_rest_api": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"api_port": { "api_port": {
Type: "integer", Type: "integer",
}, },
@ -1301,7 +1290,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"scalyr": { "scalyr": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"scalyr_api_key": { "scalyr_api_key": {
Type: "string", Type: "string",
}, },
@ -1331,7 +1320,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"connection_pooler": { "connection_pooler": {
Type: "object", Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1.JSONSchemaProps{
"connection_pooler_default_cpu_limit": { "connection_pooler_default_cpu_limit": {
Type: "string", Type: "string",
Pattern: "^(\\d+m|\\d+(\\.\\d{1,3})?)$", Pattern: "^(\\d+m|\\d+(\\.\\d{1,3})?)$",
@ -1356,7 +1345,7 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"connection_pooler_mode": { "connection_pooler_mode": {
Type: "string", Type: "string",
Enum: []apiextv1beta1.JSON{ Enum: []apiextv1.JSON{
{ {
Raw: []byte(`"session"`), Raw: []byte(`"session"`),
}, },
@ -1381,8 +1370,8 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
"status": { "status": {
Type: "object", Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{ AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{
Schema: &apiextv1beta1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{
Type: "string", Type: "string",
}, },
}, },
@ -1391,32 +1380,38 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
}, },
} }
func buildCRD(name, kind, plural, short string, columns []apiextv1beta1.CustomResourceColumnDefinition, validation apiextv1beta1.CustomResourceValidation) *apiextv1beta1.CustomResourceDefinition { func buildCRD(name, kind, plural, short string, columns []apiextv1.CustomResourceColumnDefinition, validation apiextv1.CustomResourceValidation) *apiextv1.CustomResourceDefinition {
return &apiextv1beta1.CustomResourceDefinition{ return &apiextv1.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
}, },
Spec: apiextv1beta1.CustomResourceDefinitionSpec{ Spec: apiextv1.CustomResourceDefinitionSpec{
Group: SchemeGroupVersion.Group, Group: SchemeGroupVersion.Group,
Version: SchemeGroupVersion.Version, Names: apiextv1.CustomResourceDefinitionNames{
Names: apiextv1beta1.CustomResourceDefinitionNames{
Plural: plural, Plural: plural,
ShortNames: []string{short}, ShortNames: []string{short},
Kind: kind, Kind: kind,
}, },
Scope: apiextv1beta1.NamespaceScoped, Scope: apiextv1.NamespaceScoped,
Subresources: &apiextv1beta1.CustomResourceSubresources{ Versions: []apiextv1.CustomResourceDefinitionVersion{
Status: &apiextv1beta1.CustomResourceSubresourceStatus{}, apiextv1.CustomResourceDefinitionVersion{
Name: SchemeGroupVersion.Version,
Served: true,
Storage: true,
Subresources: &apiextv1.CustomResourceSubresources{
Status: &apiextv1.CustomResourceSubresourceStatus{},
}, },
AdditionalPrinterColumns: columns, AdditionalPrinterColumns: columns,
Validation: &validation, Schema: &validation,
},
},
}, },
} }
} }
// PostgresCRD returns CustomResourceDefinition built from PostgresCRDResource // PostgresCRD returns CustomResourceDefinition built from PostgresCRDResource
func PostgresCRD(enableValidation *bool) *apiextv1beta1.CustomResourceDefinition { func PostgresCRD(enableValidation *bool) *apiextv1.CustomResourceDefinition {
postgresCRDvalidation := apiextv1beta1.CustomResourceValidation{} postgresCRDvalidation := apiextv1.CustomResourceValidation{}
if enableValidation != nil && *enableValidation { if enableValidation != nil && *enableValidation {
postgresCRDvalidation = PostgresCRDResourceValidation postgresCRDvalidation = PostgresCRDResourceValidation
@ -1431,8 +1426,8 @@ func PostgresCRD(enableValidation *bool) *apiextv1beta1.CustomResourceDefinition
} }
// ConfigurationCRD returns CustomResourceDefinition built from OperatorConfigCRDResource // ConfigurationCRD returns CustomResourceDefinition built from OperatorConfigCRDResource
func ConfigurationCRD(enableValidation *bool) *apiextv1beta1.CustomResourceDefinition { func ConfigurationCRD(enableValidation *bool) *apiextv1.CustomResourceDefinition {
opconfigCRDvalidation := apiextv1beta1.CustomResourceValidation{} opconfigCRDvalidation := apiextv1.CustomResourceValidation{}
if enableValidation != nil && *enableValidation { if enableValidation != nil && *enableValidation {
opconfigCRDvalidation = OperatorConfigCRDResourceValidation opconfigCRDvalidation = OperatorConfigCRDResourceValidation

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -54,7 +54,7 @@ func (c *Controller) clusterWorkerID(clusterName spec.NamespacedName) uint32 {
return c.clusterWorkers[clusterName] return c.clusterWorkers[clusterName]
} }
func (c *Controller) createOperatorCRD(crd *apiextv1beta1.CustomResourceDefinition) error { func (c *Controller) createOperatorCRD(crd *apiextv1.CustomResourceDefinition) error {
if _, err := c.KubeClient.CustomResourceDefinitions().Create(context.TODO(), crd, metav1.CreateOptions{}); err != nil { if _, err := c.KubeClient.CustomResourceDefinitions().Create(context.TODO(), crd, metav1.CreateOptions{}); err != nil {
if k8sutil.ResourceAlreadyExists(err) { if k8sutil.ResourceAlreadyExists(err) {
c.logger.Infof("customResourceDefinition %q is already registered and will only be updated", crd.Name) c.logger.Infof("customResourceDefinition %q is already registered and will only be updated", crd.Name)
@ -82,12 +82,12 @@ func (c *Controller) createOperatorCRD(crd *apiextv1beta1.CustomResourceDefiniti
for _, cond := range c.Status.Conditions { for _, cond := range c.Status.Conditions {
switch cond.Type { switch cond.Type {
case apiextv1beta1.Established: case apiextv1.Established:
if cond.Status == apiextv1beta1.ConditionTrue { if cond.Status == apiextv1.ConditionTrue {
return true, err return true, err
} }
case apiextv1beta1.NamesAccepted: case apiextv1.NamesAccepted:
if cond.Status == apiextv1beta1.ConditionFalse { if cond.Status == apiextv1.ConditionFalse {
return false, fmt.Errorf("name conflict: %v", cond.Reason) return false, fmt.Errorf("name conflict: %v", cond.Reason)
} }
} }

View File

@ -17,7 +17,7 @@ import (
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
policybeta1 "k8s.io/api/policy/v1beta1" policybeta1 "k8s.io/api/policy/v1beta1"
apiextclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" apiextclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
apiextbeta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" apiextv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
@ -53,7 +53,7 @@ type KubernetesClient struct {
appsv1.DeploymentsGetter appsv1.DeploymentsGetter
rbacv1.RoleBindingsGetter rbacv1.RoleBindingsGetter
policyv1beta1.PodDisruptionBudgetsGetter policyv1beta1.PodDisruptionBudgetsGetter
apiextbeta1.CustomResourceDefinitionsGetter apiextv1.CustomResourceDefinitionsGetter
clientbatchv1beta1.CronJobsGetter clientbatchv1beta1.CronJobsGetter
RESTClient rest.Interface RESTClient rest.Interface
@ -153,7 +153,7 @@ func NewFromConfig(cfg *rest.Config) (KubernetesClient, error) {
return kubeClient, fmt.Errorf("could not create api client:%v", err) return kubeClient, fmt.Errorf("could not create api client:%v", err)
} }
kubeClient.CustomResourceDefinitionsGetter = apiextClient.ApiextensionsV1beta1() kubeClient.CustomResourceDefinitionsGetter = apiextClient.ApiextensionsV1()
kubeClient.AcidV1ClientSet = acidv1client.NewForConfigOrDie(cfg) kubeClient.AcidV1ClientSet = acidv1client.NewForConfigOrDie(cfg)
return kubeClient, nil return kubeClient, nil