forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Proclaim CRD health checks. (argoproj#12930)
Signed-off-by: James Harris <contact@jamesharris.id.au> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
303 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
resource_customizations/proclaim.dogmatiq.io/DNSSDServiceInstance/health.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
29 changes: 29 additions & 0 deletions
29
resource_customizations/proclaim.dogmatiq.io/DNSSDServiceInstance/health_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
35 changes: 35 additions & 0 deletions
35
...mizations/proclaim.dogmatiq.io/DNSSDServiceInstance/testdata/degraded_advertiseError.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
35 changes: 35 additions & 0 deletions
35
...ustomizations/proclaim.dogmatiq.io/DNSSDServiceInstance/testdata/degraded_notAdopted.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
35 changes: 35 additions & 0 deletions
35
...zations/proclaim.dogmatiq.io/DNSSDServiceInstance/testdata/degraded_unadvertiseError.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
35 changes: 35 additions & 0 deletions
35
resource_customizations/proclaim.dogmatiq.io/DNSSDServiceInstance/testdata/healthy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
35 changes: 35 additions & 0 deletions
35
...ations/proclaim.dogmatiq.io/DNSSDServiceInstance/testdata/progressing_negativeBrowse.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
35 changes: 35 additions & 0 deletions
35
...ations/proclaim.dogmatiq.io/DNSSDServiceInstance/testdata/progressing_negativeLookup.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
35 changes: 35 additions & 0 deletions
35
...omizations/proclaim.dogmatiq.io/DNSSDServiceInstance/testdata/unknown_discoveryError.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |