mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
feat: Adding ExtensionService health-check (#23576)
Signed-off-by: Solomon Kibret <solomon.kibret@gmail.com> Co-authored-by: Solomon Kibret <solomon.kibret@gmail.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
-- Status reporting information detailed here
|
||||
-- ExtensionService status conditions api information here: https://projectcontour.io/docs/v1.18.0/config/api/#projectcontour.io/v1alpha1.ExtensionServiceStatus
|
||||
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Waiting for status",
|
||||
}
|
||||
|
||||
if obj.status then
|
||||
if obj.status.conditions then
|
||||
for _, cond in ipairs(obj.status.conditions) do
|
||||
if obj.metadata.generation == cond.observedGeneration then -- This must match so that we don't report a resource as healthy even though its status is stale
|
||||
if cond.type == "Valid" and cond.status == "True" then -- Contour will update a single condition, Valid, that is in normal-true polarity.
|
||||
hs.status = "Healthy"
|
||||
hs.message = cond.message
|
||||
return hs
|
||||
elseif cond.type == "Valid" and cond.status == "False" then
|
||||
hs.status = "Degraded"
|
||||
hs.message = cond.message
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return hs
|
||||
@@ -0,0 +1,17 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "Valid ExtensionService"
|
||||
inputPath: testdata/healthy.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: 'Waiting for status'
|
||||
inputPath: testdata/progressing.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: 'At least one error present, see Errors for details'
|
||||
inputPath: testdata/degraded.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: 'Waiting for status'
|
||||
inputPath: testdata/generation.yaml
|
||||
30
resource_customizations/projectcontour.io/ExtensionService/testdata/degraded.yaml
vendored
Normal file
30
resource_customizations/projectcontour.io/ExtensionService/testdata/degraded.yaml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
apiVersion: projectcontour.io/v1alpha1
|
||||
kind: ExtensionService
|
||||
metadata:
|
||||
generation: 1
|
||||
name: example
|
||||
spec:
|
||||
circuitBreakerPolicy:
|
||||
maxConnections: 102400
|
||||
maxPendingRequests: 1024000
|
||||
maxRequests: 102400
|
||||
maxRetries: 102400
|
||||
protocol: h2c
|
||||
services:
|
||||
- name: doesnt-exist
|
||||
port: 9091
|
||||
timeoutPolicy:
|
||||
response: 1s
|
||||
status:
|
||||
conditions:
|
||||
- errors:
|
||||
- message: 'Spec.Routes unresolved service reference: service "doesnt-exist" not found'
|
||||
reason: ServiceUnresolvedReference
|
||||
status: "True"
|
||||
type: ServiceError
|
||||
lastTransitionTime: '2024-08-08T16:53:29Z'
|
||||
message: At least one error present, see Errors for details
|
||||
observedGeneration: 1
|
||||
reason: ErrorPresent
|
||||
status: 'False'
|
||||
type: Valid
|
||||
25
resource_customizations/projectcontour.io/ExtensionService/testdata/generation.yaml
vendored
Normal file
25
resource_customizations/projectcontour.io/ExtensionService/testdata/generation.yaml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
apiVersion: projectcontour.io/v1alpha1
|
||||
kind: ExtensionService
|
||||
metadata:
|
||||
generation: 2
|
||||
name: example
|
||||
spec:
|
||||
circuitBreakerPolicy:
|
||||
maxConnections: 102400
|
||||
maxPendingRequests: 1024000
|
||||
maxRequests: 102400
|
||||
maxRetries: 102400
|
||||
protocol: h2c
|
||||
services:
|
||||
- name: grpc-server
|
||||
port: 9091
|
||||
timeoutPolicy:
|
||||
response: 1s
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: '2024-08-08T16:53:29Z'
|
||||
message: Valid ExtensionService
|
||||
observedGeneration: 1
|
||||
reason: Valid
|
||||
status: 'True'
|
||||
type: Valid
|
||||
25
resource_customizations/projectcontour.io/ExtensionService/testdata/healthy.yaml
vendored
Normal file
25
resource_customizations/projectcontour.io/ExtensionService/testdata/healthy.yaml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
apiVersion: projectcontour.io/v1alpha1
|
||||
kind: ExtensionService
|
||||
metadata:
|
||||
generation: 1
|
||||
name: example
|
||||
spec:
|
||||
circuitBreakerPolicy:
|
||||
maxConnections: 102400
|
||||
maxPendingRequests: 1024000
|
||||
maxRequests: 102400
|
||||
maxRetries: 102400
|
||||
protocol: h2c
|
||||
services:
|
||||
- name: grpc-server
|
||||
port: 9091
|
||||
timeoutPolicy:
|
||||
response: 1s
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: '2024-08-08T16:53:29Z'
|
||||
message: Valid ExtensionService
|
||||
observedGeneration: 1
|
||||
reason: Valid
|
||||
status: 'True'
|
||||
type: Valid
|
||||
17
resource_customizations/projectcontour.io/ExtensionService/testdata/progressing.yaml
vendored
Normal file
17
resource_customizations/projectcontour.io/ExtensionService/testdata/progressing.yaml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: projectcontour.io/v1alpha1
|
||||
kind: ExtensionService
|
||||
metadata:
|
||||
generation: 1
|
||||
name: example
|
||||
spec:
|
||||
circuitBreakerPolicy:
|
||||
maxConnections: 102400
|
||||
maxPendingRequests: 1024000
|
||||
maxRequests: 102400
|
||||
maxRetries: 102400
|
||||
protocol: h2c
|
||||
services:
|
||||
- name: grpc-server
|
||||
port: 9091
|
||||
timeoutPolicy:
|
||||
response: 1s
|
||||
Reference in New Issue
Block a user