Skip to content

Commit f0daa58

Browse files
committed
fix owner references for ca cert
1 parent 5c8d2a9 commit f0daa58

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

  • internal/controller/postgrescluster

internal/controller/postgrescluster/pki.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ func (r *Reconciler) reconcileRootCertificate(
133133
}
134134
intent.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind("Secret"))
135135
intent.Data = make(map[string][]byte)
136-
intent.ObjectMeta.OwnerReferences = existing.ObjectMeta.OwnerReferences
137136

138137
if cluster.Labels != nil {
139138
currVersion, err := gover.NewVersion(cluster.Labels[naming.LabelVersion])
@@ -143,17 +142,8 @@ func (r *Reconciler) reconcileRootCertificate(
143142
}
144143
}
145144

146-
// A root secret is scoped to the namespace where postgrescluster(s)
147-
// are deployed. For operator deployments with postgresclusters in more than
148-
// one namespace, there will be one root per namespace.
149-
// During reconciliation, the owner reference block of the root secret is
150-
// updated to include the postgrescluster as an owner.
151-
// However, unlike the leaf certificate, the postgrescluster will not be
152-
// set as the controller. This allows for multiple owners to guide garbage
153-
// collection, but avoids any errors related to setting multiple controllers.
154-
// https://docs.k8s.io/concepts/workloads/controllers/garbage-collection/#owners-and-dependents
155145
if err == nil {
156-
err = errors.WithStack(r.setOwnerReference(cluster, intent))
146+
err = errors.WithStack(r.setControllerReference(cluster, intent))
157147
}
158148
if err == nil {
159149
intent.Data[keyCertificate], err = root.Certificate.MarshalText()

0 commit comments

Comments
 (0)