Skip to content

feat(opentelemetry-operator): auto detect presence of cert-manager CRDs#2021

Open
theSuess wants to merge 1 commit intoopen-telemetry:mainfrom
theSuess:feat/auto-detect-cert-manager
Open

feat(opentelemetry-operator): auto detect presence of cert-manager CRDs#2021
theSuess wants to merge 1 commit intoopen-telemetry:mainfrom
theSuess:feat/auto-detect-cert-manager

Conversation

@theSuess
Copy link
Copy Markdown
Contributor

@theSuess theSuess commented Jan 9, 2026

This PR adds a check for the presence of the cert-manager.io/v1 API in the target cluster. Using this approach, the helm chart can be installed without any customization in clusters without cert manager, simplifying the installation.

@@ -1,4 +1,4 @@
{{- if and .Values.admissionWebhooks.create .Values.admissionWebhooks.certManager.enabled }}
{{- if and .Values.admissionWebhooks.create .Values.admissionWebhooks.certManager.enabled (.Capabilities.APIVersions.Has "cert-manager.io/v1") }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

My concern here is that if the user says they want it:

admissionWebhooks:
  create: true
  certManager:
    enabled: true

But the CRDs haven't been installed, this will silently proceed with the installation but wont deploy these objects.

Before, it was ugly, but at least it would fail.

Would it be worth adding the else for the capabilities check and then use a fail block to print a message like "Cert manager requested, but the CRDs are not installed. Please install the crd and try again."?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Failing when the CRDs aren't available is a good approach as well, but I think this doesn't solve the original issue of install not working for everyone by default.

IMHO the default should be certManager.enabled=false since it isn't a hard requirement (or included in k8s) but I don't think we want to change the defaults here.

@cyrille-leclerc might have an opinion here as well

Copy link
Copy Markdown
Member

@cyrille-leclerc cyrille-leclerc Jan 13, 2026

Choose a reason for hiding this comment

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

i was wondering if we would introduce a preset like

certs-mode: use-existing-cert-manager | create-self-signed | auto-detect_if-crd-found-use-cert-manager_else-create-self-signed

would that resonate with you?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a good idea, and makes it much more explicit for the user to choose.

certificateSource: cert-manager | self-signed | prefer-cert-manager

re: certificateSource vs certs-mode, dashes in yaml keys are allowed, but a real pain in Helm templating context, because you have to use index.

I like the prefer-... logic because that matches other things in Kubernetes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you found much better names than me, I love it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm happy with this as well, will update this PR and ping here once implemented

@theSuess theSuess force-pushed the feat/auto-detect-cert-manager branch 2 times, most recently from dcd6976 to cefce71 Compare January 14, 2026 09:26
@theSuess
Copy link
Copy Markdown
Contributor Author

Updated this PR to use certificateSource with the possible values of:

  • prefer-cert-manager
  • cert-manager
  • helm-generated
  • self-signed
    to be very explicit about the choice

also added validation errors if CRDs are not available or self-signed is chosen but no files are provided

@theSuess
Copy link
Copy Markdown
Contributor Author

If this approach is good for everyone, I'll also update the docs

@cyrille-leclerc
Copy link
Copy Markdown
Member

cyrille-leclerc commented Jan 14, 2026

If I understand correctly, we would have the following developer experience:

TODAY

# TODAY - SELF SIGNED SETUP, discouraged in production
admissionWebhooks:
  ...
  certManager:
    enabled: false # Don't use cert-manager (default: true)
  autoGenerateCert:
    enabled: true # activate cert auto-generation (default: true)
    recreate: true # prevent self-signed certs trust problems that are frequent in dev  (default: true)
# TODAY - CERT MANAGER SETUP, recommended in production
admissionWebhooks:
  ...
  certManager:
    enabled: true #  (default: true)
    ... add more config if needed
  autoGenerateCert:
    enabled: false #  (default: true)

PR PROPOSAL

introduce

certificateSource: 'prefer-cert-manager', 'cert-manager', 'helm-generated', or 'self-signed'
# PR PROPOSAL - CERT MANAGER REQUIRED, recommended in production
admissionWebhooks:
  ...
  certificateSource: cert-manager # Require cert-manager
  certManager:
    ... add more config if needed
# PR PROPOSAL - CERT MANAGER PREFERED, FALL BACK TO SELF SIGNED, ok in production, great to get started
admissionWebhooks:
  ...
  certificateSource: prefer-cert-manager # use cert-manager if discovered during install, fallback to self signed
  certManager:
    ... add more config if needed
# PR PROPOSAL - SELF SIGNED, FALL BACK TO SELF SIGNED, discouraged in production
admissionWebhooks:
  ...
  certificateSource: self-signed # use self signed

I also have a question: what about the migration path? shouldn't we deprecated rather than immediately removing the entries in values.yaml ?

@theSuess
Copy link
Copy Markdown
Contributor Author

If we can come up with a good priority ordering, I'm fine with deprecating the fields instead, but the templating logic will grow a lot more complex

@cyrille-leclerc
Copy link
Copy Markdown
Member

cyrille-leclerc commented Jan 19, 2026

If we can come up with a good priority ordering, I'm fine with deprecating the fields instead

I would say that certificateSource has the priority when defined and otherwise, we honor admissionWebhooks/certManager/enabled and admissionWebhooks/autoGenerateCert/enabled.
WDYT?

but the templating logic will grow a lot more complex

Would the prioritization above make the logic as simple as possible to offer backward compatibility?

@theSuess
Copy link
Copy Markdown
Contributor Author

If I understand you correctly, this would make certificateSource optional. This would work and shouldn't be too complicated but in that case the default behavior would be the deprecated one which doesn't feel quite right.

As an alternative we can set certificateSource to cert-manager by default until the fields are removed. This effectively gives us the same behavior with stricter validation and better error messages

@cyrille-leclerc
Copy link
Copy Markdown
Member

If I understand you correctly, this would make certificateSource optional. This would work and shouldn't be too complicated but in that case the default behavior would be the deprecated one which doesn't feel quite right.

As an alternative we can set certificateSource to cert-manager by default until the fields are removed. This effectively gives us the same behavior with stricter validation and better error messages

You have a good point. I'm thinking of an incremental approach:

  • First, introduce certificateSource: null, recommending it while not deprecating the existing /certManager/enabled and /autoGenerateCert/enabled and make certificateSource overwrite /certManager/enabled and /autoGenerateCert/enabled when defined
  • Later, deprecate /certManager/enabled and /autoGenerateCert/enabled
  • Eventually remove /certManager/enabled and /autoGenerateCert/enabled, mking he helm deployment fail if one of them is defined, and define the default value for certificateSource: cert-manager as you rightfully suggested to be equivalent to the current setup or consider defaulting to prefer-cert-manager to be moe lenient.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 4, 2026

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 4, 2026
@theSuess theSuess marked this pull request as ready for review February 10, 2026 09:09
@theSuess theSuess requested review from a team, Allex1 and jvoravong as code owners February 10, 2026 09:09
@theSuess theSuess force-pushed the feat/auto-detect-cert-manager branch from cefce71 to ab8117d Compare February 10, 2026 09:10
@theSuess
Copy link
Copy Markdown
Contributor Author

Rebased on main and marked as ready for review. From the implementation side, the templates in this PR work but we still need to reach consensus on how this behavior can be best introduced in a backwards compatible way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants