Skip to content

CA cert already owned by another controller #1981

@dobesv

Description

@dobesv

Report

When trying to setup a new database using the controller, it gives an error creating the certificate. It hits the error "Object mongodb/stagingdb-ca-cert is already owned by another Certificate controller stagingdb-ca-cert"

More about the problem

The error comes from this line:

https://github.com/kubernetes-sigs/controller-runtime/blob/main/pkg/controller/controllerutil/controllerutil.go#L45

The error message:

TLS secrets handler: "create ssl by cert-manager: update cert mangager
        certs: failed to apply cert-manager certificates: failed to wait for ca
        cert: set controller reference: Object mongodb/stagingdb-ca-cert is
        already owned by another Certificate controller stagingdb-ca-cert".
        Please create your TLS secret stagingdb-ssl manually or setup
        cert-manager correctly

When cert-manager creates the secret it does set the Certificate as the controlling owner, it seems like when this operator is trying to also set the controller it gives this error.

Steps to reproduce

Try to set up a new mongodb cluster in a kubernetes cluster with cert-manager installed, and cert-manager has the option --enable-certificate-owner-ref=true. Note that this argument appears to be the default for kops created clusters.

Versions

  1. Kubernetes 1.30.12
  2. Operator 1.20.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions