Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cert-manager.io/certificate health.lua for consistent issuing (Issue #16523) #16520

Merged
merged 3 commits into from
Dec 4, 2023

Conversation

chr15murray
Copy link
Contributor

@chr15murray chr15murray commented Dec 4, 2023

Fixes [ISSUE #16523]

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

The health of a cert-manager.io/certificate is not always consistent within ArgoCD when Issuing and Ready states both exist. This occurs because the Ready: False state may come first or second in the status conditions.

Example Degraded

status:
  conditions:
    - lastTransitionTime: '2023-12-01T11:15:28Z'
      message: Issuing certificate as Secret does not exist
      observedGeneration: 1
      reason: DoesNotExist
      status: 'False'
      type: Ready
    - lastTransitionTime: '2023-12-01T11:15:28Z'
      message: Issuing certificate as Secret does not exist
      observedGeneration: 1
      reason: DoesNotExist
      status: 'True'
      type: Issuing
  nextPrivateKeySecretName: certtest-81-vg977

Example Issuing

status:
  conditions:
    - lastTransitionTime: '2023-12-01T11:15:28Z'
      message: Issuing certificate as Secret does not exist
      observedGeneration: 1
      reason: DoesNotExist
      status: 'True'
      type: Issuing
    - lastTransitionTime: '2023-12-01T11:15:28Z'
      message: Issuing certificate as Secret does not exist
      observedGeneration: 1
      reason: DoesNotExist
      status: 'False'
      type: Ready
  nextPrivateKeySecretName: certtest-82-f4r27

This PR checks for Issuing first and places the resource health into 'Progressing' state if True before considering the Ready status.

I've also add a new test case for this. With the previous health check that test case would be in a Degraded state.

@chr15murray chr15murray requested a review from a team as a code owner December 4, 2023 13:31
Copy link

codecov bot commented Dec 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7408292) 49.49% compared to head (b2bf6b3) 49.49%.

❗ Current head b2bf6b3 differs from pull request most recent head 49129c7. Consider uploading reports for the commit 49129c7 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #16520   +/-   ##
=======================================
  Coverage   49.49%   49.49%           
=======================================
  Files         270      270           
  Lines       47485    47485           
=======================================
+ Hits        23501    23502    +1     
+ Misses      21673    21672    -1     
  Partials     2311     2311           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chr15murray chr15murray changed the title fix: cert-manager.io/certificate health.lua for consistent issuing fix: cert-manager.io/certificate health.lua for consistent issuing (Issue #16523) Dec 4, 2023
Signed-off-by: Chris Murray <[email protected]>
Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

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

Thanks @chr15murray!! LGTM!!

@ishitasequeira ishitasequeira merged commit 8886874 into argoproj:master Dec 4, 2023
24 checks passed
vladfr pushed a commit to vladfr/argo-cd that referenced this pull request Dec 13, 2023
…ssue argoproj#16523) (argoproj#16520)

* Update cert-manager.opcertificate health.lua

Signed-off-by: Chris Murray <[email protected]>

* adding test case for cert issuing

Signed-off-by: Chris Murray <[email protected]>

* fixing typo

Signed-off-by: Chris Murray <[email protected]>

---------

Signed-off-by: Chris Murray <[email protected]>
tesla59 pushed a commit to tesla59/argo-cd that referenced this pull request Dec 16, 2023
…ssue argoproj#16523) (argoproj#16520)

* Update cert-manager.opcertificate health.lua

Signed-off-by: Chris Murray <[email protected]>

* adding test case for cert issuing

Signed-off-by: Chris Murray <[email protected]>

* fixing typo

Signed-off-by: Chris Murray <[email protected]>

---------

Signed-off-by: Chris Murray <[email protected]>
JulienFuix pushed a commit to JulienFuix/argo-cd that referenced this pull request Feb 6, 2024
…ssue argoproj#16523) (argoproj#16520)

* Update cert-manager.opcertificate health.lua

Signed-off-by: Chris Murray <[email protected]>

* adding test case for cert issuing

Signed-off-by: Chris Murray <[email protected]>

* fixing typo

Signed-off-by: Chris Murray <[email protected]>

---------

Signed-off-by: Chris Murray <[email protected]>
lyda pushed a commit to lyda/argo-cd that referenced this pull request Mar 28, 2024
…ssue argoproj#16523) (argoproj#16520)

* Update cert-manager.opcertificate health.lua

Signed-off-by: Chris Murray <[email protected]>

* adding test case for cert issuing

Signed-off-by: Chris Murray <[email protected]>

* fixing typo

Signed-off-by: Chris Murray <[email protected]>

---------

Signed-off-by: Chris Murray <[email protected]>
Signed-off-by: Kevin Lyda <[email protected]>
@cyrus-mc
Copy link

With this change, certificates always show as "Progressing". Given that it loops over all status first, looking for type Issuing and bailing if found, it never sees the status indicating that the certificate was renewed.

As an example, here is the status field

status:
  conditions:
  - lastTransitionTime: "2024-04-09T23:38:04Z"
    message: Certificate is up to date and has not expired
    observedGeneration: 1
    reason: Ready
    status: "True"
    type: Ready
  - lastTransitionTime: "2024-06-08T22:38:03Z"
    message: Renewing certificate as renewal was scheduled at 2024-06-08 22:38:03
      +0000 UTC
    observedGeneration: 1
    reason: Renewing
    status: "True"
    type: Issuing

The certificate renewal was issued, but the logic will see the second status and set the status to Progressing.

@crenshaw-dev
Copy link
Member

@cyrus-mc can you open an issue?

@cyrus-mc
Copy link

@crenshaw-dev Issue created.

Hariharasuthan99 pushed a commit to AmadeusITGroup/argo-cd that referenced this pull request Jun 16, 2024
…ssue argoproj#16523) (argoproj#16520)

* Update cert-manager.opcertificate health.lua

Signed-off-by: Chris Murray <[email protected]>

* adding test case for cert issuing

Signed-off-by: Chris Murray <[email protected]>

* fixing typo

Signed-off-by: Chris Murray <[email protected]>

---------

Signed-off-by: Chris Murray <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants