Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28817,6 +28817,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/pgv2.percona.com_perconapgclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29515,6 +29515,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28759,6 +28759,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down
12 changes: 12 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29812,6 +29812,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down Expand Up @@ -66984,6 +66990,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down
1 change: 1 addition & 0 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ spec:
# name: replication1-cert
# tlsOnly: false
# tls:
# certManagementPolicy: auto
# certValidityDuration: 2160h
# caValidityDuration: 26280h
# pgBackRestCertValidityDuration: 2160h
Expand Down
12 changes: 12 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29812,6 +29812,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down Expand Up @@ -66984,6 +66990,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down
12 changes: 12 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29812,6 +29812,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down Expand Up @@ -66984,6 +66990,12 @@ spec:
properties:
caValidityDuration:
type: string
certManagementPolicy:
default: auto
enum:
- auto
- userProvidedOnly
type: string
certValidityDuration:
type: string
issuerConf:
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/run-pr.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ backup-enable-disable
builtin-extensions
custom-extensions
cert-manager-tls
cert-management-policy
custom-envs
custom-tls
database-init-sql
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/run-release.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
backup-enable-disable
builtin-extensions
cert-manager-tls
cert-management-policy
custom-envs
custom-extensions
custom-tls
Expand Down
24 changes: 24 additions & 0 deletions e2e-tests/tests/cert-management-policy/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: perconapgclusters.pgv2.percona.com
spec:
group: pgv2.percona.com
names:
kind: PerconaPGCluster
listKind: PerconaPGClusterList
plural: perconapgclusters
singular: perconapgcluster
scope: Namespaced
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
metadata:
name: check-operator-deploy-status
timeout: 120
commands:
- script: kubectl assert exist-enhanced deployment percona-postgresql-operator -n ${OPERATOR_NS:-$NAMESPACE} --field-selector status.readyReplicas=1
13 changes: 13 additions & 0 deletions e2e-tests/tests/cert-management-policy/00-deploy-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 120
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions
init_temp_dir

destroy_cert_manager
deploy_operator
79 changes: 79 additions & 0 deletions e2e-tests/tests/cert-management-policy/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 300
---
apiVersion: v1
kind: Secret
metadata:
name: cert-management-policy-cluster-ca-cert
---
apiVersion: v1
kind: Secret
metadata:
name: cert-management-policy-cluster-cert
---
apiVersion: v1
kind: Secret
metadata:
name: cert-management-policy-replication-cert
---
kind: StatefulSet
apiVersion: apps/v1
metadata:
labels:
postgres-operator.crunchydata.com/cluster: cert-management-policy
postgres-operator.crunchydata.com/data: postgres
postgres-operator.crunchydata.com/instance-set: instance1
status:
observedGeneration: 1
replicas: 1
readyReplicas: 1
currentReplicas: 1
updatedReplicas: 1
collisionCount: 0
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: cert-management-policy-pgbouncer
labels:
postgres-operator.crunchydata.com/cluster: cert-management-policy
postgres-operator.crunchydata.com/role: pgbouncer
status:
observedGeneration: 1
replicas: 1
updatedReplicas: 1
readyReplicas: 1
---
apiVersion: upstream.pgv2.percona.com/v1beta1
kind: PostgresCluster
metadata:
name: cert-management-policy
status:
instances:
- name: instance1
readyReplicas: 1
replicas: 1
updatedReplicas: 1
observedGeneration: 1
proxy:
pgBouncer:
readyReplicas: 1
replicas: 1
---
apiVersion: pgv2.percona.com/v2
kind: PerconaPGCluster
metadata:
name: cert-management-policy
status:
pgbouncer:
ready: 1
size: 1
postgres:
instances:
- name: instance1
ready: 1
size: 1
ready: 1
size: 1
state: ready
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 10
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

get_cr "cert-management-policy" \
| yq '.spec.tls.certManagementPolicy = "auto"' \
| yq '.spec.proxy.pgBouncer.replicas = 1' \
| yq '.spec.instances[].replicas = 1' \
| kubectl -n "$NAMESPACE" apply -f -
33 changes: 33 additions & 0 deletions e2e-tests/tests/cert-management-policy/02-save-secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 180
commands:
- script: |-
set -o errexit
set -o pipefail
set -o xtrace

source ../../functions

cluster="cert-management-policy"
instance=$(kubectl -n "$NAMESPACE" get statefulset \
-l postgres-operator.crunchydata.com/cluster="$cluster",postgres-operator.crunchydata.com/data=postgres \
-o jsonpath='{.items[0].metadata.name}')

kubectl -n "$NAMESPACE" get secret \
"${cluster}-cluster-ca-cert" \
"${cluster}-cluster-cert" \
"${cluster}-replication-cert" \
"${cluster}-pgbackrest" \
"${cluster}-pgbouncer" \
"${instance}-certs" \
-o yaml \
| yq eval 'del(
.metadata,
.items[].metadata.creationTimestamp,
.items[].metadata.managedFields,
.items[].metadata.ownerReferences,
.items[].metadata.resourceVersion,
.items[].metadata.uid
)' - \
>"$TEMP_DIR/tls-secrets.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 180
commands:
- script: |-
set -o errexit
set -o pipefail
set -o xtrace

source ../../functions

cluster="cert-management-policy"

kubectl -n "$NAMESPACE" delete perconapgcluster "$cluster" --wait=false
remove_all_finalizers
kubectl -n "$NAMESPACE" wait --for=delete "perconapgcluster/$cluster" --timeout=120s
kubectl -n "$NAMESPACE" wait --for=delete "postgrescluster/$cluster" --timeout=120s

kubectl -n "$NAMESPACE" delete pvc \
-l postgres-operator.crunchydata.com/cluster="$cluster" \
--ignore-not-found

kubectl -n "$NAMESPACE" delete secret \
-l postgres-operator.crunchydata.com/cluster="$cluster" \
--ignore-not-found
kubectl -n "$NAMESPACE" delete secret \
"${cluster}-cluster-ca-cert" \
"${cluster}-cluster-cert" \
"${cluster}-replication-cert" \
--ignore-not-found
19 changes: 19 additions & 0 deletions e2e-tests/tests/cert-management-policy/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 60
---
apiVersion: pgv2.percona.com/v2
kind: PerconaPGCluster
metadata:
name: cert-management-policy
status:
conditions:
- reason: PGBackRestRepoHostReady
status: "False"
type: ReadyForBackup
- reason: TLSSecretsMissing
status: "False"
type: TLSSecretsReady
- reason: Paused
status: "False"
type: Progressing
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
set -o errexit
set -o pipefail
set -o xtrace

source ../../functions

cluster="cert-management-policy"

get_cr "$cluster" \
| yq '.spec.tls.certManagementPolicy = "userProvidedOnly"' \
| yq '.spec.proxy.pgBouncer.replicas = 1' \
| yq '.spec.instances[].replicas = 1' \
| kubectl -n "$NAMESPACE" apply -f -
Loading
Loading