update docs about CRD generation and copy paste to chart dir, too (#3117)

This commit is contained in:
Felix Kunde 2026-06-26 10:43:57 +02:00 committed by GitHub
parent 49895a2200
commit 26af5a7900
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 409 additions and 113 deletions

View File

@ -75,7 +75,10 @@ $(GENERATED_CRDS): $(GENERATED)
@mv manifests/acid.zalan.do_operatorconfigurations.yaml manifests/operatorconfiguration.crd.yaml @mv manifests/acid.zalan.do_operatorconfigurations.yaml manifests/operatorconfiguration.crd.yaml
@mv manifests/acid.zalan.do_postgresteams.yaml manifests/postgresteam.crd.yaml @mv manifests/acid.zalan.do_postgresteams.yaml manifests/postgresteam.crd.yaml
@cp manifests/postgresql.crd.yaml pkg/apis/acid.zalan.do/v1/postgresql.crd.yaml @cp manifests/postgresql.crd.yaml pkg/apis/acid.zalan.do/v1/postgresql.crd.yaml
@cp manifests/postgresql.crd.yaml charts/postgres-operator/crds/postgresqls.yaml
@cp manifests/operatorconfiguration.crd.yaml pkg/apis/acid.zalan.do/v1/operatorconfiguration.crd.yaml @cp manifests/operatorconfiguration.crd.yaml pkg/apis/acid.zalan.do/v1/operatorconfiguration.crd.yaml
@cp manifests/operatorconfiguration.crd.yaml charts/postgres-operator/crds/operatorconfigurations.yaml
@cp manifests/postgresteam.crd.yaml charts/postgres-operator/crds/postgresteams.yaml
local: ${SOURCES} $(GENERATED_CRDS) local: ${SOURCES} $(GENERATED_CRDS)
CGO_ENABLED=${CGO_ENABLED} go build -o build/${BINARY} $(LOCAL_BUILD_FLAGS) -ldflags "$(LDFLAGS)" $(SOURCES) CGO_ENABLED=${CGO_ENABLED} go build -o build/${BINARY} $(LOCAL_BUILD_FLAGS) -ldflags "$(LDFLAGS)" $(SOURCES)

View File

@ -1,9 +1,12 @@
---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: operatorconfigurations.acid.zalan.do annotations:
controller-gen.kubebuilder.io/version: v0.17.3
labels: labels:
app.kubernetes.io/name: postgres-operator app.kubernetes.io/name: postgres-operator
name: operatorconfigurations.acid.zalan.do
spec: spec:
group: acid.zalan.do group: acid.zalan.do
names: names:

View File

@ -1,9 +1,12 @@
---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: postgresqls.acid.zalan.do annotations:
controller-gen.kubebuilder.io/version: v0.17.3
labels: labels:
app.kubernetes.io/name: postgres-operator app.kubernetes.io/name: postgres-operator
name: postgresqls.acid.zalan.do
spec: spec:
group: acid.zalan.do group: acid.zalan.do
names: names:
@ -301,7 +304,9 @@ spec:
a Container. a Container.
properties: properties:
name: name:
description: Name of the environment variable. Must be a C_IDENTIFIER. description: |-
Name of the environment variable.
May consist of any printable ASCII characters except '='.
type: string type: string
value: value:
description: |- description: |-
@ -359,6 +364,43 @@ spec:
- fieldPath - fieldPath
type: object type: object
x-kubernetes-map-type: atomic x-kubernetes-map-type: atomic
fileKeyRef:
description: |-
FileKeyRef selects a key of the env file.
Requires the EnvFiles feature gate to be enabled.
properties:
key:
description: |-
The key within the env file. An invalid key will prevent the pod from starting.
The keys defined within a source may consist of any printable ASCII characters except '='.
During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
type: string
optional:
default: false
description: |-
Specify whether the file or its key must be defined. If the file or key
does not exist, then the env var is not published.
If optional is set to true and the specified key does not exist,
the environment variable will not be set in the Pod's containers.
If optional is set to false and the specified key does not exist,
an error will be returned during Pod creation.
type: boolean
path:
description: |-
The path within the volume from which to select the file.
Must be relative and may not contain the '..' path or start with '..'.
type: string
volumeName:
description: The name of the volume mount containing
the env file.
type: string
required:
- key
- path
- volumeName
type: object
x-kubernetes-map-type: atomic
resourceFieldRef: resourceFieldRef:
description: |- description: |-
Selects a resource of the container: only resources limits and requests Selects a resource of the container: only resources limits and requests
@ -455,8 +497,9 @@ spec:
in a Container. in a Container.
properties: properties:
name: name:
description: Name of the environment variable. Must be description: |-
a C_IDENTIFIER. Name of the environment variable.
May consist of any printable ASCII characters except '='.
type: string type: string
value: value:
description: |- description: |-
@ -514,6 +557,43 @@ spec:
- fieldPath - fieldPath
type: object type: object
x-kubernetes-map-type: atomic x-kubernetes-map-type: atomic
fileKeyRef:
description: |-
FileKeyRef selects a key of the env file.
Requires the EnvFiles feature gate to be enabled.
properties:
key:
description: |-
The key within the env file. An invalid key will prevent the pod from starting.
The keys defined within a source may consist of any printable ASCII characters except '='.
During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
type: string
optional:
default: false
description: |-
Specify whether the file or its key must be defined. If the file or key
does not exist, then the env var is not published.
If optional is set to true and the specified key does not exist,
the environment variable will not be set in the Pod's containers.
If optional is set to false and the specified key does not exist,
an error will be returned during Pod creation.
type: boolean
path:
description: |-
The path within the volume from which to select the file.
Must be relative and may not contain the '..' path or start with '..'.
type: string
volumeName:
description: The name of the volume mount containing
the env file.
type: string
required:
- key
- path
- volumeName
type: object
x-kubernetes-map-type: atomic
resourceFieldRef: resourceFieldRef:
description: |- description: |-
Selects a resource of the container: only resources limits and requests Selects a resource of the container: only resources limits and requests
@ -574,14 +654,14 @@ spec:
envFrom: envFrom:
description: |- description: |-
List of sources to populate environment variables in the container. List of sources to populate environment variables in the container.
The keys defined within a source must be a C_IDENTIFIER. All invalid keys The keys defined within a source may consist of any printable ASCII characters except '='.
will be reported as an event when the container is starting. When a key exists in multiple When a key exists in multiple
sources, the value associated with the last source will take precedence. sources, the value associated with the last source will take precedence.
Values defined by an Env with a duplicate key will take precedence. Values defined by an Env with a duplicate key will take precedence.
Cannot be updated. Cannot be updated.
items: items:
description: EnvFromSource represents the source of a set description: EnvFromSource represents the source of a set
of ConfigMaps of ConfigMaps or Secrets
properties: properties:
configMapRef: configMapRef:
description: The ConfigMap to select from description: The ConfigMap to select from
@ -602,8 +682,9 @@ spec:
type: object type: object
x-kubernetes-map-type: atomic x-kubernetes-map-type: atomic
prefix: prefix:
description: An optional identifier to prepend to each description: |-
key in the ConfigMap. Must be a C_IDENTIFIER. Optional text to prepend to the name of each environment variable.
May consist of any printable ASCII characters except '='.
type: string type: string
secretRef: secretRef:
description: The Secret to select from description: The Secret to select from
@ -866,6 +947,12 @@ spec:
- port - port
type: object type: object
type: object type: object
stopSignal:
description: |-
StopSignal defines which signal will be sent to a container when it is being stopped.
If not specified, the default is defined by the container runtime in use.
StopSignal can only be set for Pods with a non-empty .spec.os.name
type: string
type: object type: object
livenessProbe: livenessProbe:
description: |- description: |-
@ -1236,7 +1323,9 @@ spec:
type: integer type: integer
type: object type: object
resizePolicy: resizePolicy:
description: Resources resize policy for the container. description: |-
Resources resize policy for the container.
This field cannot be set on ephemeral containers.
items: items:
description: ContainerResizePolicy represents resource resize description: ContainerResizePolicy represents resource resize
policy for the container. policy for the container.
@ -1268,7 +1357,7 @@ spec:
Claims lists the names of resources, defined in spec.resourceClaims, Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container. that are used by this container.
This is an alpha field and requires enabling the This field depends on the
DynamicResourceAllocation feature gate. DynamicResourceAllocation feature gate.
This field is immutable. It can only be set for containers. This field is immutable. It can only be set for containers.
@ -1322,10 +1411,10 @@ spec:
restartPolicy: restartPolicy:
description: |- description: |-
RestartPolicy defines the restart behavior of individual containers in a pod. RestartPolicy defines the restart behavior of individual containers in a pod.
This field may only be set for init containers, and the only allowed value is "Always". This overrides the pod-level restart policy. When this field is not specified,
For non-init containers or when this field is not specified,
the restart behavior is defined by the Pod's restart policy and the container type. the restart behavior is defined by the Pod's restart policy and the container type.
Setting the RestartPolicy as "Always" for the init container will have the following effect: Additionally, setting the RestartPolicy as "Always" for the init container will
have the following effect:
this init container will be continually restarted on this init container will be continually restarted on
exit until all regular containers have terminated. Once all regular exit until all regular containers have terminated. Once all regular
containers have completed, all init containers with restartPolicy "Always" containers have completed, all init containers with restartPolicy "Always"
@ -1337,6 +1426,59 @@ spec:
init container is started, or after any startupProbe has successfully init container is started, or after any startupProbe has successfully
completed. completed.
type: string type: string
restartPolicyRules:
description: |-
Represents a list of rules to be checked to determine if the
container should be restarted on exit. The rules are evaluated in
order. Once a rule matches a container exit condition, the remaining
rules are ignored. If no rule matches the container exit condition,
the Container-level restart policy determines the whether the container
is restarted or not. Constraints on the rules:
- At most 20 rules are allowed.
- Rules can have the same action.
- Identical rules are not forbidden in validations.
When rules are specified, container MUST set RestartPolicy explicitly
even it if matches the Pod's RestartPolicy.
items:
description: ContainerRestartRule describes how a container
exit is handled.
properties:
action:
description: |-
Specifies the action taken on a container exit if the requirements
are satisfied. The only possible value is "Restart" to restart the
container.
type: string
exitCodes:
description: Represents the exit codes to check on container
exits.
properties:
operator:
description: |-
Represents the relationship between the container exit code(s) and the
specified values. Possible values are:
- In: the requirement is satisfied if the container exit code is in the
set of specified values.
- NotIn: the requirement is satisfied if the container exit code is
not in the set of specified values.
type: string
values:
description: |-
Specifies the set of values to check for container exit codes.
At most 255 elements are allowed.
items:
format: int32
type: integer
type: array
x-kubernetes-list-type: set
required:
- operator
type: object
required:
- action
type: object
type: array
x-kubernetes-list-type: atomic
securityContext: securityContext:
description: |- description: |-
SecurityContext defines the security options the container should be run with. SecurityContext defines the security options the container should be run with.
@ -1412,7 +1554,6 @@ spec:
procMount denotes the type of proc mount to use for the containers. procMount denotes the type of proc mount to use for the containers.
The default value is Default which uses the container runtime defaults for The default value is Default which uses the container runtime defaults for
readonly paths and masked paths. readonly paths and masked paths.
This requires the ProcMountType feature flag to be enabled.
Note that this field cannot be set when spec.os.name is windows. Note that this field cannot be set when spec.os.name is windows.
type: string type: string
readOnlyRootFilesystem: readOnlyRootFilesystem:
@ -1877,8 +2018,9 @@ spec:
in a Container. in a Container.
properties: properties:
name: name:
description: Name of the environment variable. Must be description: |-
a C_IDENTIFIER. Name of the environment variable.
May consist of any printable ASCII characters except '='.
type: string type: string
value: value:
description: |- description: |-
@ -1936,6 +2078,43 @@ spec:
- fieldPath - fieldPath
type: object type: object
x-kubernetes-map-type: atomic x-kubernetes-map-type: atomic
fileKeyRef:
description: |-
FileKeyRef selects a key of the env file.
Requires the EnvFiles feature gate to be enabled.
properties:
key:
description: |-
The key within the env file. An invalid key will prevent the pod from starting.
The keys defined within a source may consist of any printable ASCII characters except '='.
During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
type: string
optional:
default: false
description: |-
Specify whether the file or its key must be defined. If the file or key
does not exist, then the env var is not published.
If optional is set to true and the specified key does not exist,
the environment variable will not be set in the Pod's containers.
If optional is set to false and the specified key does not exist,
an error will be returned during Pod creation.
type: boolean
path:
description: |-
The path within the volume from which to select the file.
Must be relative and may not contain the '..' path or start with '..'.
type: string
volumeName:
description: The name of the volume mount containing
the env file.
type: string
required:
- key
- path
- volumeName
type: object
x-kubernetes-map-type: atomic
resourceFieldRef: resourceFieldRef:
description: |- description: |-
Selects a resource of the container: only resources limits and requests Selects a resource of the container: only resources limits and requests
@ -1996,14 +2175,14 @@ spec:
envFrom: envFrom:
description: |- description: |-
List of sources to populate environment variables in the container. List of sources to populate environment variables in the container.
The keys defined within a source must be a C_IDENTIFIER. All invalid keys The keys defined within a source may consist of any printable ASCII characters except '='.
will be reported as an event when the container is starting. When a key exists in multiple When a key exists in multiple
sources, the value associated with the last source will take precedence. sources, the value associated with the last source will take precedence.
Values defined by an Env with a duplicate key will take precedence. Values defined by an Env with a duplicate key will take precedence.
Cannot be updated. Cannot be updated.
items: items:
description: EnvFromSource represents the source of a set description: EnvFromSource represents the source of a set
of ConfigMaps of ConfigMaps or Secrets
properties: properties:
configMapRef: configMapRef:
description: The ConfigMap to select from description: The ConfigMap to select from
@ -2024,8 +2203,9 @@ spec:
type: object type: object
x-kubernetes-map-type: atomic x-kubernetes-map-type: atomic
prefix: prefix:
description: An optional identifier to prepend to each description: |-
key in the ConfigMap. Must be a C_IDENTIFIER. Optional text to prepend to the name of each environment variable.
May consist of any printable ASCII characters except '='.
type: string type: string
secretRef: secretRef:
description: The Secret to select from description: The Secret to select from
@ -2288,6 +2468,12 @@ spec:
- port - port
type: object type: object
type: object type: object
stopSignal:
description: |-
StopSignal defines which signal will be sent to a container when it is being stopped.
If not specified, the default is defined by the container runtime in use.
StopSignal can only be set for Pods with a non-empty .spec.os.name
type: string
type: object type: object
livenessProbe: livenessProbe:
description: |- description: |-
@ -2658,7 +2844,9 @@ spec:
type: integer type: integer
type: object type: object
resizePolicy: resizePolicy:
description: Resources resize policy for the container. description: |-
Resources resize policy for the container.
This field cannot be set on ephemeral containers.
items: items:
description: ContainerResizePolicy represents resource resize description: ContainerResizePolicy represents resource resize
policy for the container. policy for the container.
@ -2690,7 +2878,7 @@ spec:
Claims lists the names of resources, defined in spec.resourceClaims, Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container. that are used by this container.
This is an alpha field and requires enabling the This field depends on the
DynamicResourceAllocation feature gate. DynamicResourceAllocation feature gate.
This field is immutable. It can only be set for containers. This field is immutable. It can only be set for containers.
@ -2744,10 +2932,10 @@ spec:
restartPolicy: restartPolicy:
description: |- description: |-
RestartPolicy defines the restart behavior of individual containers in a pod. RestartPolicy defines the restart behavior of individual containers in a pod.
This field may only be set for init containers, and the only allowed value is "Always". This overrides the pod-level restart policy. When this field is not specified,
For non-init containers or when this field is not specified,
the restart behavior is defined by the Pod's restart policy and the container type. the restart behavior is defined by the Pod's restart policy and the container type.
Setting the RestartPolicy as "Always" for the init container will have the following effect: Additionally, setting the RestartPolicy as "Always" for the init container will
have the following effect:
this init container will be continually restarted on this init container will be continually restarted on
exit until all regular containers have terminated. Once all regular exit until all regular containers have terminated. Once all regular
containers have completed, all init containers with restartPolicy "Always" containers have completed, all init containers with restartPolicy "Always"
@ -2759,6 +2947,59 @@ spec:
init container is started, or after any startupProbe has successfully init container is started, or after any startupProbe has successfully
completed. completed.
type: string type: string
restartPolicyRules:
description: |-
Represents a list of rules to be checked to determine if the
container should be restarted on exit. The rules are evaluated in
order. Once a rule matches a container exit condition, the remaining
rules are ignored. If no rule matches the container exit condition,
the Container-level restart policy determines the whether the container
is restarted or not. Constraints on the rules:
- At most 20 rules are allowed.
- Rules can have the same action.
- Identical rules are not forbidden in validations.
When rules are specified, container MUST set RestartPolicy explicitly
even it if matches the Pod's RestartPolicy.
items:
description: ContainerRestartRule describes how a container
exit is handled.
properties:
action:
description: |-
Specifies the action taken on a container exit if the requirements
are satisfied. The only possible value is "Restart" to restart the
container.
type: string
exitCodes:
description: Represents the exit codes to check on container
exits.
properties:
operator:
description: |-
Represents the relationship between the container exit code(s) and the
specified values. Possible values are:
- In: the requirement is satisfied if the container exit code is in the
set of specified values.
- NotIn: the requirement is satisfied if the container exit code is
not in the set of specified values.
type: string
values:
description: |-
Specifies the set of values to check for container exit codes.
At most 255 elements are allowed.
items:
format: int32
type: integer
type: array
x-kubernetes-list-type: set
required:
- operator
type: object
required:
- action
type: object
type: array
x-kubernetes-list-type: atomic
securityContext: securityContext:
description: |- description: |-
SecurityContext defines the security options the container should be run with. SecurityContext defines the security options the container should be run with.
@ -2834,7 +3075,6 @@ spec:
procMount denotes the type of proc mount to use for the containers. procMount denotes the type of proc mount to use for the containers.
The default value is Default which uses the container runtime defaults for The default value is Default which uses the container runtime defaults for
readonly paths and masked paths. readonly paths and masked paths.
This requires the ProcMountType feature flag to be enabled.
Note that this field cannot be set when spec.os.name is windows. Note that this field cannot be set when spec.os.name is windows.
type: string type: string
readOnlyRootFilesystem: readOnlyRootFilesystem:
@ -3848,8 +4088,9 @@ spec:
in a Container. in a Container.
properties: properties:
name: name:
description: Name of the environment variable. Must be description: |-
a C_IDENTIFIER. Name of the environment variable.
May consist of any printable ASCII characters except '='.
type: string type: string
value: value:
description: |- description: |-
@ -3907,6 +4148,43 @@ spec:
- fieldPath - fieldPath
type: object type: object
x-kubernetes-map-type: atomic x-kubernetes-map-type: atomic
fileKeyRef:
description: |-
FileKeyRef selects a key of the env file.
Requires the EnvFiles feature gate to be enabled.
properties:
key:
description: |-
The key within the env file. An invalid key will prevent the pod from starting.
The keys defined within a source may consist of any printable ASCII characters except '='.
During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
type: string
optional:
default: false
description: |-
Specify whether the file or its key must be defined. If the file or key
does not exist, then the env var is not published.
If optional is set to true and the specified key does not exist,
the environment variable will not be set in the Pod's containers.
If optional is set to false and the specified key does not exist,
an error will be returned during Pod creation.
type: boolean
path:
description: |-
The path within the volume from which to select the file.
Must be relative and may not contain the '..' path or start with '..'.
type: string
volumeName:
description: The name of the volume mount containing
the env file.
type: string
required:
- key
- path
- volumeName
type: object
x-kubernetes-map-type: atomic
resourceFieldRef: resourceFieldRef:
description: |- description: |-
Selects a resource of the container: only resources limits and requests Selects a resource of the container: only resources limits and requests
@ -4213,9 +4491,10 @@ spec:
operator: operator:
description: |- description: |-
Operator represents a key's relationship to the value. Operator represents a key's relationship to the value.
Valid operators are Exists and Equal. Defaults to Equal. Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal.
Exists is equivalent to wildcard for value, so that a pod can Exists is equivalent to wildcard for value, so that a pod can
tolerate all taints of a particular category. tolerate all taints of a particular category.
Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators).
type: string type: string
tolerationSeconds: tolerationSeconds:
description: |- description: |-
@ -4354,7 +4633,6 @@ spec:
- Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations.
If this value is nil, the behavior is equivalent to the Honor policy. If this value is nil, the behavior is equivalent to the Honor policy.
This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
type: string type: string
nodeTaintsPolicy: nodeTaintsPolicy:
description: |- description: |-
@ -4365,7 +4643,6 @@ spec:
- Ignore: node taints are ignored. All nodes are included. - Ignore: node taints are ignored. All nodes are included.
If this value is nil, the behavior is equivalent to the Ignore policy. If this value is nil, the behavior is equivalent to the Ignore policy.
This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
type: string type: string
topologyKey: topologyKey:
description: |- description: |-

