Skip to content

Commit

Permalink
fix: cert-manager.io/certificate health.lua for consistent issuing (I…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
chr15murray authored and vladfr committed Dec 13, 2023
1 parent d7d8a4d commit 21e6c52
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then

-- Always Handle Issuing First to ensure consistent behaviour
for i, condition in ipairs(obj.status.conditions) do
if condition.type == "Issuing" and condition.status == "True" then
hs.status = "Progressing"
hs.message = condition.message
return hs
end
end

for i, condition in ipairs(obj.status.conditions) do
if condition.type == "Ready" and condition.status == "False" then
hs.status = "Degraded"
hs.message = condition.message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ tests:
status: Progressing
message: Issuing certificate as Secret does not exist
inputPath: testdata/progressing_issuing.yaml
- healthStatus:
status: Progressing
message: Issuing certificate as Secret does not exist
inputPath: testdata/progressing_issuing_last.yaml
- healthStatus:
status: Degraded
message: 'Resource validation failed: spec.acme.config: Required value: no ACME
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
creationTimestamp: '2018-11-07T00:06:12Z'
generation: 1
name: test-cert
namespace: argocd
resourceVersion: '64763033'
selfLink: /apis/cert-manager.io/v1alpha2/namespaces/argocd/certificates/test-cert
uid: e6cfba50-314d-11e9-be3f-42010a800011
spec:
acme:
config:
- domains:
- cd.apps.argoproj.io
http01:
ingress: http01
commonName: cd.apps.argoproj.io
dnsNames:
- cd.apps.argoproj.io
issuerRef:
kind: Issuer
name: argo-cd-issuer
secretName: test-secret
status:
conditions:
- lastTransitionTime: '2021-09-15T02:10:00Z'
message: Issuing certificate as Secret does not exist
reason: DoesNotExist
status: 'False'
type: Ready
- lastTransitionTime: '2021-09-15T02:10:00Z'
message: Issuing certificate as Secret does not exist
reason: DoesNotExist
status: 'True'
type: Issuing

0 comments on commit 21e6c52

Please sign in to comment.