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,410 +15,575 @@ spec:
singular: operatorconfiguration singular: operatorconfiguration
shortNames: shortNames:
- opconfig - opconfig
additionalPrinterColumns:
- name: Image
type: string
description: Spilo image to be used for Pods
JSONPath: .configuration.docker_image
- name: Cluster-Label
type: string
description: Label for K8s resources created by operator
JSONPath: .configuration.kubernetes.cluster_name_label
- name: Service-Account
type: string
description: Name of service account to be used
JSONPath: .configuration.kubernetes.pod_service_account_name
- name: Min-Instances
type: integer
description: Minimum number of instances per Postgres cluster
JSONPath: .configuration.min_instances
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
scope: Namespaced scope: Namespaced
subresources: versions:
status: {} - name: v1
version: v1 served: true
validation: storage: true
openAPIV3Schema: subresources:
type: object status: {}
required: additionalPrinterColumns:
- kind - name: Image
- apiVersion type: string
- configuration description: Spilo image to be used for Pods
properties: JSONPath: .configuration.docker_image
kind: - name: Cluster-Label
type: string type: string
enum: description: Label for K8s resources created by operator
- OperatorConfiguration JSONPath: .configuration.kubernetes.cluster_name_label
apiVersion: - name: Service-Account
type: string type: string
enum: description: Name of service account to be used
- acid.zalan.do/v1 JSONPath: .configuration.kubernetes.pod_service_account_name
configuration: - name: Min-Instances
type: object type: integer
description: Minimum number of instances per Postgres cluster
JSONPath: .configuration.min_instances
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
required:
- kind
- apiVersion
- configuration
properties: properties:
docker_image: kind:
type: string type: string
enable_crd_validation: enum:
type: boolean - OperatorConfiguration
enable_lazy_spilo_upgrade: apiVersion:
type: boolean
enable_shm_volume:
type: boolean
etcd_host:
type: string type: string
kubernetes_use_configmaps: enum:
type: boolean - acid.zalan.do/v1
max_instances: configuration:
type: integer type: object
minimum: -1 # -1 = disabled properties:
min_instances: docker_image:
type: integer
minimum: -1 # -1 = disabled
resync_period:
type: string
repair_period:
type: string
set_memory_request_to_limit:
type: boolean
sidecar_docker_images:
type: object
additionalProperties:
type: string type: string
sidecars: enable_crd_validation:
type: array type: boolean
nullable: true enable_lazy_spilo_upgrade:
items: type: boolean
enable_shm_volume:
type: boolean
etcd_host:
type: string
kubernetes_use_configmaps:
type: boolean
max_instances:
type: integer
minimum: -1 # -1 = disabled
min_instances:
type: integer
minimum: -1 # -1 = disabled
resync_period:
type: string
repair_period:
type: string
set_memory_request_to_limit:
type: boolean
sidecar_docker_images:
type: object type: object
additionalProperties: true additionalProperties:
workers:
type: integer
minimum: 1
users:
type: object
properties:
replication_username:
type: string
super_username:
type: string
kubernetes:
type: object
properties:
cluster_domain:
type: string type: string
cluster_labels: sidecars:
type: array
nullable: true
items:
type: object type: object
additionalProperties: additionalProperties: true
workers:
type: integer
minimum: 1
users:
type: object
properties:
replication_username:
type: string
super_username:
type: string
kubernetes:
type: object
properties:
cluster_domain:
type: string type: string
cluster_name_label: cluster_labels:
type: string
custom_pod_annotations:
type: object
additionalProperties:
type: string
delete_annotation_date_key:
type: string
delete_annotation_name_key:
type: string
downscaler_annotations:
type: array
items:
type: string
enable_init_containers:
type: boolean
enable_pod_antiaffinity:
type: boolean
enable_pod_disruption_budget:
type: boolean
enable_sidecars:
type: boolean
infrastructure_roles_secret_name:
type: string
infrastructure_roles_secrets:
type: array
nullable: true
items:
type: object type: object
required: additionalProperties:
- secretname type: string
- userkey cluster_name_label:
- passwordkey
properties:
secretname:
type: string
userkey:
type: string
passwordkey:
type: string
rolekey:
type: string
defaultuservalue:
type: string
defaultrolevalue:
type: string
details:
type: string
template:
type: boolean
inherited_labels:
type: array
items:
type: string type: string
master_pod_move_timeout: custom_pod_annotations:
type: string type: object
node_readiness_label: additionalProperties:
type: string
delete_annotation_date_key:
type: string
delete_annotation_name_key:
type: string
downscaler_annotations:
type: array
items:
type: string
enable_init_containers:
type: boolean
enable_pod_antiaffinity:
type: boolean
enable_pod_disruption_budget:
type: boolean
enable_sidecars:
type: boolean
infrastructure_roles_secret_name:
type: string
infrastructure_roles_secrets:
type: array
nullable: true
items:
type: object
required:
- secretname
- userkey
- passwordkey
properties:
secretname:
type: string
userkey:
type: string
passwordkey:
type: string
rolekey:
type: string
defaultuservalue:
type: string
defaultrolevalue:
type: string
details:
type: string
template:
type: boolean
inherited_labels:
type: array
items:
type: string
master_pod_move_timeout:
type: string
node_readiness_label:
type: object
additionalProperties:
type: string
oauth_token_secret_name:
type: string
pdb_name_format:
type: string
pod_antiaffinity_topology_key:
type: string
pod_environment_configmap:
type: string
pod_environment_secret:
type: string
pod_management_policy:
type: string
enum:
- "ordered_ready"
- "parallel"
pod_priority_class_name:
type: string
pod_role_label:
type: string
pod_service_account_definition:
type: string
pod_service_account_name:
type: string
pod_service_account_role_binding_definition:
type: string
pod_terminate_grace_period:
type: string
secret_name_template:
type: string
spilo_runasuser:
type: integer
spilo_runasgroup:
type: integer
spilo_fsgroup:
type: integer
spilo_privileged:
type: boolean
storage_resize_mode:
type: string
enum:
- "ebs"
- "pvc"
- "off"
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?)$'
min_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
min_memory_limit:
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
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 type: object
additionalProperties: properties:
type: string default_cpu_limit:
oauth_token_secret_name: type: string
type: string pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
pdb_name_format: default_cpu_request:
type: string type: string
pod_antiaffinity_topology_key: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string default_memory_limit:
pod_environment_configmap: type: string
type: string pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
pod_environment_secret: default_memory_request:
type: string type: string
pod_management_policy: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string timeouts:
enum:
- "ordered_ready"
- "parallel"
pod_priority_class_name:
type: string
pod_role_label:
type: string
pod_service_account_definition:
type: string
pod_service_account_name:
type: string
pod_service_account_role_binding_definition:
type: string
pod_terminate_grace_period:
type: string
secret_name_template:
type: string
spilo_runasuser:
type: integer
spilo_runasgroup:
type: integer
spilo_fsgroup:
type: integer
spilo_privileged:
type: boolean
toleration:
type: object type: object
additionalProperties: properties:
type: string pod_label_wait_timeout:
watched_namespace: type: string
type: string pod_deletion_wait_timeout:
postgres_pod_resources: type: string
type: object ready_wait_interval:
properties: type: string
default_cpu_limit: ready_wait_timeout:
type: string type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' resource_check_interval:
default_cpu_request: type: string
type: string resource_check_timeout:
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' type: string
default_memory_limit: load_balancer:
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?)$'
min_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
min_memory_limit:
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 type: object
additionalProperties: properties:
type: string custom_service_annotations:
db_hosted_zone: type: object
type: string additionalProperties:
enable_master_load_balancer: type: string
type: boolean db_hosted_zone:
enable_replica_load_balancer: type: string
type: boolean enable_master_load_balancer:
external_traffic_policy: type: boolean
type: string enable_replica_load_balancer:
enum: type: boolean
- "Cluster" external_traffic_policy:
- "Local" type: string
master_dns_name_format: enum:
type: string - "Cluster"
replica_dns_name_format: - "Local"
type: string master_dns_name_format:
aws_or_gcp: type: string
type: object replica_dns_name_format:
properties: type: string
additional_secret_mount: aws_or_gcp:
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_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_postgres_team_crd:
type: boolean
enable_postgres_team_crd_superusers:
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
protected_role_names:
type: array
items:
type: string
team_admin_role:
type: string
team_api_role_configuration:
type: object type: object
additionalProperties: 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:
type: object
properties:
enable_admin_role_for_users:
type: boolean
enable_postgres_team_crd:
type: boolean
enable_postgres_team_crd_superusers:
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
protected_role_names:
type: array
items:
type: string
team_admin_role:
type: string
team_api_role_configuration:
type: object
additionalProperties:
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:
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 type: string
teams_api_url: logging_rest_api:
type: string type: object
logging_rest_api: properties:
type: object api_port:
properties: type: integer
api_port: cluster_history_entries:
type: integer type: integer
cluster_history_entries: ring_log_lines:
type: integer type: integer
ring_log_lines: scalyr: # deprecated
type: integer type: object
scalyr: # deprecated properties:
type: object scalyr_api_key:
properties: type: string
scalyr_api_key: scalyr_cpu_limit:
type: string type: string
scalyr_cpu_limit: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string scalyr_cpu_request:
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' type: string
scalyr_cpu_request: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string scalyr_image:
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' type: string
scalyr_image: scalyr_memory_limit:
type: string type: string
scalyr_memory_limit: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string scalyr_memory_request:
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$' type: string
scalyr_memory_request: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string scalyr_server_url:
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$' type: string
scalyr_server_url: connection_pooler:
type: string type: object
connection_pooler: properties:
type: object connection_pooler_schema:
properties: type: string
connection_pooler_schema: #default: "pooler"
type: string connection_pooler_user:
#default: "pooler" type: string
connection_pooler_user: #default: "pooler"
type: string connection_pooler_image:
#default: "pooler" type: string
connection_pooler_image: #default: "registry.opensource.zalan.do/acid/pgbouncer"
type: string connection_pooler_max_db_connections:
#default: "registry.opensource.zalan.do/acid/pgbouncer" type: integer
connection_pooler_max_db_connections: #default: 60
type: integer connection_pooler_mode:
#default: 60 type: string
connection_pooler_mode: enum:
type: string - "session"
enum: - "transaction"
- "session" #default: "transaction"
- "transaction" connection_pooler_number_of_instances:
#default: "transaction" type: integer
connection_pooler_number_of_instances: minimum: 2
type: integer #default: 2
minimum: 2 connection_pooler_default_cpu_limit:
#default: 2 type: string
connection_pooler_default_cpu_limit: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string #default: "1"
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' connection_pooler_default_cpu_request:
#default: "1" type: string
connection_pooler_default_cpu_request: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string #default: "500m"
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' connection_pooler_default_memory_limit:
#default: "500m" type: string
connection_pooler_default_memory_limit: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string #default: "100Mi"
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$' connection_pooler_default_memory_request:
#default: "100Mi" type: string
connection_pooler_default_memory_request: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string #default: "100Mi"
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$' status:
#default: "100Mi" type: object
status: additionalProperties:
type: object type: string
additionalProperties:
type: string