View File

@ -1,70 +1,84 @@
---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
metadata: metadata:
name: postgresteams.acid.zalan.do annotations:
controller-gen.kubebuilder.io/version: v0.17.3
labels: labels:
app.kubernetes.io/name: postgres-operator app.kubernetes.io/name: postgres-operator
name: postgresteams.acid.zalan.do
spec: spec:
group: acid.zalan.do group: acid.zalan.do
names: names:
categories:
- all
kind: PostgresTeam kind: PostgresTeam
listKind: PostgresTeamList listKind: PostgresTeamList
plural: postgresteams plural: postgresteams
singular: postgresteam
shortNames: shortNames:
- pgteam - pgteam
categories: singular: postgresteam
- all
scope: Namespaced scope: Namespaced
versions: versions:
- name: v1 - name: v1
schema:
openAPIV3Schema:
description: PostgresTeam defines Custom Resource Definition Object for team
management.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: PostgresTeamSpec defines the specification for the PostgresTeam
TPR.
properties:
additionalMembers:
additionalProperties:
description: List of users who will also be added to the Postgres
cluster.
items:
type: string
type: array
description: Map for teamId and associated additional users
type: object
additionalSuperuserTeams:
additionalProperties:
description: List of teams to become Postgres superusers
items:
type: string
type: array
description: Map for teamId and associated additional superuser teams
type: object
additionalTeams:
additionalProperties:
description: List of teams whose members will also be added to the
Postgres cluster.
items:
type: string
type: array
description: Map for teamId and associated additional teams
type: object
type: object
required:
- metadata
- spec
type: object
served: true served: true
storage: true storage: true
subresources: subresources:
status: {} status: {}
schema:
openAPIV3Schema:
type: object
required:
- kind
- apiVersion
- spec
properties:
kind:
type: string
enum:
- PostgresTeam
apiVersion:
type: string
enum:
- acid.zalan.do/v1
spec:
type: object
properties:
additionalSuperuserTeams:
type: object
description: "Map for teamId and associated additional superuser teams"
additionalProperties:
type: array
nullable: true
description: "List of teams to become Postgres superusers"
items:
type: string
additionalTeams:
type: object
description: "Map for teamId and associated additional teams"
additionalProperties:
type: array
nullable: true
description: "List of teams whose members will also be added to the Postgres cluster"
items:
type: string
additionalMembers:
type: object
description: "Map for teamId and associated additional users"
additionalProperties:
type: array
nullable: true
description: "List of users who will also be added to the Postgres cluster"
items:
type: string

