Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c05fe9b
K8SPG-552 cert manager integration
gkech Jul 14, 2025
6c0ede4
Merge branch 'main' into K8SPG-552
gkech Jan 20, 2026
c90c647
fixes after merge
gkech Jan 20, 2026
b2bd035
Merge branch 'main' into K8SPG-552
gkech Jan 26, 2026
26a1c09
fixes
gkech Jan 26, 2026
1fe470d
fixes on the cert config
gkech Jan 27, 2026
3e3eced
fixes
gkech Feb 9, 2026
588d072
Merge branch 'main' into K8SPG-552
gkech Feb 9, 2026
c52f614
fix e2e tst
gkech Feb 9, 2026
af82d00
fix tests
gkech Feb 10, 2026
8739256
add check for restconfig
gkech Feb 10, 2026
869cf5c
add unit tests for certmanager
gkech Feb 10, 2026
7bc0e97
imports and cert manager lib version fix
gkech Feb 10, 2026
4c8d2b7
revert cert manager version env
gkech Feb 10, 2026
15fa04f
Merge branch 'main' into K8SPG-552
gkech Feb 10, 2026
9dcf232
regenerate go mod and sum
gkech Feb 10, 2026
953f9f3
fix controller runtime
gkech Feb 10, 2026
3209dce
add RotationPolicyNever
gkech Feb 11, 2026
60e810d
cr: get certs before trying to create them
gkech Feb 12, 2026
bd87737
expose configuration for cert manager / tls
gkech Feb 12, 2026
7909645
fix test clause
gkech Feb 13, 2026
5437d32
Merge branch 'main' into K8SPG-552
gkech Feb 13, 2026
1516f83
fix errors from conflicts
gkech Feb 13, 2026
578c453
Update percona/certmanager/certmanager_test.go
gkech Feb 13, 2026
924dcbc
cr: remove log and remove already exists handling which is not trigge…
gkech Feb 13, 2026
49fefce
Merge branch 'main' into K8SPG-552
gkech Feb 16, 2026
8d8fb20
fix namespaces for issuer and cert location - always match cluster
gkech Feb 17, 2026
012f4c6
fix unit tests
gkech Feb 17, 2026
7c9ab2b
fix e2e test
gkech Feb 17, 2026
1de1251
Merge branch 'main' into K8SPG-552
gkech Feb 18, 2026
842853f
Merge branch 'main' into K8SPG-552
gkech Feb 19, 2026
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 @@ -22234,6 +22234,13 @@ spec:
format: int64
type: integer
type: array
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
userInterface:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21721,6 +21721,13 @@ spec:
pattern: ^repo[1-4]
type: string
type: object
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
unmanaged:
Expand Down
19 changes: 14 additions & 5 deletions cmd/postgres-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"

certmanagerscheme "github.com/cert-manager/cert-manager/pkg/client/clientset/versioned/scheme"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[goimports-reviser] reported by reviewdog 🐶

Suggested change
certmanagerscheme "github.com/cert-manager/cert-manager/pkg/client/clientset/versioned/scheme"

"github.com/percona/percona-postgresql-operator/v2/internal/controller/pgupgrade"
"github.com/percona/percona-postgresql-operator/v2/internal/controller/postgrescluster"
"github.com/percona/percona-postgresql-operator/v2/internal/controller/runtime"
Expand All @@ -38,6 +39,7 @@
"github.com/percona/percona-postgresql-operator/v2/internal/logging"
"github.com/percona/percona-postgresql-operator/v2/internal/naming"
"github.com/percona/percona-postgresql-operator/v2/internal/upgradecheck"
"github.com/percona/percona-postgresql-operator/v2/percona/certmanager"
perconaController "github.com/percona/percona-postgresql-operator/v2/percona/controller"
"github.com/percona/percona-postgresql-operator/v2/percona/controller/pgbackup"
"github.com/percona/percona-postgresql-operator/v2/percona/controller/pgcluster"
Expand Down Expand Up @@ -129,6 +131,10 @@

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 All @@ -154,11 +160,14 @@
os.Setenv("REGISTRATION_REQUIRED", "false")

