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:
Ilya Gorban
2024-09-18 22:01:33 +03:00
committed by GitHub
parent 7d28c89f36
commit 2a199bc7ae
110 changed files with 2030 additions and 0 deletions

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gateway.solo.io/v1
kind: Gateway

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gateway.solo.io/v1
kind: MatchableHttpGateway

View 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

View 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

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gateway.solo.io/v1
kind: RouteOption

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gateway.solo.io/v1
kind: RouteTable

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gateway.solo.io/v1
kind: VirtualHostOption

View 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

View 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

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gateway.solo.io/v1
kind: VirtualService

View 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

View 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

View 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

View File

@@ -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

View 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

View File

@@ -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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gloo.solo.io/v1
kind: Proxy

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gloo.solo.io/v1
kind: Settings

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,2 @@
apiVersion: gloo.solo.io/v1
kind: Upstream

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

Some files were not shown because too many files have changed in this diff Show More