mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
feat(health): add healthchecks for Gloo resources (#11379)
* feat(custom healthchecks): add healthchecks for Gloo resources Signed-off-by: Ilya Gorban <zelig81@users.noreply.github.com> * fix(gloo custom healthchecks): fix healthcheck and add older cases Signed-off-by: Ilya Gorban <zelig81@users.noreply.github.com> * feat(custom healthchecks): fix tabulation in Gloo resources lua files Signed-off-by: Ilya Gorban <zelig81@users.noreply.github.com> --------- Signed-off-by: Ilya Gorban <zelig81@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
This commit is contained in:
54
resource_customizations/gateway.solo.io/Gateway/health.lua
Normal file
54
resource_customizations/gateway.solo.io/Gateway/health.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
14
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/Gateway/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
12
resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
12
resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
14
resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
13
resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
13
resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
13
resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
13
resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: Gateway
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
14
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: MatchableHttpGateway
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
14
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
12
resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
12
resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
14
resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
13
resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
13
resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
13
resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
13
resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteOption
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
14
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
12
resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
12
resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
14
resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
13
resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
13
resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
13
resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
13
resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: RouteTable
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
14
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualHostOption
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
14
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
14
resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
13
resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
13
resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gateway.solo.io/v1
|
||||
kind: VirtualService
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
54
resource_customizations/gloo.solo.io/Proxy/health.lua
Normal file
54
resource_customizations/gloo.solo.io/Proxy/health.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
37
resource_customizations/gloo.solo.io/Proxy/health_test.yaml
Normal file
37
resource_customizations/gloo.solo.io/Proxy/health_test.yaml
Normal file
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
14
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gloo.solo.io/Proxy/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
12
resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
12
resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
14
resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
13
resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
13
resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
13
resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
13
resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Proxy
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
54
resource_customizations/gloo.solo.io/Settings/health.lua
Normal file
54
resource_customizations/gloo.solo.io/Settings/health.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gloo.solo.io/Settings/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Settings/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gloo.solo.io/Settings/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gloo.solo.io/Settings/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
14
resource_customizations/gloo.solo.io/Settings/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Settings/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gloo.solo.io/Settings/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gloo.solo.io/Settings/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gloo.solo.io/Settings/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gloo.solo.io/Settings/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
12
resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
12
resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
14
resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
13
resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
13
resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
13
resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
13
resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Settings
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
54
resource_customizations/gloo.solo.io/Upstream/health.lua
Normal file
54
resource_customizations/gloo.solo.io/Upstream/health.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
@@ -0,0 +1,37 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for warning"
|
||||
inputPath: testdata/non-namespaced-gloo-warning.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "The resource has not yet been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-pending.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "The resource has been validated"
|
||||
inputPath: testdata/non-namespaced-gloo-accepted.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "message that will describe all the reasons for rejection"
|
||||
inputPath: testdata/non-namespaced-gloo-rejected.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/gloo-no-status.yaml
|
||||
14
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-accepted.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Accepted
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
2
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-no-status.yaml
vendored
Normal file
2
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-no-status.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
14
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: Pending
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Pending
|
||||
15
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-rejected.yaml
vendored
Normal file
15
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: Rejected
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Rejected
|
||||
15
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-warning.yaml
vendored
Normal file
15
resource_customizations/gloo.solo.io/Upstream/testdata/gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: Warning
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Accepted
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: Warning
|
||||
12
resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
12
resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-accepted.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
status:
|
||||
reportedBy: gateway
|
||||
state: 1
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
14
resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
14
resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-pending.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
status:
|
||||
statuses:
|
||||
gloo-system:
|
||||
reportedBy: gateway
|
||||
state: 0
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 0
|
||||
13
resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
13
resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-rejected.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
status:
|
||||
reason: "message that will describe all the reasons for rejection"
|
||||
reportedBy: gateway
|
||||
state: 2
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 2
|
||||
13
resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
13
resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-warning.yaml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: gloo.solo.io/v1
|
||||
kind: Upstream
|
||||
status:
|
||||
reason: "message that will describe all the reasons for warning"
|
||||
reportedBy: gateway
|
||||
state: 3
|
||||
subresourceStatuses:
|
||||
'*v1.Proxy.gateway-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 1
|
||||
'*v1.Proxy.internal-proxy_gloo-system':
|
||||
reportedBy: gloo
|
||||
state: 3
|
||||
@@ -0,0 +1,54 @@
|
||||
hs = {
|
||||
status = "Progressing",
|
||||
message = "Update in progress"
|
||||
}
|
||||
|
||||
function getStatus(status)
|
||||
-- Accepted
|
||||
if status.state == "Accepted" or status.state == 1 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "The resource has been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Warning
|
||||
if status.state == "Warning" or status.state == 3 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Pending
|
||||
if status.state == "Pending" or status.state == 0 then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "The resource has not yet been validated"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- Rejected
|
||||
if status.state == "Rejected" or status.state == 2 then
|
||||
hs.status = "Degraded"
|
||||
hs.message = status.reason
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status ~= nil then
|
||||
-- Namespaced version of status
|
||||
if obj.status.statuses ~= nil then
|
||||
for i, namespace in pairs(obj.status.statuses) do
|
||||
hs = getStatus(namespace)
|
||||
if hs.status ~= "Progressing" then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Older non-namespaced version of status
|
||||
if obj.status.state ~= nil then
|
||||
hs = getStatus(obj.status)
|
||||
end
|
||||
end
|
||||
return hs
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user