View File

@ -27,20 +27,11 @@ git clone https://github.com/zalando/postgres-operator.git
## Building the operator ## Building the operator
We use [Go Modules](https://github.com/golang/go/wiki/Modules) for handling We use [Go Modules](https://github.com/golang/go/wiki/Modules) for handling dependencies.
dependencies. When using Go below v1.13 you need to explicitly enable Go modules Run `go mod vendor && go mod tidy` to install them.
by setting the `GO111MODULE` environment variable to `on`. The make targets do
this for you, so simply run
```bash Build the operator with the `make docker` command. You may define the TAG variable to assign an explicit tag to your Docker image and the IMAGE to set the image name. By default, the tag is computed with
make `git describe --tags --always --dirty` and the image is `ghcr.io/zalando/postgres-operator`. On macos search and replace `sed -i` commands with `sed -i ''` for the make commands to work.
```
Build the operator with the `make docker` command. You may define the TAG
variable to assign an explicit tag to your Docker image and the IMAGE to set
the image name. By default, the tag is computed with
`git describe --tags --always --dirty` and the image is
`ghcr.io/zalando/postgres-operator`
```bash ```bash
export TAG=$(git describe --tags --always --dirty) export TAG=$(git describe --tags --always --dirty)
@ -296,8 +287,7 @@ Please run flake8 [before submitting a PR](http://flake8.pycqa.org/en/latest/use
In the case you want to add functionality to the operator that shall be In the case you want to add functionality to the operator that shall be
controlled via the operator configuration there are a few places that need to controlled via the operator configuration there are a few places that need to
be updated. As explained [here](reference/operator_parameters.md), it's possible be updated. As explained [here](reference/operator_parameters.md), it's possible
to configure the operator either with a ConfigMap or CRD, but currently we aim to configure the operator either with a ConfigMap or CRD.
to synchronize parameters everywhere.
When choosing a parameter name for a new option in a Postgres cluster manifest, When choosing a parameter name for a new option in a Postgres cluster manifest,
keep in mind the naming conventions there. We use `camelCase` for manifest keep in mind the naming conventions there. We use `camelCase` for manifest
@ -320,32 +310,28 @@ manifest files:
Postgres manifest parameters are defined in the [api package](https://github.com/zalando/postgres-operator/blob/master/pkg/apis/acid.zalan.do/v1/postgresql_type.go). Postgres manifest parameters are defined in the [api package](https://github.com/zalando/postgres-operator/blob/master/pkg/apis/acid.zalan.do/v1/postgresql_type.go).
The operator behavior has to be implemented at least in [k8sres.go](https://github.com/zalando/postgres-operator/blob/master/pkg/cluster/k8sres.go). The operator behavior has to be implemented at least in [k8sres.go](https://github.com/zalando/postgres-operator/blob/master/pkg/cluster/k8sres.go).
Validation of CRD parameters is controlled in [crds.go](https://github.com/zalando/postgres-operator/blob/master/pkg/apis/acid.zalan.do/v1/crds.go).
Please, reflect your changes in tests, for example in: Please, reflect your changes in tests, for example in:
* [config_test.go](https://github.com/zalando/postgres-operator/blob/master/pkg/util/config/config_test.go) * [config_test.go](https://github.com/zalando/postgres-operator/blob/master/pkg/util/config/config_test.go)
* [k8sres_test.go](https://github.com/zalando/postgres-operator/blob/master/pkg/cluster/k8sres_test.go) * [k8sres_test.go](https://github.com/zalando/postgres-operator/blob/master/pkg/cluster/k8sres_test.go)
* [util_test.go](https://github.com/zalando/postgres-operator/blob/master/pkg/apis/acid.zalan.do/v1/util_test.go) * [util_test.go](https://github.com/zalando/postgres-operator/blob/master/pkg/apis/acid.zalan.do/v1/util_test.go)
### Updating manifest files ### Generating the CRDs
For the CRD-based configuration, please update the following files: The CRDs can be automatically generated from the go structs. Use the correct kubebuilder annotations for defining the validation, constraints or default values etc.. Run `make` to update the CRDs which are stored in three locations:
- In the Go api package
* the default [OperatorConfiguration](https://github.com/zalando/postgres-operator/blob/master/manifests/postgresql-operator-default-configuration.yaml) - The example manifests folder
* the CRD's [validation](https://github.com/zalando/postgres-operator/blob/master/manifests/operatorconfiguration.crd.yaml) - The helm chart folder
* the CRD's validation in the [Helm chart](https://github.com/zalando/postgres-operator/blob/master/charts/postgres-operator/crds/operatorconfigurations.yaml)
Add new options also to the Helm chart's [values file](https://github.com/zalando/postgres-operator/blob/master/charts/postgres-operator/values.yaml) file.
It follows the OperatorConfiguration CRD layout. Nested values will be flattened for the ConfigMap.
Last but no least, update the [ConfigMap](https://github.com/zalando/postgres-operator/blob/master/manifests/configmap.yaml) manifest example as well.
### Updating documentation ### Updating documentation
Finally, add a section for each new configuration option and/or cluster manifest Config changes need to be reflected in the Helm chart's [values file](https://github.com/zalando/postgres-operator/blob/master/charts/postgres-operator/values.yaml), too. It follows the OperatorConfiguration CRD layout. Nested values will be flattened for the ConfigMap.
Add a section for each new configuration option and/or cluster manifest
parameter in the reference documents: parameter in the reference documents:
* [config reference](reference/operator_parameters.md) * [config reference](reference/operator_parameters.md)
* [manifest reference](reference/cluster_manifest.md) * [manifest reference](reference/cluster_manifest.md)
It also helps users to explain new features with examples in the It can also help other K8s admins to explain new features with examples in the
[administrator docs](administrator.md). [administrator docs](administrator.md) and also update the [OperatorConfiguration CRD](https://github.com/zalando/postgres-operator/blob/master/manifests/postgresql-operator-default-configuration.yaml) and [ConfigMap](https://github.com/zalando/postgres-operator/blob/master/manifests/configmap.yaml) manifest examples.

View File

@ -4,6 +4,8 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.17.3 controller-gen.kubebuilder.io/version: v0.17.3
labels:
app.kubernetes.io/name: postgres-operator
name: operatorconfigurations.acid.zalan.do name: operatorconfigurations.acid.zalan.do
spec: spec:
group: acid.zalan.do group: acid.zalan.do

View File

@ -4,6 +4,8 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.17.3 controller-gen.kubebuilder.io/version: v0.17.3
labels:
app.kubernetes.io/name: postgres-operator
name: postgresqls.acid.zalan.do name: postgresqls.acid.zalan.do
spec: spec:
group: acid.zalan.do group: acid.zalan.do

View File

@ -4,6 +4,8 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.17.3 controller-gen.kubebuilder.io/version: v0.17.3
labels:
app.kubernetes.io/name: postgres-operator
name: postgresteams.acid.zalan.do name: postgresteams.acid.zalan.do
spec: spec:
group: acid.zalan.do group: acid.zalan.do

View File

@ -24,6 +24,7 @@ import (
// +kubebuilder:printcolumn:name="Min-Instances",type=integer,JSONPath=`.configuration.min_instances`,description="Minimum number of instances per Postgres cluster" // +kubebuilder:printcolumn:name="Min-Instances",type=integer,JSONPath=`.configuration.min_instances`,description="Minimum number of instances per Postgres cluster"
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age of the OperatorConfiguration resource" // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age of the OperatorConfiguration resource"
// +kubebuilder:subresource:status // +kubebuilder:subresource:status
// +kubebuilder:metadata:labels=app.kubernetes.io/name=postgres-operator
type OperatorConfiguration struct { type OperatorConfiguration struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"` metav1.ObjectMeta `json:"metadata"`

View File

@ -4,6 +4,8 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.17.3 controller-gen.kubebuilder.io/version: v0.17.3
labels:
app.kubernetes.io/name: postgres-operator
name: operatorconfigurations.acid.zalan.do name: operatorconfigurations.acid.zalan.do
spec: spec:
group: acid.zalan.do group: acid.zalan.do

View File

@ -11,6 +11,7 @@ import (
// +k8s:deepcopy-gen=true // +k8s:deepcopy-gen=true
// +kubebuilder:resource:shortName=pgteam,categories=all // +kubebuilder:resource:shortName=pgteam,categories=all
// +kubebuilder:subresource:status // +kubebuilder:subresource:status
// +kubebuilder:metadata:labels=app.kubernetes.io/name=postgres-operator
type PostgresTeam struct { type PostgresTeam struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"` metav1.ObjectMeta `json:"metadata"`

View File

@ -4,6 +4,8 @@ kind: CustomResourceDefinition
metadata: metadata:
annotations: annotations:
controller-gen.kubebuilder.io/version: v0.17.3 controller-gen.kubebuilder.io/version: v0.17.3
labels:
app.kubernetes.io/name: postgres-operator
name: postgresqls.acid.zalan.do name: postgresqls.acid.zalan.do
spec: spec:
group: acid.zalan.do group: acid.zalan.do

View File

@ -24,6 +24,7 @@ import (
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age of the PostgreSQL cluster" // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age of the PostgreSQL cluster"
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.PostgresClusterStatus`,description="Current sync status of postgresql resource" // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.PostgresClusterStatus`,description="Current sync status of postgresql resource"
// +kubebuilder:subresource:status // +kubebuilder:subresource:status
// +kubebuilder:metadata:labels=app.kubernetes.io/name=postgres-operator
type Postgresql struct { type Postgresql struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"` metav1.ObjectMeta `json:"metadata"`