File diff suppressed because it is too large Load Diff

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,52 +16,55 @@ spec:
shortNames: shortNames:
- pgteam - pgteam
scope: Namespaced scope: Namespaced
subresources: versions:
status: {} - name: v1
version: v1 served: true
validation: storage: true
openAPIV3Schema: subresources:
type: object status: {}
required: schema:
- kind openAPIV3Schema:
- apiVersion type: object
- spec required:
properties: - kind
kind: - apiVersion
type: string - spec
enum: properties:
- PostgresTeam kind:
apiVersion: type: string
type: string enum:
enum: - PostgresTeam
- acid.zalan.do/v1 apiVersion:
spec: type: string
type: object enum:
properties: - acid.zalan.do/v1
additionalSuperuserTeams: spec:
type: object type: object
description: "Map for teamId and associated additional superuser teams" properties:
additionalProperties: additionalSuperuserTeams:
type: array type: object
nullable: true description: "Map for teamId and associated additional superuser teams"
description: "List of teams to become Postgres superusers" additionalProperties:
items: type: array
type: string nullable: true
additionalTeams: description: "List of teams to become Postgres superusers"
type: object items:
description: "Map for teamId and associated additional teams" type: string
additionalProperties: additionalTeams:
type: array type: object
nullable: true description: "Map for teamId and associated additional teams"
description: "List of teams whose members will also be added to the Postgres cluster" additionalProperties:
items: type: array
type: string nullable: true
additionalMembers: description: "List of teams whose members will also be added to the Postgres cluster"
type: object items:
description: "Map for teamId and associated additional users" type: string
additionalProperties: additionalMembers:
type: array type: object
nullable: true description: "Map for teamId and associated additional users"
description: "List of users who will also be added to the Postgres cluster" additionalProperties:
items: type: array
type: string nullable: true
description: "List of users who will also be added to the Postgres cluster"
items:
type: string

View File

@ -24,19 +24,20 @@ 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.
var checkCmd = &cobra.Command{ var checkCmd = &cobra.Command{
Use: "check", Use: "check",
Short: "Checks the Postgres operator is installed in the k8s cluster", Short: "Checks the Postgres operator is installed in the k8s cluster",
Long: `Checks that the Postgres CRD is registered in a k8s cluster. Long: `Checks that the Postgres CRD is registered in a k8s cluster.
This means that the operator pod was able to start normally.`, This means that the operator pod was able to start normally.`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
check() 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,420 +11,575 @@ spec:
singular: operatorconfiguration singular: operatorconfiguration
shortNames: shortNames:
- opconfig - opconfig
additionalPrinterColumns:
- name: Image
type: string
description: Spilo image to be used for Pods
JSONPath: .configuration.docker_image
- name: Cluster-Label
type: string
description: Label for K8s resources created by operator
JSONPath: .configuration.kubernetes.cluster_name_label
- name: Service-Account
type: string
description: Name of service account to be used
JSONPath: .configuration.kubernetes.pod_service_account_name
- name: Min-Instances
type: integer
description: Minimum number of instances per Postgres cluster
JSONPath: .configuration.min_instances
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
scope: Namespaced scope: Namespaced
subresources: versions:
status: {} - name: v1
version: v1 served: true
validation: storage: true
openAPIV3Schema: subresources:
type: object status: {}
required: additionalPrinterColumns:
- kind - name: Image
- apiVersion type: string
- configuration description: Spilo image to be used for Pods
properties: JSONPath: .configuration.docker_image
kind: - name: Cluster-Label
type: string type: string
enum: description: Label for K8s resources created by operator
- OperatorConfiguration JSONPath: .configuration.kubernetes.cluster_name_label
apiVersion: - name: Service-Account
type: string type: string
enum: description: Name of service account to be used
- acid.zalan.do/v1 JSONPath: .configuration.kubernetes.pod_service_account_name
configuration: - name: Min-Instances
type: object type: integer
description: Minimum number of instances per Postgres cluster
JSONPath: .configuration.min_instances
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
required:
- kind
- apiVersion
- configuration
properties: properties:
docker_image: kind:
type: string type: string
enable_crd_validation: enum:
type: boolean - OperatorConfiguration
enable_lazy_spilo_upgrade: apiVersion:
type: boolean
enable_shm_volume:
type: boolean
etcd_host:
type: string type: string
kubernetes_use_configmaps: enum:
type: boolean - acid.zalan.do/v1
max_instances: configuration:
type: integer type: object
minimum: -1 # -1 = disabled properties:
min_instances: docker_image:
type: integer
minimum: -1 # -1 = disabled
resync_period:
type: string
repair_period:
type: string
set_memory_request_to_limit:
type: boolean
sidecar_docker_images:
type: object
additionalProperties:
type: string type: string
sidecars: enable_crd_validation:
type: array type: boolean
nullable: true enable_lazy_spilo_upgrade:
items: type: boolean
enable_shm_volume:
type: boolean
etcd_host:
type: string
kubernetes_use_configmaps:
type: boolean
max_instances:
type: integer
minimum: -1 # -1 = disabled
min_instances:
type: integer
minimum: -1 # -1 = disabled
resync_period:
type: string
repair_period:
type: string
set_memory_request_to_limit:
type: boolean
sidecar_docker_images:
type: object type: object
additionalProperties: true additionalProperties:
workers:
type: integer
minimum: 1
users:
type: object
properties:
replication_username:
type: string
super_username:
type: string
kubernetes:
type: object
properties:
cluster_domain:
type: string type: string
cluster_labels: sidecars:
type: array
nullable: true
items:
type: object type: object
additionalProperties: additionalProperties: true
workers:
type: integer
minimum: 1
users:
type: object
properties:
replication_username:
type: string
super_username:
type: string
kubernetes:
type: object
properties:
cluster_domain:
type: string type: string
cluster_name_label: cluster_labels:
type: string
custom_pod_annotations:
type: object
additionalProperties:
type: string
delete_annotation_date_key:
type: string
delete_annotation_name_key:
type: string
downscaler_annotations:
type: array
items:
type: string
enable_init_containers:
type: boolean
enable_pod_antiaffinity:
type: boolean
enable_pod_disruption_budget:
type: boolean
enable_sidecars:
type: boolean
infrastructure_roles_secret_name:
type: string
infrastructure_roles_secrets:
type: array
nullable: true
items:
type: object type: object
required: additionalProperties:
- secretname type: string
- userkey cluster_name_label:
- passwordkey
properties:
secretname:
type: string
userkey:
type: string
passwordkey:
type: string
rolekey:
type: string
defaultuservalue:
type: string
defaultrolevalue:
type: string
details:
type: string
template:
type: boolean
inherited_labels:
type: array
items:
type: string type: string
master_pod_move_timeout: custom_pod_annotations:
type: string type: object
node_readiness_label: additionalProperties:
type: string
delete_annotation_date_key:
type: string
delete_annotation_name_key:
type: string
downscaler_annotations:
type: array
items:
type: string
enable_init_containers:
type: boolean
enable_pod_antiaffinity:
type: boolean
enable_pod_disruption_budget:
type: boolean
enable_sidecars:
type: boolean
infrastructure_roles_secret_name:
type: string
infrastructure_roles_secrets:
type: array
nullable: true
items:
type: object
required:
- secretname
- userkey
- passwordkey
properties:
secretname:
type: string
userkey:
type: string
passwordkey:
type: string
rolekey:
type: string
defaultuservalue:
type: string
defaultrolevalue:
type: string
details:
type: string
template:
type: boolean
inherited_labels:
type: array
items:
type: string
master_pod_move_timeout:
type: string
node_readiness_label:
type: object
additionalProperties:
type: string
oauth_token_secret_name:
type: string
pdb_name_format:
type: string
pod_antiaffinity_topology_key:
type: string
pod_environment_configmap:
type: string
pod_environment_secret:
type: string
pod_management_policy:
type: string
enum:
- "ordered_ready"
- "parallel"
pod_priority_class_name:
type: string
pod_role_label:
type: string
pod_service_account_definition:
type: string
pod_service_account_name:
type: string
pod_service_account_role_binding_definition:
type: string
pod_terminate_grace_period:
type: string
secret_name_template:
type: string
spilo_runasuser:
type: integer
spilo_runasgroup:
type: integer
spilo_fsgroup:
type: integer
spilo_privileged:
type: boolean
storage_resize_mode:
type: string
enum:
- "ebs"
- "pvc"
- "off"
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?)$'
min_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
min_memory_limit:
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
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 type: object
additionalProperties: properties:
type: string default_cpu_limit:
oauth_token_secret_name: type: string
type: string pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
pdb_name_format: default_cpu_request:
type: string type: string
pod_antiaffinity_topology_key: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string default_memory_limit:
pod_environment_configmap: type: string
type: string pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
pod_environment_secret: default_memory_request:
type: string type: string
pod_management_policy: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string timeouts:
enum:
- "ordered_ready"
- "parallel"
pod_priority_class_name:
type: string
pod_role_label:
type: string
pod_service_account_definition:
type: string
pod_service_account_name:
type: string
pod_service_account_role_binding_definition:
type: string
pod_terminate_grace_period:
type: string
secret_name_template:
type: string
spilo_runasuser:
type: integer
spilo_runasgroup:
type: integer
spilo_fsgroup:
type: integer
spilo_privileged:
type: boolean
storage_resize_mode:
type: string
enum:
- "ebs"
- "pvc"
- "off"
toleration:
type: object type: object
additionalProperties: properties:
type: string pod_label_wait_timeout:
watched_namespace: type: string
type: string pod_deletion_wait_timeout:
postgres_pod_resources: type: string
type: object ready_wait_interval:
properties: type: string
default_cpu_limit: ready_wait_timeout:
type: string type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' resource_check_interval:
default_cpu_request: type: string
type: string resource_check_timeout:
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' type: string
default_memory_limit: load_balancer:
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?)$'
min_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
min_memory_limit:
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 type: object
additionalProperties: properties:
type: string custom_service_annotations:
db_hosted_zone: type: object
type: string additionalProperties:
enable_master_load_balancer: type: string
type: boolean db_hosted_zone:
enable_replica_load_balancer: type: string
type: boolean enable_master_load_balancer:
external_traffic_policy: type: boolean
type: string enable_replica_load_balancer:
enum: type: boolean
- "Cluster" external_traffic_policy:
- "Local" type: string
master_dns_name_format: enum:
type: string - "Cluster"
replica_dns_name_format: - "Local"
type: string master_dns_name_format:
aws_or_gcp: type: string
type: object replica_dns_name_format:
properties: type: string
additional_secret_mount: aws_or_gcp:
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_postgres_team_crd:
type: boolean
enable_postgres_team_crd_superusers:
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
protected_role_names:
type: array
items:
type: string
team_admin_role:
type: string
team_api_role_configuration:
type: object type: object
additionalProperties: 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:
type: object
properties:
enable_admin_role_for_users:
type: boolean
enable_postgres_team_crd:
type: boolean
enable_postgres_team_crd_superusers:
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
protected_role_names:
type: array
items:
type: string
team_admin_role:
type: string
team_api_role_configuration:
type: object
additionalProperties:
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:
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 type: string
teams_api_url: logging_rest_api:
type: string type: object
logging_rest_api: properties:
type: object api_port:
properties: type: integer
api_port: cluster_history_entries:
type: integer type: integer
cluster_history_entries: ring_log_lines:
type: integer type: integer
ring_log_lines: scalyr: # deprecated
type: integer type: object
scalyr: # deprecated properties:
type: object scalyr_api_key:
properties: type: string
scalyr_api_key: scalyr_cpu_limit:
type: string type: string
scalyr_cpu_limit: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string scalyr_cpu_request:
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' type: string
scalyr_cpu_request: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string scalyr_image:
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' type: string
scalyr_image: scalyr_memory_limit:
type: string type: string
scalyr_memory_limit: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string scalyr_memory_request:
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$' type: string
scalyr_memory_request: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string scalyr_server_url:
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$' type: string
scalyr_server_url: connection_pooler:
type: string type: object
connection_pooler: properties:
type: object connection_pooler_schema:
properties: type: string
connection_pooler_schema: #default: "pooler"
type: string connection_pooler_user:
#default: "pooler" type: string
connection_pooler_user: #default: "pooler"
type: string connection_pooler_image:
#default: "pooler" type: string
connection_pooler_image: #default: "registry.opensource.zalan.do/acid/pgbouncer"
type: string connection_pooler_max_db_connections:
#default: "registry.opensource.zalan.do/acid/pgbouncer" type: integer
connection_pooler_max_db_connections: #default: 60
type: integer connection_pooler_mode:
#default: 60 type: string
connection_pooler_mode: enum:
type: string - "session"
enum: - "transaction"
- "session" #default: "transaction"
- "transaction" connection_pooler_number_of_instances:
#default: "transaction" type: integer
connection_pooler_number_of_instances: minimum: 2
type: integer #default: 2
minimum: 2 connection_pooler_default_cpu_limit:
#default: 2 type: string
connection_pooler_default_cpu_limit: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string #default: "1"
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' connection_pooler_default_cpu_request:
#default: "1" type: string
connection_pooler_default_cpu_request: pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
type: string #default: "500m"
pattern: '^(\d+m|\d+(\.\d{1,3})?)$' connection_pooler_default_memory_limit:
#default: "500m" type: string
connection_pooler_default_memory_limit: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string #default: "100Mi"
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$' connection_pooler_default_memory_request:
#default: "100Mi" type: string
connection_pooler_default_memory_request: pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
type: string #default: "100Mi"
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$' status:
#default: "100Mi" type: object
status: additionalProperties:
type: object type: string
additionalProperties:
type: string

