From 7f417e2be4b68acb3b5ef04cea59158bc7d6ee68 Mon Sep 17 00:00:00 2001 From: pasha-codefresh Date: Wed, 18 Sep 2024 21:56:05 +0300 Subject: [PATCH 01/10] fix notificaion controller crash loop (#19984) Signed-off-by: pashakostohrys --- cmd/argocd-notification/commands/controller.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/argocd-notification/commands/controller.go b/cmd/argocd-notification/commands/controller.go index 7674a1726e10b..7245a0b75a667 100644 --- a/cmd/argocd-notification/commands/controller.go +++ b/cmd/argocd-notification/commands/controller.go @@ -163,6 +163,7 @@ func NewCommand() *cobra.Command { }() go ctrl.Run(ctx, processorsCount) + <-ctx.Done() return nil }, } From 7d28c89f36313f016a9c6279b014357ccf8dd420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Aguilar-Tablada=20Espinosa?= Date: Wed, 18 Sep 2024 20:57:28 +0200 Subject: [PATCH 02/10] feat(health): resource customization for RabbitMQCluster (#15286) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Aguilar Co-authored-by: Blake Pettersson --- .../rabbitmq.com/RabbitmqCluster/health.lua | 53 +++++++++++++++++++ .../RabbitmqCluster/health_test.yaml | 29 ++++++++++ .../testdata/degraded_badconfig.yaml | 31 +++++++++++ .../testdata/degraded_cluster_unknown.yaml | 44 +++++++++++++++ .../testdata/degraded_replicas_unknown.yaml | 44 +++++++++++++++ .../RabbitmqCluster/testdata/healthy.yaml | 42 +++++++++++++++ .../progressing_cluster_unavailable.yaml | 44 +++++++++++++++ .../testdata/progressing_no_status.yaml | 23 ++++++++ .../testdata/progressing_pods_not_ready.yaml | 43 +++++++++++++++ 9 files changed, 353 insertions(+) create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/health.lua create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/health_test.yaml create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_badconfig.yaml create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_cluster_unknown.yaml create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_replicas_unknown.yaml create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/healthy.yaml create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_cluster_unavailable.yaml create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_no_status.yaml create mode 100644 resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_pods_not_ready.yaml diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/health.lua b/resource_customizations/rabbitmq.com/RabbitmqCluster/health.lua new file mode 100644 index 0000000000000..22916ad6f84cd --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/health.lua @@ -0,0 +1,53 @@ +hs = {} +clusterAvailable = {} +allReplicasReady = {} + +if obj.status ~= nil then + if obj.status.conditions ~= nil then + + for i, condition in ipairs(obj.status.conditions) do + if condition.type == "ReconcileSuccess" and condition.status == "False" then + hs.status = "Degraded" + hs.message = condition.message + return hs + end + if condition.type == "ClusterAvailable" then + clusterAvailable.status = condition.status + clusterAvailable.message = condition.message + end + if condition.type == "AllReplicasReady" then + allReplicasReady.status = condition.status + allReplicasReady.message = condition.message + end + end + + if clusterAvailable.status == "Unknown" or allReplicasReady.status == "Unknown" then + hs.status = "Degraded" + hs.message = "No statefulset or endpoints found" + return hs + end + + if clusterAvailable.status == "False" then + hs.status = "Progressing" + hs.message = "Waiting for RabbitMQ cluster formation" + return hs + end + + if allReplicasReady.status == "False" then + hs.status = "Progressing" + hs.message = "Waiting for RabbitMQ instances ready" + return hs + end + + if clusterAvailable.status == "True" and allReplicasReady.status == "True" then + hs.status = "Healthy" + hs.message = "RabbitMQ cluster ready" + return hs + end + + end +end + +hs.status = "Progressing" +hs.message = "Waiting for RabbitMQ Operator" +return hs \ No newline at end of file diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/health_test.yaml b/resource_customizations/rabbitmq.com/RabbitmqCluster/health_test.yaml new file mode 100644 index 0000000000000..7e7c44e4b57ce --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/health_test.yaml @@ -0,0 +1,29 @@ +tests: +- healthStatus: + status: Degraded + message: Unknown 'foo' parameter + inputPath: testdata/degraded_badconfig.yaml +- healthStatus: + status: Degraded + message: No statefulset or endpoints found + inputPath: testdata/degraded_cluster_unknown.yaml +- healthStatus: + status: Degraded + message: No statefulset or endpoints found + inputPath: testdata/degraded_replicas_unknown.yaml +- healthStatus: + status: Progressing + message: Waiting for RabbitMQ Operator + inputPath: testdata/progressing_no_status.yaml +- healthStatus: + status: Progressing + message: Waiting for RabbitMQ cluster formation + inputPath: testdata/progressing_cluster_unavailable.yaml +- healthStatus: + status: Progressing + message: Waiting for RabbitMQ instances ready + inputPath: testdata/progressing_pods_not_ready.yaml +- healthStatus: + status: Healthy + message: RabbitMQ cluster ready + inputPath: testdata/healthy.yaml \ No newline at end of file diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_badconfig.yaml b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_badconfig.yaml new file mode 100644 index 0000000000000..29b03cb406ccb --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_badconfig.yaml @@ -0,0 +1,31 @@ +apiVersion: rabbitmq.com/v1beta1 +kind: RabbitmqCluster +metadata: + labels: + app: example-rabbitmq + name: example-rabbitmq + namespace: example +spec: + image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8 + persistence: + storage: 32Gi + storageClassName: default + rabbitmq: + replicas: 3 + resources: + limits: + cpu: 250m + memory: 1792Mi + requests: + cpu: 250m + memory: 1792Mi + service: + type: ClusterIP + foo: bar +status: + conditions: + - lastTransitionTime: "2023-08-30T07:44:39Z" + message: Unknown 'foo' parameter + reason: Initializing + status: "False" + type: ReconcileSuccess \ No newline at end of file diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_cluster_unknown.yaml b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_cluster_unknown.yaml new file mode 100644 index 0000000000000..86b7be4bd468b --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_cluster_unknown.yaml @@ -0,0 +1,44 @@ +apiVersion: rabbitmq.com/v1beta1 +kind: RabbitmqCluster +metadata: + labels: + app: example-rabbitmq + name: example-rabbitmq + namespace: example +spec: + image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8 + persistence: + storage: 32Gi + storageClassName: default + rabbitmq: + replicas: 3 + resources: + limits: + cpu: 250m + memory: 1792Mi + requests: + cpu: 250m + memory: 1792Mi + service: + type: ClusterIP +status: + conditions: + - lastTransitionTime: "2023-08-30T07:44:34Z" + reason: NotAllPodsReady + message: 0/3 Pods ready + status: "False" + type: AllReplicasReady + - lastTransitionTime: "2023-08-30T07:37:06Z" + reason: CouldNotRetrieveEndpoints + message: Could not verify available service endpoints + status: "Unknown" + type: ClusterAvailable + - lastTransitionTime: "2023-08-30T07:33:06Z" + reason: NoWarnings + status: "True" + type: NoWarnings + - lastTransitionTime: "2023-08-30T07:44:39Z" + message: Finish reconciling + reason: Success + status: "True" + type: ReconcileSuccess \ No newline at end of file diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_replicas_unknown.yaml b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_replicas_unknown.yaml new file mode 100644 index 0000000000000..f92f5afd66d17 --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_replicas_unknown.yaml @@ -0,0 +1,44 @@ +apiVersion: rabbitmq.com/v1beta1 +kind: RabbitmqCluster +metadata: + labels: + app: example-rabbitmq + name: example-rabbitmq + namespace: example +spec: + image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8 + persistence: + storage: 32Gi + storageClassName: default + rabbitmq: + replicas: 3 + resources: + limits: + cpu: 250m + memory: 1792Mi + requests: + cpu: 250m + memory: 1792Mi + service: + type: ClusterIP +status: + conditions: + - lastTransitionTime: "2023-08-30T07:44:34Z" + reason: MissingStatefulSet + message: Could not find StatefulSet + status: "Unknown" + type: AllReplicasReady + - lastTransitionTime: "2023-08-30T07:37:06Z" + reason: NoEndpointsAvailable + message: The service has no endpoints available + status: "False" + type: ClusterAvailable + - lastTransitionTime: "2023-08-30T07:33:06Z" + reason: NoWarnings + status: "True" + type: NoWarnings + - lastTransitionTime: "2023-08-30T07:44:39Z" + message: Finish reconciling + reason: Success + status: "True" + type: ReconcileSuccess \ No newline at end of file diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/healthy.yaml b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/healthy.yaml new file mode 100644 index 0000000000000..b436fba2bce26 --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/healthy.yaml @@ -0,0 +1,42 @@ +apiVersion: rabbitmq.com/v1beta1 +kind: RabbitmqCluster +metadata: + labels: + app: example-rabbitmq + name: example-rabbitmq + namespace: example +spec: + image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8 + persistence: + storage: 32Gi + storageClassName: default + rabbitmq: + replicas: 3 + resources: + limits: + cpu: 250m + memory: 1792Mi + requests: + cpu: 250m + memory: 1792Mi + service: + type: ClusterIP +status: + conditions: + - lastTransitionTime: "2023-08-30T07:44:34Z" + reason: AllPodsAreReady + status: "True" + type: AllReplicasReady + - lastTransitionTime: "2023-08-30T07:37:06Z" + reason: AtLeastOneEndpointAvailable + status: "True" + type: ClusterAvailable + - lastTransitionTime: "2023-08-30T07:33:06Z" + reason: NoWarnings + status: "True" + type: NoWarnings + - lastTransitionTime: "2023-08-30T07:44:39Z" + message: Finish reconciling + reason: Success + status: "True" + type: ReconcileSuccess \ No newline at end of file diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_cluster_unavailable.yaml b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_cluster_unavailable.yaml new file mode 100644 index 0000000000000..b01d9f52e2874 --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_cluster_unavailable.yaml @@ -0,0 +1,44 @@ +apiVersion: rabbitmq.com/v1beta1 +kind: RabbitmqCluster +metadata: + labels: + app: example-rabbitmq + name: example-rabbitmq + namespace: example +spec: + image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8 + persistence: + storage: 32Gi + storageClassName: default + rabbitmq: + replicas: 3 + resources: + limits: + cpu: 250m + memory: 1792Mi + requests: + cpu: 250m + memory: 1792Mi + service: + type: ClusterIP +status: + conditions: + - lastTransitionTime: "2023-08-30T07:44:34Z" + reason: NotAllPodsReady + message: 0/3 Pods ready + status: "False" + type: AllReplicasReady + - lastTransitionTime: "2023-08-30T07:37:06Z" + reason: NoEndpointsAvailable + message: The service has no endpoints available + status: "False" + type: ClusterAvailable + - lastTransitionTime: "2023-08-30T07:33:06Z" + reason: NoWarnings + status: "True" + type: NoWarnings + - lastTransitionTime: "2023-08-30T07:44:39Z" + message: Finish reconciling + reason: Success + status: "True" + type: ReconcileSuccess \ No newline at end of file diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_no_status.yaml b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_no_status.yaml new file mode 100644 index 0000000000000..b1ef1afe03562 --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_no_status.yaml @@ -0,0 +1,23 @@ +apiVersion: rabbitmq.com/v1beta1 +kind: RabbitmqCluster +metadata: + labels: + app: example-rabbitmq + name: example-rabbitmq + namespace: example +spec: + image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8 + persistence: + storage: 32Gi + storageClassName: default + rabbitmq: + replicas: 3 + resources: + limits: + cpu: 250m + memory: 1792Mi + requests: + cpu: 250m + memory: 1792Mi + service: + type: ClusterIP \ No newline at end of file diff --git a/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_pods_not_ready.yaml b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_pods_not_ready.yaml new file mode 100644 index 0000000000000..0cbbb2d050250 --- /dev/null +++ b/resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_pods_not_ready.yaml @@ -0,0 +1,43 @@ +apiVersion: rabbitmq.com/v1beta1 +kind: RabbitmqCluster +metadata: + labels: + app: example-rabbitmq + name: example-rabbitmq + namespace: example +spec: + image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8 + persistence: + storage: 32Gi + storageClassName: default + rabbitmq: + replicas: 3 + resources: + limits: + cpu: 250m + memory: 1792Mi + requests: + cpu: 250m + memory: 1792Mi + service: + type: ClusterIP +status: + conditions: + - lastTransitionTime: "2023-08-30T07:44:34Z" + reason: NotAllPodsReady + message: 1/3 Pods ready + status: "False" + type: AllReplicasReady + - lastTransitionTime: "2023-08-30T07:37:06Z" + reason: AtLeastOneEndpointAvailable + status: "True" + type: ClusterAvailable + - lastTransitionTime: "2023-08-30T07:33:06Z" + reason: NoWarnings + status: "True" + type: NoWarnings + - lastTransitionTime: "2023-08-30T07:44:39Z" + message: Finish reconciling + reason: Success + status: "True" + type: ReconcileSuccess \ No newline at end of file From 2a199bc7ae70ce8b933cda81f8558916621750d5 Mon Sep 17 00:00:00 2001 From: Ilya Gorban Date: Wed, 18 Sep 2024 22:01:33 +0300 Subject: [PATCH 03/10] feat(health): add healthchecks for Gloo resources (#11379) * feat(custom healthchecks): add healthchecks for Gloo resources Signed-off-by: Ilya Gorban * fix(gloo custom healthchecks): fix healthcheck and add older cases Signed-off-by: Ilya Gorban * feat(custom healthchecks): fix tabulation in Gloo resources lua files Signed-off-by: Ilya Gorban --------- Signed-off-by: Ilya Gorban Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- .../gateway.solo.io/Gateway/health.lua | 54 +++++++++++++++++++ .../gateway.solo.io/Gateway/health_test.yaml | 37 +++++++++++++ .../Gateway/testdata/gloo-accepted.yaml | 14 +++++ .../Gateway/testdata/gloo-no-status.yaml | 2 + .../Gateway/testdata/gloo-pending.yaml | 14 +++++ .../Gateway/testdata/gloo-rejected.yaml | 15 ++++++ .../Gateway/testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../MatchableHttpGateway/health.lua | 54 +++++++++++++++++++ .../MatchableHttpGateway/health_test.yaml | 37 +++++++++++++ .../testdata/gloo-accepted.yaml | 14 +++++ .../testdata/gloo-no-status.yaml | 2 + .../testdata/gloo-pending.yaml | 14 +++++ .../testdata/gloo-rejected.yaml | 15 ++++++ .../testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../gateway.solo.io/RouteOption/health.lua | 54 +++++++++++++++++++ .../RouteOption/health_test.yaml | 37 +++++++++++++ .../RouteOption/testdata/gloo-accepted.yaml | 14 +++++ .../RouteOption/testdata/gloo-no-status.yaml | 2 + .../RouteOption/testdata/gloo-pending.yaml | 14 +++++ .../RouteOption/testdata/gloo-rejected.yaml | 15 ++++++ .../RouteOption/testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../gateway.solo.io/RouteTable/health.lua | 54 +++++++++++++++++++ .../RouteTable/health_test.yaml | 37 +++++++++++++ .../RouteTable/testdata/gloo-accepted.yaml | 14 +++++ .../RouteTable/testdata/gloo-no-status.yaml | 2 + .../RouteTable/testdata/gloo-pending.yaml | 14 +++++ .../RouteTable/testdata/gloo-rejected.yaml | 15 ++++++ .../RouteTable/testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../VirtualHostOption/health.lua | 54 +++++++++++++++++++ .../VirtualHostOption/health_test.yaml | 37 +++++++++++++ .../testdata/gloo-accepted.yaml | 14 +++++ .../testdata/gloo-no-status.yaml | 2 + .../testdata/gloo-pending.yaml | 14 +++++ .../testdata/gloo-rejected.yaml | 15 ++++++ .../testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../gateway.solo.io/VirtualService/health.lua | 54 +++++++++++++++++++ .../VirtualService/health_test.yaml | 37 +++++++++++++ .../testdata/gloo-accepted.yaml | 14 +++++ .../testdata/gloo-no-status.yaml | 2 + .../VirtualService/testdata/gloo-pending.yaml | 14 +++++ .../testdata/gloo-rejected.yaml | 15 ++++++ .../VirtualService/testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../gloo.solo.io/Proxy/health.lua | 54 +++++++++++++++++++ .../gloo.solo.io/Proxy/health_test.yaml | 37 +++++++++++++ .../Proxy/testdata/gloo-accepted.yaml | 14 +++++ .../Proxy/testdata/gloo-no-status.yaml | 2 + .../Proxy/testdata/gloo-pending.yaml | 14 +++++ .../Proxy/testdata/gloo-rejected.yaml | 15 ++++++ .../Proxy/testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../gloo.solo.io/Settings/health.lua | 54 +++++++++++++++++++ .../gloo.solo.io/Settings/health_test.yaml | 37 +++++++++++++ .../Settings/testdata/gloo-accepted.yaml | 14 +++++ .../Settings/testdata/gloo-no-status.yaml | 2 + .../Settings/testdata/gloo-pending.yaml | 14 +++++ .../Settings/testdata/gloo-rejected.yaml | 15 ++++++ .../Settings/testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../gloo.solo.io/Upstream/health.lua | 54 +++++++++++++++++++ .../gloo.solo.io/Upstream/health_test.yaml | 37 +++++++++++++ .../Upstream/testdata/gloo-accepted.yaml | 14 +++++ .../Upstream/testdata/gloo-no-status.yaml | 2 + .../Upstream/testdata/gloo-pending.yaml | 14 +++++ .../Upstream/testdata/gloo-rejected.yaml | 15 ++++++ .../Upstream/testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ .../gloo.solo.io/UpstreamGroup/health.lua | 54 +++++++++++++++++++ .../UpstreamGroup/health_test.yaml | 37 +++++++++++++ .../UpstreamGroup/testdata/gloo-accepted.yaml | 14 +++++ .../testdata/gloo-no-status.yaml | 2 + .../UpstreamGroup/testdata/gloo-pending.yaml | 14 +++++ .../UpstreamGroup/testdata/gloo-rejected.yaml | 15 ++++++ .../UpstreamGroup/testdata/gloo-warning.yaml | 15 ++++++ .../non-namespaced-gloo-accepted.yaml | 12 +++++ .../testdata/non-namespaced-gloo-pending.yaml | 14 +++++ .../non-namespaced-gloo-rejected.yaml | 13 +++++ .../testdata/non-namespaced-gloo-warning.yaml | 13 +++++ 110 files changed, 2030 insertions(+) create mode 100644 resource_customizations/gateway.solo.io/Gateway/health.lua create mode 100644 resource_customizations/gateway.solo.io/Gateway/health_test.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/health.lua create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/health_test.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/health.lua create mode 100644 resource_customizations/gateway.solo.io/RouteOption/health_test.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/health.lua create mode 100644 resource_customizations/gateway.solo.io/RouteTable/health_test.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/health.lua create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/health_test.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/health.lua create mode 100644 resource_customizations/gateway.solo.io/VirtualService/health_test.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/health.lua create mode 100644 resource_customizations/gloo.solo.io/Proxy/health_test.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/health.lua create mode 100644 resource_customizations/gloo.solo.io/Settings/health_test.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/health.lua create mode 100644 resource_customizations/gloo.solo.io/Upstream/health_test.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-warning.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/health.lua create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/health_test.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-accepted.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-no-status.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-pending.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-rejected.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-warning.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-accepted.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-pending.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-rejected.yaml create mode 100644 resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-warning.yaml diff --git a/resource_customizations/gateway.solo.io/Gateway/health.lua b/resource_customizations/gateway.solo.io/Gateway/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/health.lua @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/health_test.yaml b/resource_customizations/gateway.solo.io/Gateway/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/health_test.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-accepted.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..973516d5e2d52 --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-no-status.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..5dc9f8050b830 --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gateway.solo.io/v1 +kind: Gateway diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-pending.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..643701b928ae9 --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-rejected.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..8499dd8301dc7 --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-warning.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..76c85c21d3228 --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..aa9d5f0eace9e --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..4092cb131dbeb --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..633e115a2b934 --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..c1693e9eb8a5d --- /dev/null +++ b/resource_customizations/gateway.solo.io/Gateway/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/health.lua b/resource_customizations/gateway.solo.io/MatchableHttpGateway/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/health.lua @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/health_test.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/health_test.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-accepted.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..a733e4a76a063 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-no-status.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..58e3356e93e88 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gateway.solo.io/v1 +kind: MatchableHttpGateway diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-pending.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..12726ea261f62 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-rejected.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..0656c3d0e61c0 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-warning.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..eb0bf59fb8857 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..29e342a33dcc0 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..f2fb7b99dbe0c --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..579e767a2e3b5 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..f7f430cd4fb58 --- /dev/null +++ b/resource_customizations/gateway.solo.io/MatchableHttpGateway/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/health.lua b/resource_customizations/gateway.solo.io/RouteOption/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/health.lua @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/health_test.yaml b/resource_customizations/gateway.solo.io/RouteOption/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/health_test.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-accepted.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..5d352df7fb5e9 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-no-status.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..c2bae5789d605 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gateway.solo.io/v1 +kind: RouteOption diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-pending.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..e7f4cee8f9f0a --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-rejected.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..b2398a860adda --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-warning.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..19d5a84153551 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..f39d4d7864ed9 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..5743058f17b64 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..23742e2d548c3 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..70313101a4b00 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteOption/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/health.lua b/resource_customizations/gateway.solo.io/RouteTable/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/health.lua @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/health_test.yaml b/resource_customizations/gateway.solo.io/RouteTable/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/health_test.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-accepted.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..3f63118e2a95d --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-no-status.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..806a4d98d3695 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gateway.solo.io/v1 +kind: RouteTable diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-pending.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..80b3937d9de4b --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-rejected.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..90ff94075c164 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-warning.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..874de924b22de --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..76ab4680fe25d --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..1acce91498614 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..824dd6c808388 --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..0399ce71faf7c --- /dev/null +++ b/resource_customizations/gateway.solo.io/RouteTable/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/health.lua b/resource_customizations/gateway.solo.io/VirtualHostOption/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/health.lua @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/health_test.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/health_test.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-accepted.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..1e90fcd65847d --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-no-status.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..a2ee1a9c818b6 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gateway.solo.io/v1 +kind: VirtualHostOption diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-pending.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..e9c9844a969a7 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-rejected.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..bcc19457905df --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-warning.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..10c4112a74376 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..e204609d6c66c --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..5fa8b8949ef9c --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..ecfca65272feb --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..0b02cb0856938 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualHostOption/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/health.lua b/resource_customizations/gateway.solo.io/VirtualService/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/health.lua @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/health_test.yaml b/resource_customizations/gateway.solo.io/VirtualService/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/health_test.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-accepted.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..99b339dda7c06 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-no-status.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..6567086648737 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gateway.solo.io/v1 +kind: VirtualService diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-pending.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..f3a31057d4299 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-rejected.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..47575747ac596 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-warning.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..27ba16faa5f2c --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..7606a02c7a1f8 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..1e8f4dc517be4 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..a3f204753a6f2 --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..1c641e62b190d --- /dev/null +++ b/resource_customizations/gateway.solo.io/VirtualService/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/health.lua b/resource_customizations/gloo.solo.io/Proxy/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/health.lua @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/health_test.yaml b/resource_customizations/gloo.solo.io/Proxy/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/health_test.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-accepted.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..1a33b9dedeb7d --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-no-status.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..5354698cf4acf --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gloo.solo.io/v1 +kind: Proxy diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-pending.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..8497064ec18ae --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-rejected.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..e93acfec72c47 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-warning.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..a65c3fa4957b1 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..dff6082232fa5 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..49afeb8e4be83 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..0f7ec50212811 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..cabff991640bb --- /dev/null +++ b/resource_customizations/gloo.solo.io/Proxy/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/health.lua b/resource_customizations/gloo.solo.io/Settings/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/health.lua @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/health_test.yaml b/resource_customizations/gloo.solo.io/Settings/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/health_test.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/gloo-accepted.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..968a56607561c --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/gloo-no-status.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..82726a6c3099b --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gloo.solo.io/v1 +kind: Settings diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/gloo-pending.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..bcfbd8a25a2da --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/gloo-rejected.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..004ecf1ef4b14 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/gloo-warning.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..d42784551beb4 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..99ff0026b4ade --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..fdec14fa04a6c --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..5e62178cd182d --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..26ddf57424eea --- /dev/null +++ b/resource_customizations/gloo.solo.io/Settings/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/health.lua b/resource_customizations/gloo.solo.io/Upstream/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/health.lua @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/health_test.yaml b/resource_customizations/gloo.solo.io/Upstream/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/health_test.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-accepted.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..b0094f46d8d2a --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-no-status.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..b68a5e16b03be --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gloo.solo.io/v1 +kind: Upstream diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-pending.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..bef8b9eef9b88 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-rejected.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..02cef224d46bd --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-warning.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..359e27871ba15 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..85a792fc0b37f --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-accepted.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..ec29ff4967bd1 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-pending.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..7779628abf3b9 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-rejected.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..8f170e814adf9 --- /dev/null +++ b/resource_customizations/gloo.solo.io/Upstream/testdata/non-namespaced-gloo-warning.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/health.lua b/resource_customizations/gloo.solo.io/UpstreamGroup/health.lua new file mode 100644 index 0000000000000..4e0930462f38a --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/health.lua @@ -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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/health_test.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/health_test.yaml new file mode 100644 index 0000000000000..bd7846b5019f1 --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/health_test.yaml @@ -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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-accepted.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-accepted.yaml new file mode 100644 index 0000000000000..90a4023ce60cf --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-accepted.yaml @@ -0,0 +1,14 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup +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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-no-status.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-no-status.yaml new file mode 100644 index 0000000000000..45f71721283b5 --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-no-status.yaml @@ -0,0 +1,2 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-pending.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-pending.yaml new file mode 100644 index 0000000000000..76f8a8d227567 --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-pending.yaml @@ -0,0 +1,14 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup +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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-rejected.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-rejected.yaml new file mode 100644 index 0000000000000..e66fa5a7e67fd --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-rejected.yaml @@ -0,0 +1,15 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup +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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-warning.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-warning.yaml new file mode 100644 index 0000000000000..b7c550394341f --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/gloo-warning.yaml @@ -0,0 +1,15 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup +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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-accepted.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-accepted.yaml new file mode 100644 index 0000000000000..63e8dd8af6bbc --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-accepted.yaml @@ -0,0 +1,12 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup +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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-pending.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-pending.yaml new file mode 100644 index 0000000000000..b1367f520f824 --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-pending.yaml @@ -0,0 +1,14 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup +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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-rejected.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-rejected.yaml new file mode 100644 index 0000000000000..7c4312539bc78 --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-rejected.yaml @@ -0,0 +1,13 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup +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 diff --git a/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-warning.yaml b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-warning.yaml new file mode 100644 index 0000000000000..319e1bc6645b7 --- /dev/null +++ b/resource_customizations/gloo.solo.io/UpstreamGroup/testdata/non-namespaced-gloo-warning.yaml @@ -0,0 +1,13 @@ +apiVersion: gloo.solo.io/v1 +kind: UpstreamGroup +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 From e09ff60d75787f18edc755990988a5a9e17cbc55 Mon Sep 17 00:00:00 2001 From: Linghao Su Date: Thu, 19 Sep 2024 04:17:15 +0800 Subject: [PATCH 04/10] feat(ui): add token diff support in diff view (#19983) Signed-off-by: linghaoSu --- .../individual-diff-section.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/src/app/applications/components/application-resources-diff/individual-diff-section.tsx b/ui/src/app/applications/components/application-resources-diff/individual-diff-section.tsx index 7d82659cbfdc7..8104e7e232b23 100644 --- a/ui/src/app/applications/components/application-resources-diff/individual-diff-section.tsx +++ b/ui/src/app/applications/components/application-resources-diff/individual-diff-section.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import {useState} from 'react'; -import {Diff, Hunk} from 'react-diff-view'; +import {Diff, Hunk, tokenize, markEdits} from 'react-diff-view'; import 'react-diff-view/style/index.css'; import './application-resources-diff.scss'; @@ -15,6 +15,12 @@ export interface IndividualDiffSectionProps { export const IndividualDiffSection = (props: IndividualDiffSectionProps) => { const {file, showPath, whiteBox, viewType} = props; const [collapsed, setCollapsed] = useState(false); + const options = { + highlight: false, + enhancers: [markEdits(file.hunks, {type: 'block'})] + }; + const token = tokenize(file.hunks, options); + return (
{showPath && ( @@ -24,7 +30,7 @@ export const IndividualDiffSection = (props: IndividualDiffSectionProps) => {

)} {!collapsed && ( - + {(hunks: any) => hunks.map((hunk: any) => )} )} From 04919f0a6fb70fc81d334061ce5e57ddba2d1d1f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:23:39 -0400 Subject: [PATCH 05/10] chore(deps): bump library/node from 22.8.0 to 22.9.0 in /ui-test (#19975) Bumps library/node from 22.8.0 to 22.9.0. --- updated-dependencies: - dependency-name: library/node dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- ui-test/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-test/Dockerfile b/ui-test/Dockerfile index ddd1c26d46f2c..134c3cffead31 100644 --- a/ui-test/Dockerfile +++ b/ui-test/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/library/node:22.8.0@sha256:bd00c03095f7586432805dbf7989be10361d27987f93de904b1fc003949a4794 as node +FROM docker.io/library/node:22.9.0@sha256:fa4b468061bd2630567be979ad4899c19dae312262186d501ce73e0875ed4d12 as node RUN apt-get update && apt-get install --no-install-recommends -y \ software-properties-common From f64db6dba7aec61783b0a0d0e403f1a02b674635 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:24:26 -0400 Subject: [PATCH 06/10] chore(deps): bump github.com/prometheus/client_golang (#19974) Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.3 to 1.20.4. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.20.3...v1.20.4) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cf3e5024e68c1..d3b6084f32571 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 github.com/olekukonko/tablewriter v0.0.5 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/prometheus/client_golang v1.20.3 + github.com/prometheus/client_golang v1.20.4 github.com/r3labs/diff v1.1.0 github.com/redis/go-redis/v9 v9.6.1 github.com/robfig/cron/v3 v3.0.1 diff --git a/go.sum b/go.sum index 09d27f87d56f7..154feecfb3750 100644 --- a/go.sum +++ b/go.sum @@ -814,8 +814,8 @@ github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= -github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 97d110bf27a5fd23ab1f5cad2d396852b7e02339 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 09:42:37 +0300 Subject: [PATCH 07/10] chore(deps): bump library/node from `fa4b468` to `cbe2d5f` in /ui-test (#19997) Bumps library/node from `fa4b468` to `cbe2d5f`. --- updated-dependencies: - dependency-name: library/node dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- ui-test/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-test/Dockerfile b/ui-test/Dockerfile index 134c3cffead31..c0fbd1be9b711 100644 --- a/ui-test/Dockerfile +++ b/ui-test/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/library/node:22.9.0@sha256:fa4b468061bd2630567be979ad4899c19dae312262186d501ce73e0875ed4d12 as node +FROM docker.io/library/node:22.9.0@sha256:cbe2d5f94110cea9817dd8c5809d05df49b4bd1aac5203f3594d88665ad37988 as node RUN apt-get update && apt-get install --no-install-recommends -y \ software-properties-common From c8eb5b54438e8096d49d1c353c5f98727820bd94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 09:43:04 +0300 Subject: [PATCH 08/10] chore(deps): bump library/node from 22.8.0 to 22.9.0 (#19999) Bumps library/node from 22.8.0 to 22.9.0. --- updated-dependencies: - dependency-name: library/node dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 71799e918f94d..bc4e6debbfaa1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,7 +83,7 @@ WORKDIR /home/argocd #################################################################################################### # Argo CD UI stage #################################################################################################### -FROM --platform=$BUILDPLATFORM docker.io/library/node:22.8.0@sha256:bd00c03095f7586432805dbf7989be10361d27987f93de904b1fc003949a4794 AS argocd-ui +FROM --platform=$BUILDPLATFORM docker.io/library/node:22.9.0@sha256:cbe2d5f94110cea9817dd8c5809d05df49b4bd1aac5203f3594d88665ad37988 AS argocd-ui WORKDIR /src COPY ["ui/package.json", "ui/yarn.lock", "./"] From 02a4d9f2c0ff8dd865a15e92f1f32b59c596445a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:41:26 +0300 Subject: [PATCH 09/10] chore(deps): bump chromedriver from 128.0.3 to 129.0.0 in /ui-test (#19998) Bumps [chromedriver](https://github.com/giggio/node-chromedriver) from 128.0.3 to 129.0.0. - [Commits](https://github.com/giggio/node-chromedriver/compare/128.0.3...129.0.0) --- updated-dependencies: - dependency-name: chromedriver dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- ui-test/package.json | 2 +- ui-test/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui-test/package.json b/ui-test/package.json index 041e43ac3160a..36df84a45a158 100644 --- a/ui-test/package.json +++ b/ui-test/package.json @@ -14,7 +14,7 @@ "dependencies": { "@types/selenium-webdriver": "^4.1.23", "assert": "^2.1.0", - "chromedriver": "^128.0.3", + "chromedriver": "^129.0.0", "selenium-webdriver": "^4.21.0" }, "devDependencies": { diff --git a/ui-test/yarn.lock b/ui-test/yarn.lock index 1f6205097d09f..39f214cf8e456 100644 --- a/ui-test/yarn.lock +++ b/ui-test/yarn.lock @@ -262,10 +262,10 @@ chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" -chromedriver@^128.0.3: - version "128.0.3" - resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-128.0.3.tgz#7c2cd2d160f269e78f40840ee7a043dac3687148" - integrity sha512-Xn/bknOpGlY9tKinwS/hVWeNblSeZvbbJbF8XZ73X1jeWfAFPRXx3fMLdNNz8DqruDbx3cKEJ5wR3mnst6G3iw== +chromedriver@^129.0.0: + version "129.0.0" + resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-129.0.0.tgz#28d7ede5ab372b868ac0db5efff7036646b4d603" + integrity sha512-B1ccqD6hDjNrw94FeqdynIotn1ZV/TnFrkRz2Rync2kzSnq6D6IrSkN1w5Pnuvnc98QhN2xujxDXxkqEqy/PWg== dependencies: "@testim/chrome-version" "^1.1.4" axios "^1.7.4" From f4c519ade50dca809fa20104c1b87fa8a2517faa Mon Sep 17 00:00:00 2001 From: Tchoupinax Date: Thu, 19 Sep 2024 09:45:02 +0200 Subject: [PATCH 10/10] feat(ui): display sha's revision in every history release (#19963) Signed-off-by: Tchoupinax --- ...application-deployment-history-details.tsx | 125 ++++++++++++++++++ .../application-deployment-history.tsx | 110 +-------------- .../application-details.tsx | 1 - 3 files changed, 129 insertions(+), 107 deletions(-) create mode 100644 ui/src/app/applications/components/application-deployment-history/application-deployment-history-details.tsx diff --git a/ui/src/app/applications/components/application-deployment-history/application-deployment-history-details.tsx b/ui/src/app/applications/components/application-deployment-history/application-deployment-history-details.tsx new file mode 100644 index 0000000000000..e98f46fc60e06 --- /dev/null +++ b/ui/src/app/applications/components/application-deployment-history/application-deployment-history-details.tsx @@ -0,0 +1,125 @@ +import * as moment from 'moment'; +import * as React from 'react'; +import * as models from '../../../shared/models'; +import './application-deployment-history.scss'; +import {DataLoader} from 'argo-ui'; +import {Revision} from '../../../shared/components'; +import {services} from '../../../shared/services'; +import {ApplicationParameters} from '../application-parameters/application-parameters'; +import {RevisionMetadataRows} from './revision-metadata-rows'; + +type props = { + app: models.Application; + info: models.RevisionHistory; + index: number; +}; + +export const ApplicationDeploymentHistoryDetails = ({app, info, index}: props) => { + const deployments = (app.status.history || []).slice().reverse(); + const recentDeployments = deployments.map((info, i) => { + const nextDeployedAt = i === 0 ? null : deployments[i - 1].deployedAt; + const runEnd = nextDeployedAt ? moment(nextDeployedAt) : moment(); + return {...info, nextDeployedAt, durationMs: runEnd.diff(moment(info.deployedAt)) / 1000}; + }); + + const [showParameterDetails, setShowParameterDetails] = React.useState(Boolean); + + return ( + <> + {info.sources === undefined ? ( + +
+
+
Revision:
+
+ +
+
+
+ + + + {showParameterDetails && ( + services.repos.appDetails(src, src.appName, app.spec.project, 0, recentDeployments[index].id)}> + {(details: models.RepoAppDetails) => ( +
+ +
+ )} +
+ )} +
+ ) : ( + info.sources.map((source, i) => ( + + {i > 0 ?
: null} +
+
+
Revision:
+
+ +
+
+
+ + + + {showParameterDetails && ( + services.repos.appDetails(src, src.appName, app.spec.project, i, recentDeployments[index].id)}> + {(details: models.RepoAppDetails) => ( +
+ +
+ )} +
+ )} + + )) + )} + + ); +}; diff --git a/ui/src/app/applications/components/application-deployment-history/application-deployment-history.tsx b/ui/src/app/applications/components/application-deployment-history/application-deployment-history.tsx index c24fab22e00eb..69adefe598216 100644 --- a/ui/src/app/applications/components/application-deployment-history/application-deployment-history.tsx +++ b/ui/src/app/applications/components/application-deployment-history/application-deployment-history.tsx @@ -1,22 +1,18 @@ -import {DataLoader, DropDownMenu, Duration} from 'argo-ui'; +import {DropDownMenu, Duration} from 'argo-ui'; import {InitiatedBy} from './initiated-by'; import * as moment from 'moment'; import * as React from 'react'; -import {Revision, Timestamp} from '../../../shared/components'; +import {Timestamp} from '../../../shared/components'; import * as models from '../../../shared/models'; -import {services} from '../../../shared/services'; -import {ApplicationParameters} from '../application-parameters/application-parameters'; -import {RevisionMetadataRows} from './revision-metadata-rows'; import './application-deployment-history.scss'; +import {ApplicationDeploymentHistoryDetails} from './application-deployment-history-details'; export const ApplicationDeploymentHistory = ({ app, rollbackApp, - selectedRollbackDeploymentIndex, selectDeployment }: { app: models.Application; - selectedRollbackDeploymentIndex: number; rollbackApp: (info: models.RevisionHistory) => any; selectDeployment: (index: number) => any; }) => { @@ -27,8 +23,6 @@ export const ApplicationDeploymentHistory = ({ return {...info, nextDeployedAt, durationMs: runEnd.diff(moment(info.deployedAt)) / 1000}; }); - const [showParameterDetails, setShowParameterDetails] = React.useState(Boolean); - return (
{recentDeployments.map((info, index) => ( @@ -78,104 +72,8 @@ export const ApplicationDeploymentHistory = ({
- {selectedRollbackDeploymentIndex === index ? ( - info.sources === undefined ? ( - -
-
-
Revision:
-
- -
-
-
- - - {showParameterDetails && ( - services.repos.appDetails(src, src.appName, app.spec.project, 0, recentDeployments[index].id)}> - {(details: models.RepoAppDetails) => ( -
- -
- )} -
- )} -
- ) : ( - info.sources.map((source, i) => ( - - {i > 0 ?
: null} -
-
-
Revision:
-
- -
-
-
- - - - {showParameterDetails && ( - services.repos.appDetails(src, src.appName, app.spec.project, i, recentDeployments[index].id)}> - {(details: models.RepoAppDetails) => ( -
- -
- )} -
- )} - - )) - ) - ) : ( -

Click to see source details.

- )} +
))} diff --git a/ui/src/app/applications/components/application-details/application-details.tsx b/ui/src/app/applications/components/application-details/application-details.tsx index 8e2d968727a8a..c364e939054fb 100644 --- a/ui/src/app/applications/components/application-details/application-details.tsx +++ b/ui/src/app/applications/components/application-details/application-details.tsx @@ -855,7 +855,6 @@ export class ApplicationDetails extends React.Component -1 && ( this.rollbackApplication(info, application)} selectDeployment={i => this.setRollbackPanelVisible(i)} />