Skip to content

Commit

Permalink
Implement Proclaim CRD health checks. (argoproj#12930)
Browse files Browse the repository at this point in the history
Signed-off-by: James Harris <contact@jamesharris.id.au>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
2 people authored and tesla59 committed Dec 16, 2023
1 parent fd70b9d commit aea393a
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
adopted = { status = "Unknown" }
advertised = { status = "Unknown" }
discovered = { status = "Unknown" }

if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, c in ipairs(obj.status.conditions) do
if c.type == "Adopted" then
adopted = c
elseif c.type == "Advertised" then
advertised = c
elseif c.type == "Discoverable" then
discovered = c
end
end
end
end

if adopted.status == "False" then
return { status = "Degraded", message = adopted.message }
elseif advertised.reason == "AdvertiseError" or advertised.reason == "UnadvertiseError" then
return { status = "Degraded", message = advertised.message }
elseif discovered.reason == "DiscoveryError" then
return { status = "Unknown", message = discovered.message }
elseif discovered.status == "True" then
return { status = "Healthy", message = discovered.message }
else
return { status = "Progressing", message = discovered.message }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
tests:
- healthStatus:
status: Healthy
message: DNS-SD browse and lookup results match the advertised DNS records
inputPath: testdata/healthy.yaml
- healthStatus:
status: Progressing
message: DNS-SD browse could not find this instance
inputPath: testdata/progressing_negativeBrowse.yaml
- healthStatus:
status: Progressing
message: DNS-SD lookup could not find this instance
inputPath: testdata/progressing_negativeLookup.yaml
- healthStatus:
status: Degraded
message: none of the configured providers can advertise on "example.org"
inputPath: testdata/degraded_notAdopted.yaml
- healthStatus:
status: Degraded
message: "<provider-specific error message>"
inputPath: testdata/degraded_advertiseError.yaml
- healthStatus:
status: Degraded
message: "<provider-specific error message>"
inputPath: testdata/degraded_unadvertiseError.yaml
- healthStatus:
status: Unknown
message: "<DNS configuration error message>"
inputPath: testdata/unknown_discoveryError.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: proclaim.dogmatiq.io/v1
kind: DNSSDServiceInstance
metadata:
creationTimestamp: "2023-03-20T01:47:37Z"
finalizers:
- proclaim.dogmatiq.io/unadvertise
generation: 2
name: test-instance
namespace: proclaim
resourceVersion: "308914"
uid: 991a66a3-9b7e-4515-9a41-f7513e9b7b33
spec:
instance:
attributes:
- baz: qux
flag: ""
foo: bar
- more: attrs
domain: example.org
name: test-instance
serviceType: _proclaim._tcp
targets:
- host: test.example.org
port: 8080
priority: 0
weight: 0
ttl: 1m0s
status:
conditions:
- lastTransitionTime: "2023-03-20T01:47:40Z"
message: "<provider-specific error message>"
observedGeneration: 2
reason: AdvertiseError
status: "False"
type: Advertised
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: proclaim.dogmatiq.io/v1
kind: DNSSDServiceInstance
metadata:
creationTimestamp: "2023-03-20T01:47:37Z"
finalizers:
- proclaim.dogmatiq.io/unadvertise
generation: 2
name: test-instance
namespace: proclaim
resourceVersion: "308914"
uid: 991a66a3-9b7e-4515-9a41-f7513e9b7b33
spec:
instance:
attributes:
- baz: qux
flag: ""
foo: bar
- more: attrs
domain: example.org
name: test-instance
serviceType: _proclaim._tcp
targets:
- host: test.example.org
port: 8080
priority: 0
weight: 0
ttl: 1m0s
status:
conditions:
- lastTransitionTime: "2023-03-20T01:47:40Z"
message: none of the configured providers can advertise on "example.org"
observedGeneration: 2
reason: InstanceIgnored
status: "False"
type: Adopted
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: proclaim.dogmatiq.io/v1
kind: DNSSDServiceInstance
metadata:
creationTimestamp: "2023-03-20T01:47:37Z"
finalizers:
- proclaim.dogmatiq.io/unadvertise
generation: 2
name: test-instance
namespace: proclaim
resourceVersion: "308914"
uid: 991a66a3-9b7e-4515-9a41-f7513e9b7b33
spec:
instance:
attributes:
- baz: qux
flag: ""
foo: bar
- more: attrs
domain: example.org
name: test-instance
serviceType: _proclaim._tcp
targets:
- host: test.example.org
port: 8080
priority: 0
weight: 0
ttl: 1m0s
status:
conditions:
- lastTransitionTime: "2023-03-20T01:47:40Z"
message: "<provider-specific error message>"
observedGeneration: 2
reason: UnadvertiseError
status: "False"
type: Advertised
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: proclaim.dogmatiq.io/v1
kind: DNSSDServiceInstance
metadata:
creationTimestamp: "2023-03-20T01:47:37Z"
finalizers:
- proclaim.dogmatiq.io/unadvertise
generation: 2
name: test-instance
namespace: proclaim
resourceVersion: "308914"
uid: 991a66a3-9b7e-4515-9a41-f7513e9b7b33
spec:
instance:
attributes:
- baz: qux
flag: ""
foo: bar
- more: attrs
domain: example.org
name: test-instance
serviceType: _proclaim._tcp
targets:
- host: test.example.org
port: 8080
priority: 0
weight: 0
ttl: 1m0s
status:
conditions:
- lastTransitionTime: "2023-03-20T01:47:40Z"
message: DNS-SD browse and lookup results match the advertised DNS records
observedGeneration: 2
reason: Discovered
status: "True"
type: Discoverable
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: proclaim.dogmatiq.io/v1
kind: DNSSDServiceInstance
metadata:
creationTimestamp: "2023-03-20T01:47:37Z"
finalizers:
- proclaim.dogmatiq.io/unadvertise
generation: 2
name: test-instance
namespace: proclaim
resourceVersion: "308914"
uid: 991a66a3-9b7e-4515-9a41-f7513e9b7b33
spec:
instance:
attributes:
- baz: qux
flag: ""
foo: bar
- more: attrs
domain: example.org
name: test-instance
serviceType: _proclaim._tcp
targets:
- host: test.example.org
port: 8080
priority: 0
weight: 0
ttl: 1m0s
status:
conditions:
- lastTransitionTime: "2023-03-20T01:47:40Z"
message: DNS-SD browse could not find this instance
observedGeneration: 2
reason: NegativeBrowseResult
status: "False"
type: Discoverable
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: proclaim.dogmatiq.io/v1
kind: DNSSDServiceInstance
metadata:
creationTimestamp: "2023-03-20T01:47:37Z"
finalizers:
- proclaim.dogmatiq.io/unadvertise
generation: 2
name: test-instance
namespace: proclaim
resourceVersion: "308914"
uid: 991a66a3-9b7e-4515-9a41-f7513e9b7b33
spec:
instance:
attributes:
- baz: qux
flag: ""
foo: bar
- more: attrs
domain: example.org
name: test-instance
serviceType: _proclaim._tcp
targets:
- host: test.example.org
port: 8080
priority: 0
weight: 0
ttl: 1m0s
status:
conditions:
- lastTransitionTime: "2023-03-20T01:47:40Z"
message: DNS-SD lookup could not find this instance
observedGeneration: 2
reason: NegativeLookupResult
status: "False"
type: Discoverable
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: proclaim.dogmatiq.io/v1
kind: DNSSDServiceInstance
metadata:
creationTimestamp: "2023-03-20T01:47:37Z"
finalizers:
- proclaim.dogmatiq.io/unadvertise
generation: 2
name: test-instance
namespace: proclaim
resourceVersion: "308914"
uid: 991a66a3-9b7e-4515-9a41-f7513e9b7b33
spec:
instance:
attributes:
- baz: qux
flag: ""
foo: bar
- more: attrs
domain: example.org
name: test-instance
serviceType: _proclaim._tcp
targets:
- host: test.example.org
port: 8080
priority: 0
weight: 0
ttl: 1m0s
status:
conditions:
- lastTransitionTime: "2023-03-20T01:47:40Z"
message: "<DNS configuration error message>"
observedGeneration: 2
reason: DiscoveryError
status: "Unknown"
type: Discoverable

0 comments on commit aea393a

Please sign in to comment.