File diff suppressed because it is too large Load Diff

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,52 +12,55 @@ spec:
shortNames: shortNames:
- pgteam - pgteam
scope: Namespaced scope: Namespaced
subresources: versions:
status: {} - name: v1
version: v1 served: true
validation: storage: true
openAPIV3Schema: subresources:
type: object status: {}
required: schema:
- kind openAPIV3Schema:
- apiVersion type: object
- spec required:
properties: - kind
kind: - apiVersion
type: string - spec
enum: properties:
- PostgresTeam kind:
apiVersion: type: string
type: string enum:
enum: - PostgresTeam
- acid.zalan.do/v1 apiVersion:
spec: type: string
type: object enum:
properties: - acid.zalan.do/v1
additionalSuperuserTeams: spec:
type: object type: object
description: "Map for teamId and associated additional superuser teams" properties:
additionalProperties: additionalSuperuserTeams:
type: array type: object
nullable: true description: "Map for teamId and associated additional superuser teams"
description: "List of teams to become Postgres superusers" additionalProperties:
items: type: array
type: string nullable: true
additionalTeams: description: "List of teams to become Postgres superusers"
type: object items:
description: "Map for teamId and associated additional teams" type: string
additionalProperties: additionalTeams:
type: array type: object
nullable: true description: "Map for teamId and associated additional teams"
description: "List of teams whose members will also be added to the Postgres cluster" additionalProperties:
items: type: array
type: string nullable: true
additionalMembers: description: "List of teams whose members will also be added to the Postgres cluster"
type: object items:
description: "Map for teamId and associated additional users" type: string
additionalProperties: additionalMembers:
type: array type: object
nullable: true description: "Map for teamId and associated additional users"
description: "List of users who will also be added to the Postgres cluster" additionalProperties:
items: type: array
type: string nullable: true
description: "List of users who will also be added to the Postgres cluster"
items:
type: string

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,
Schema: &validation,
},
}, },
AdditionalPrinterColumns: columns,
Validation: &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