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 @@ -28731,6 +28731,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down
16 changes: 7 additions & 9 deletions cmd/postgres-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,6 @@ func main() {
)
assertNoError(err)

// Add Percona custom resource types to scheme
assertNoError(v2.AddToScheme(mgr.GetScheme()))

assertNoError(volumesnapshotv1.AddToScheme(mgr.GetScheme()))

// K8SPG-552
// Add Scheme for cert-manager resources like Issuer and Certificate.
assertNoError(certmanagerscheme.AddToScheme(mgr.GetScheme()))

// add all PostgreSQL Operator controllers to the runtime manager
err = addControllersToManager(ctx, mgr)
assertNoError(err)
Expand Down Expand Up @@ -363,6 +354,13 @@ func initManager(ctx context.Context) (runtime.Options, error) {
}
}

// add scheme
scheme := runtime.Scheme
assertNoError(v2.AddToScheme(scheme))
assertNoError(volumesnapshotv1.AddToScheme(scheme))
assertNoError(certmanagerscheme.AddToScheme(scheme))
options.Scheme = scheme

return options, nil
}

Expand Down
6 changes: 6 additions & 0 deletions cmd/postgres-operator/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (

"gotest.tools/v3/assert"
"gotest.tools/v3/assert/cmp"

"github.com/percona/percona-postgresql-operator/v2/internal/controller/runtime"
)

func TestInitManager(t *testing.T) {
Expand Down Expand Up @@ -42,6 +44,9 @@ func TestInitManager(t *testing.T) {
assert.Assert(t, options.RenewDeadline.Seconds() == 40)
assert.Assert(t, options.RetryPeriod.Seconds() == 10)

assert.Assert(t, options.Scheme == runtime.Scheme,
"expected the shared scheme to be configured before manager creation")

{
options.Cache.SyncPeriod = nil
options.Controller.GroupKindConcurrency = nil
Expand All @@ -51,6 +56,7 @@ func TestInitManager(t *testing.T) {
options.LeaseDuration = nil
options.RenewDeadline = nil
options.RetryPeriod = nil
options.Scheme = nil

assert.Assert(t, reflect.ValueOf(options).IsZero(),
"expected remaining fields to be unset:\n%+v", options)
Expand Down
19 changes: 19 additions & 0 deletions config/crd/bases/pgv2.percona.com_perconapgclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29429,6 +29429,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28709,6 +28709,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down
38 changes: 38 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29726,6 +29726,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down Expand Up @@ -66823,6 +66842,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down
4 changes: 4 additions & 0 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ spec:
# certValidityDuration: 2160h
# caValidityDuration: 26280h
# pgBackRestCertValidityDuration: 2160h
# issuerConf:
# name: some-selfsigned-issuer
# kind: ClusterIssuer
# group: cert-manager.io
# standby:
# enabled: true
# host: "<primary-ip>"
Expand Down
38 changes: 38 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29726,6 +29726,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down Expand Up @@ -66823,6 +66842,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down
38 changes: 38 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29726,6 +29726,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down Expand Up @@ -66823,6 +66842,25 @@ spec:
type: string
certValidityDuration:
type: string
issuerConf:
description: K8SPG-951
properties:
group:
description: |-
Group of the issuer being referred to.
Defaults to 'cert-manager.io'.
type: string
kind:
description: |-
Kind of the issuer being referred to.
Defaults to 'Issuer'.
type: string
name:
description: Name of the issuer being referred to.
type: string
required:
- name
type: object
pgBackRestCertValidityDuration:
type: string
type: object
Expand Down
5 changes: 5 additions & 0 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,11 @@ deploy_cert_manager() {
sleep 5
done

echo "Waiting for cert-manager mutating webhook to be ready..."
until kubectl get mutatingwebhookconfiguration cert-manager-webhook -o jsonpath='{.webhooks[0].clientConfig.caBundle}' | grep -q '[A-Za-z0-9+/=]'; do
sleep 5
done

echo "Waiting for cert-manager webhook service to have endpoints..."
until kubectl -n cert-manager get endpoints cert-manager-webhook -o jsonpath='{.subsets[*].addresses}' | grep -q '.'; do
sleep 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ commands:
kubectl -n "$NAMESPACE" delete pod -l postgres-operator.crunchydata.com/role=pgbouncer,postgres-operator.crunchydata.com/cluster=cert-manager-tls

wait_cluster_consistency cert-manager-tls
timeout: 120
timeout: 240
Loading
Loading