Skip to content

add dns issuer secrets validation before marking it as ready - #8255

Merged
cert-manager-prow[bot] merged 3 commits into
cert-manager:masterfrom
Peac36:fix/7826
May 3, 2026
Merged

cert-manager-prow[bot] merged 3 commits into
cert-manager:masterfrom
Peac36:fix/7826

Conversation

@Peac36

@Peac36 Peac36 commented Nov 16, 2025 •

Copy link
Copy Markdown
Contributor

Pull Request Motivation

The ACME DNS issuer is marked as ready, although the solver's secret is missing or the secret key does not exist. This is misleading because without a valid solver's secret, the issuer's challenges would never be processed. To avoid this, this PR adds validation and error messages that indicate that there is missing info to complete the whole flow of issuing a certificate

  status:
    conditions:
    - lastTransitionTime: "2025-11-16T14:48:17Z"
      message: the secret "acme-dns" does not have key "acmedns.json"
      observedGeneration: 1
      reason: InvalidSolver
      status: "False"
      type: Ready
  status:
    acme: {}
    conditions:
    - lastTransitionTime: "2025-11-16T14:44:54Z"
      message: 'failed to get secret "acme-dns": secrets "acme-dns" not found'
      observedGeneration: 1
      reason: InvalidSolver
      status: "False"
      type: Ready

Fix: #7826

Kind

/bug

Release Note

add dns issuer secrets validation before marking it as ready

Steps for testing.

Scenario: 1 - missing secret

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: example-issuer123
spec:
  acme:
    server: https://acme-staging-v02.api.letsencrypt123.org/directory
    privateKeySecretRef:
      name: example-issuer-account-key
    solvers:
    - dns01:
        acmeDNS:
          host: test1.example.com
          accountSecretRef:
            name: missing-secret
            key: "key"

Scenation 2 - missing key

apiVersion: v1
data:
  secret: c2VjZXJ0
kind: Secret
metadata:
  creationTimestamp: null
  name: acme-secret

---


apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: example-issuer1234
spec:
  acme:
    server: https://acme-staging-v02.api.letsencrypt123.org/directory
    privateKeySecretRef:
      name: example-issuer-account-key
    solvers:
    - dns01:
        acmeDNS:
          host: test2.example.com
          accountSecretRef:
            name: acme-secret
            key: "key"

@cert-manager-prow cert-manager-prow Bot added dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. release-note Denotes a PR that will be considered when it comes time to generate release notes. area/acme Indicates a PR directly modifies the ACME Issuer code area/testing Issues relating to testing needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Nov 16, 2025
@cert-manager-prow

Copy link
Copy Markdown
Contributor

Hi @Peac36. Thanks for your PR.

I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@cert-manager-prow cert-manager-prow Bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 16, 2025
@cert-manager-prow cert-manager-prow Bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. and removed dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Nov 16, 2025
@erikgb

erikgb commented Nov 22, 2025

Copy link
Copy Markdown
Member

/ok-to-test

@cert-manager-prow cert-manager-prow Bot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 22, 2025
@Peac36

Peac36 commented Nov 23, 2025

Copy link
Copy Markdown
Contributor Author

/retest

Comment thread pkg/issuer/acme/setup.go Outdated
}

if s.Key != "" {
if _, ok := res.StringData[s.Key]; !ok {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Discussed with @Peac36 in the cert-manager weekly meeting 18 Dec 2025.
We agree that .Data is probably the correct field, but note that the E2E tests do pass even when using the StringData field, contrary to what the API docs say.

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.

@hjoshi123 , @wallrj-cyberark - Thanks for the feedback. I've addressed this comment.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for incorporating the changes @Peac36!

@hjoshi123

Copy link
Copy Markdown
Collaborator

/lgtm

@cert-manager-prow cert-manager-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Dec 22, 2025
@hjoshi123

Copy link
Copy Markdown
Collaborator

/kind bug

@cert-manager-prow cert-manager-prow Bot added kind/bug Categorizes issue or PR as related to a bug. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Dec 23, 2025
@Peac36

Peac36 commented Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

@hjoshi123 - What do we wait to get this merged? Would you like me to address something else?

@hjoshi123

Copy link
Copy Markdown
Collaborator

/test pull-cert-manager-master-e2e-v1-35

Comment thread pkg/issuer/acme/setup.go Resolved
Comment thread pkg/issuer/acme/setup.go Resolved
Comment thread pkg/issuer/acme/setup_test.go Resolved
@cert-manager-prow cert-manager-prow Bot added dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. and removed lgtm Indicates that a PR is ready to be merged. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 21, 2026
@Peac36

Peac36 commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

@hjoshi123 - I've fixed the raised issues. Yes, I've tested it locally -
Screenshot From 2026-05-03 16-31-43

@hjoshi123

Copy link
Copy Markdown
Collaborator

/lgtm
/approve

@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hjoshi123

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels May 3, 2026
@cert-manager-prow
cert-manager-prow Bot merged commit 9e84cd2 into cert-manager:master May 3, 2026
@gecube

gecube commented May 4, 2026

Copy link
Copy Markdown

Good day,

Thank you for the work on this — it’s greatly appreciated.
I have a follow-up question regarding the behavior of the system in the following scenario:

  1. A secret is created
  2. An Issuer referencing this secret is created
  3. The secret is valid, and the Issuer reaches the Ready state
  4. The secret is then deleted, or the credentials within it expire

In this case, should the Issuer transition to a non-ready state as soon as possible?
Thank you in advance for the clarification.

@wallrj-cyberark

Copy link
Copy Markdown
Member

📢 The fix or feature is now available for testing

Please test and report back.

eleboucher pushed a commit to eleboucher/homelab that referenced this pull request Jul 9, 2026