r := &postgrescluster.Reconciler{
Client: mgr.GetClient(),
Owner: postgrescluster.ControllerName,
Recorder: mgr.GetEventRecorderFor(postgrescluster.ControllerName),
Tracer: otel.Tracer(postgrescluster.ControllerName),
IsOpenShift: isOpenshift(ctx, mgr.GetConfig()),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Owner: postgrescluster.ControllerName,
Recorder: mgr.GetEventRecorderFor(postgrescluster.ControllerName),

Check failure on line 166 in cmd/postgres-operator/main.go

View workflow job for this annotation

GitHub Actions / runner / suggester / golangci-lint

SA1019: mgr.GetEventRecorderFor is deprecated: this uses the old events API and will be removed in a future release. Please use GetEventRecorder instead. (staticcheck)
Tracer: otel.Tracer(postgrescluster.ControllerName),
IsOpenShift: isOpenshift(ctx, mgr.GetConfig()),
CertManagerCtrlFunc: certmanager.NewController,
RestConfig: mgr.GetConfig(),
}
cm := &perconaController.CustomManager{Manager: mgr}
if err := r.SetupWithManager(cm); err != nil {
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/pgv2.percona.com_perconapgclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22360,6 +22360,13 @@ spec:
pattern: ^repo[1-4]
type: string
type: object
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
unmanaged:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22145,6 +22145,13 @@ spec:
minimum: 1
type: integer
type: array
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
userInterface:
Expand Down
16 changes: 16 additions & 0 deletions config/rbac/cluster/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ rules:
- patch
- update
- watch
- apiGroups:
- cert-manager.io
- certmanager.k8s.io
resources:
- certificaterequests
- certificates
- issuers
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
16 changes: 16 additions & 0 deletions config/rbac/namespace/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ rules:
- patch
- update
- watch
- apiGroups:
- cert-manager.io
- certmanager.k8s.io
resources:
- certificaterequests
- certificates
- issuers
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
30 changes: 30 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22657,6 +22657,13 @@ spec:
pattern: ^repo[1-4]
type: string
type: object
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
unmanaged:
Expand Down Expand Up @@ -53187,6 +53194,13 @@ spec:
minimum: 1
type: integer
type: array
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
userInterface:
Expand Down Expand Up @@ -55734,6 +55748,22 @@ rules:
- patch
- update
- watch
- apiGroups:
- cert-manager.io
- certmanager.k8s.io
resources:
- certificaterequests
- certificates
- issuers
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
4 changes: 3 additions & 1 deletion deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ spec:
# customReplicationTLSSecret:
# name: replication1-cert
# tlsOnly: false

# tls:
# certValidityDuration: 2160h
# caValidityDuration: 26280h
# standby:
# enabled: true
# host: "<primary-ip>"
Expand Down
14 changes: 14 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22657,6 +22657,13 @@ spec:
pattern: ^repo[1-4]
type: string
type: object
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
unmanaged:
Expand Down Expand Up @@ -53187,6 +53194,13 @@ spec:
minimum: 1
type: integer
type: array
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
userInterface:
Expand Down
30 changes: 30 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22657,6 +22657,13 @@ spec:
pattern: ^repo[1-4]
type: string
type: object
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
unmanaged:
Expand Down Expand Up @@ -53187,6 +53194,13 @@ spec:
minimum: 1
type: integer
type: array
tls:
properties:
caValidityDuration:
type: string
certValidityDuration:
type: string
type: object
tlsOnly:
type: boolean
userInterface:
Expand Down Expand Up @@ -55734,6 +55748,22 @@ rules:
- patch
- update
- watch
- apiGroups:
- cert-manager.io
- certmanager.k8s.io
resources:
- certificaterequests
- certificates
- issuers
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
16 changes: 16 additions & 0 deletions deploy/cw-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ rules:
- patch
- update
- watch
- apiGroups:
- cert-manager.io
- certmanager.k8s.io
resources:
- certificaterequests
- certificates
- issuers
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
16 changes: 16 additions & 0 deletions deploy/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ rules:
- patch
- update
- watch
- apiGroups:
- cert-manager.io
- certmanager.k8s.io
resources:
- certificaterequests
- certificates
- issuers
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/run-pr.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
backup-enable-disable
builtin-extensions
cert-manager-tls
custom-envs
custom-extensions
custom-tls
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/run-release.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
backup-enable-disable
builtin-extensions
cert-manager-tls
custom-envs
custom-extensions
custom-tls
Expand Down
24 changes: 24 additions & 0 deletions e2e-tests/tests/cert-manager-tls/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
14 changes: 14 additions & 0 deletions e2e-tests/tests/cert-manager-tls/00-deploy-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 10
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions
init_temp_dir # do this only in the first TestStep

deploy_cert_manager
deploy_operator
deploy_client
Loading
Loading