-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(health): Adding more health checks for Keycloak, Postgres, Grafa…
…na, SolrCloud (#20294) * feat(health): Add healtchcheck for acid.zalan.do/postgresql Signed-off-by: Remo Zellmer <rze@vizrt.com> * feat(health): Add healthcheck for grafana.integreatly.org/Grafana and GrafanaDatasource Signed-off-by: Remo Zellmer <rze@vizrt.com> * feat(health): Add healthcheck for k8s.keycloak.org/Keycloak Signed-off-by: Remo Zellmer <rze@vizrt.com> * feat(health): Add healthcheck for solr.apache.org/SolrCloud Signed-off-by: Remo Zellmer <rze@vizrt.com> --------- Signed-off-by: Remo Zellmer <rze@vizrt.com>
- Loading branch information
Showing
28 changed files
with
1,230 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
resource_customizations/acid.zalan.do/postgresql/health.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- Waiting for status info => Progressing | ||
if obj.status == nil or obj.status.PostgresClusterStatus == nil then | ||
return { | ||
status = "Progressing", | ||
message = "Waiting for postgres cluster status...", | ||
} | ||
end | ||
|
||
-- Running => Healthy | ||
if obj.status.PostgresClusterStatus == "Running" then | ||
return { | ||
status = "Healthy", | ||
message = obj.status.PostgresClusterStatus, | ||
} | ||
end | ||
|
||
-- Creating/Updating => Progressing | ||
if obj.status.PostgresClusterStatus == "Creating" or obj.status.PostgresClusterStatus == "Updating" then | ||
return { | ||
status = "Progressing", | ||
message = obj.status.PostgresClusterStatus, | ||
} | ||
end | ||
|
||
-- CreateFailed/UpdateFailed/SyncFailed/Invalid/etc => Degraded | ||
-- See https://github.com/zalando/postgres-operator/blob/0745ce7c/pkg/apis/acid.zalan.do/v1/const.go#L4-L13 | ||
return { | ||
status = "Degraded", | ||
message = obj.status.PostgresClusterStatus, | ||
} |
17 changes: 17 additions & 0 deletions
17
resource_customizations/acid.zalan.do/postgresql/health_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
tests: | ||
- healthStatus: | ||
status: Progressing | ||
message: "Waiting for postgres cluster status..." | ||
inputPath: testdata/provisioning.yaml | ||
- healthStatus: | ||
status: Progressing | ||
message: "Updating" | ||
inputPath: testdata/progressing.yaml | ||
- healthStatus: | ||
status: Healthy | ||
message: "Running" | ||
inputPath: testdata/healthy.yaml | ||
- healthStatus: | ||
status: Degraded | ||
message: "UpdateFailed" | ||
inputPath: testdata/degraded.yaml |
27 changes: 27 additions & 0 deletions
27
resource_customizations/acid.zalan.do/postgresql/testdata/degraded.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: acid.zalan.do/v1 | ||
kind: postgresql | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: '1' | ||
argocd.argoproj.io/tracking-id: foobar-db:acid.zalan.do/postgresql:foo/foobar-db | ||
creationTimestamp: '2024-10-07T09:06:07Z' | ||
generation: 4 | ||
name: foobar-db | ||
namespace: foo | ||
resourceVersion: '242244' | ||
uid: 741b63d5-8deb-45ef-af80-09d558d355a7 | ||
spec: | ||
databases: | ||
foobar: root | ||
enableLogicalBackup: false | ||
numberOfInstances: 1 | ||
postgresql: | ||
parameters: | ||
password_encryption: scram-sha-256 | ||
version: '15' | ||
teamId: foobar | ||
users: {} | ||
volume: | ||
size: 1Gi | ||
status: | ||
PostgresClusterStatus: UpdateFailed |
27 changes: 27 additions & 0 deletions
27
resource_customizations/acid.zalan.do/postgresql/testdata/healthy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: acid.zalan.do/v1 | ||
kind: postgresql | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: '1' | ||
argocd.argoproj.io/tracking-id: foobar-db:acid.zalan.do/postgresql:foo/foobar-db | ||
creationTimestamp: '2024-10-07T09:06:07Z' | ||
generation: 4 | ||
name: foobar-db | ||
namespace: foo | ||
resourceVersion: '242244' | ||
uid: 741b63d5-8deb-45ef-af80-09d558d355a7 | ||
spec: | ||
databases: | ||
foobar: root | ||
enableLogicalBackup: false | ||
numberOfInstances: 1 | ||
postgresql: | ||
parameters: | ||
password_encryption: scram-sha-256 | ||
version: '15' | ||
teamId: foobar | ||
users: {} | ||
volume: | ||
size: 1Gi | ||
status: | ||
PostgresClusterStatus: Running |
27 changes: 27 additions & 0 deletions
27
resource_customizations/acid.zalan.do/postgresql/testdata/progressing.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: acid.zalan.do/v1 | ||
kind: postgresql | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: '1' | ||
argocd.argoproj.io/tracking-id: foobar-db:acid.zalan.do/postgresql:foo/foobar-db | ||
creationTimestamp: '2024-10-07T09:06:07Z' | ||
generation: 4 | ||
name: foobar-db | ||
namespace: foo | ||
resourceVersion: '242244' | ||
uid: 741b63d5-8deb-45ef-af80-09d558d355a7 | ||
spec: | ||
databases: | ||
foobar: root | ||
enableLogicalBackup: false | ||
numberOfInstances: 1 | ||
postgresql: | ||
parameters: | ||
password_encryption: scram-sha-256 | ||
version: '15' | ||
teamId: foobar | ||
users: {} | ||
volume: | ||
size: 1Gi | ||
status: | ||
PostgresClusterStatus: Updating |
21 changes: 21 additions & 0 deletions
21
resource_customizations/acid.zalan.do/postgresql/testdata/provisioning.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: acid.zalan.do/v1 | ||
kind: postgresql | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: '1' | ||
argocd.argoproj.io/tracking-id: foobar-db:acid.zalan.do/postgresql:foo/foobar-db | ||
name: foobar-db | ||
namespace: foo | ||
spec: | ||
databases: | ||
foobar: root | ||
enableLogicalBackup: false | ||
numberOfInstances: 1 | ||
postgresql: | ||
parameters: | ||
password_encryption: scram-sha-256 | ||
version: '15' | ||
teamId: foobar | ||
users: {} | ||
volume: | ||
size: 1Gi |
30 changes: 30 additions & 0 deletions
30
resource_customizations/grafana.integreatly.org/Grafana/health.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
-- if no status info available yet, assume progressing | ||
if obj.status == nil or obj.status.stageStatus == nil then | ||
return { | ||
status = "Progressing", | ||
message = "Waiting for Grafana status info", | ||
} | ||
end | ||
|
||
-- if last stage failed, we are stuck here | ||
if obj.status.stageStatus == "failed" then | ||
return { | ||
status = "Degraded", | ||
message = "Failed at stage " .. obj.status.stage, | ||
} | ||
end | ||
|
||
-- only if "complete" stage was successful, Grafana can be considered healthy | ||
if obj.status.stage == "complete" and obj.status.stageStatus == "success" then | ||
return { | ||
status = "Healthy", | ||
message = "", | ||
} | ||
end | ||
|
||
-- no final status yet, assume progressing | ||
return { | ||
status = "Progressing", | ||
message = obj.status.stage, | ||
} |
17 changes: 17 additions & 0 deletions
17
resource_customizations/grafana.integreatly.org/Grafana/health_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
tests: | ||
- healthStatus: | ||
status: Progressing | ||
message: "Waiting for Grafana status info" | ||
inputPath: testdata/provisioning.yaml | ||
- healthStatus: | ||
status: Progressing | ||
message: "deployment" | ||
inputPath: testdata/progressing.yaml | ||
- healthStatus: | ||
status: Healthy | ||
message: "" | ||
inputPath: testdata/healthy.yaml | ||
- healthStatus: | ||
status: Degraded | ||
message: "Failed at stage ingress" | ||
inputPath: testdata/degraded.yaml |
47 changes: 47 additions & 0 deletions
47
resource_customizations/grafana.integreatly.org/Grafana/testdata/degraded.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
apiVersion: grafana.integreatly.org/v1beta1 | ||
kind: Grafana | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: '1' | ||
argocd.argoproj.io/tracking-id: foobar-admin:grafana.integreatly.org/Grafana:foo/grafana | ||
creationTimestamp: '2024-10-07T08:46:00Z' | ||
generation: 3 | ||
labels: | ||
dashboards: grafana | ||
folders: grafana | ||
name: grafana | ||
namespace: foo | ||
resourceVersion: '343511' | ||
uid: d2f0496d-cd5c-46bf-8630-de827b6d59b0 | ||
spec: | ||
deployment: | ||
metadata: {} | ||
spec: | ||
template: | ||
metadata: {} | ||
spec: | ||
containers: | ||
- image: docker.io/grafana/grafana:11.1.4 | ||
name: grafana | ||
volumeMounts: | ||
- mountPath: /etc/ssl/certs/ca-certificates.crt | ||
name: tls-ca-bundle | ||
readOnly: true | ||
subPath: tls-ca-bundle.pem | ||
volumes: | ||
- name: tls-ca-bundle | ||
secret: | ||
items: | ||
- key: tls-ca-bundle.pem | ||
path: tls-ca-bundle.pem | ||
secretName: tls-ca-bundle-secret | ||
version: 10.4.3 | ||
status: | ||
adminUrl: http://grafana-service.foo:3000 | ||
dashboards: | ||
- foo/dashboard-argocd/qPkgGHg7k | ||
datasources: | ||
- foo/cluster-local/927b3c23-e25f-4cbe-a82f-effbb0bbbf40 | ||
stage: ingress | ||
stageStatus: failed | ||
version: 11.1.4 |
47 changes: 47 additions & 0 deletions
47
resource_customizations/grafana.integreatly.org/Grafana/testdata/healthy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
apiVersion: grafana.integreatly.org/v1beta1 | ||
kind: Grafana | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: '1' | ||
argocd.argoproj.io/tracking-id: foobar-admin:grafana.integreatly.org/Grafana:foo/grafana | ||
creationTimestamp: '2024-10-07T08:46:00Z' | ||
generation: 3 | ||
labels: | ||
dashboards: grafana | ||
folders: grafana | ||
name: grafana | ||
namespace: foo | ||
resourceVersion: '343511' | ||
uid: d2f0496d-cd5c-46bf-8630-de827b6d59b0 | ||
spec: | ||
deployment: | ||
metadata: {} | ||
spec: | ||
template: | ||
metadata: {} | ||
spec: | ||
containers: | ||
- image: docker.io/grafana/grafana:11.1.4 | ||
name: grafana | ||
volumeMounts: | ||
- mountPath: /etc/ssl/certs/ca-certificates.crt | ||
name: tls-ca-bundle | ||
readOnly: true | ||
subPath: tls-ca-bundle.pem | ||
volumes: | ||
- name: tls-ca-bundle | ||
secret: | ||
items: | ||
- key: tls-ca-bundle.pem | ||
path: tls-ca-bundle.pem | ||
secretName: tls-ca-bundle-secret | ||
version: 10.4.3 | ||
status: | ||
adminUrl: http://grafana-service.foo:3000 | ||
dashboards: | ||
- foo/dashboard-argocd/qPkgGHg7k | ||
datasources: | ||
- foo/cluster-local/927b3c23-e25f-4cbe-a82f-effbb0bbbf40 | ||
stage: complete | ||
stageStatus: success | ||
version: 11.1.4 |
47 changes: 47 additions & 0 deletions
47
resource_customizations/grafana.integreatly.org/Grafana/testdata/progressing.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
apiVersion: grafana.integreatly.org/v1beta1 | ||
kind: Grafana | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: '1' | ||
argocd.argoproj.io/tracking-id: foobar-admin:grafana.integreatly.org/Grafana:foo/grafana | ||
creationTimestamp: '2024-10-07T08:46:00Z' | ||
generation: 3 | ||
labels: | ||
dashboards: grafana | ||
folders: grafana | ||
name: grafana | ||
namespace: foo | ||
resourceVersion: '343511' | ||
uid: d2f0496d-cd5c-46bf-8630-de827b6d59b0 | ||
spec: | ||
deployment: | ||
metadata: {} | ||
spec: | ||
template: | ||
metadata: {} | ||
spec: | ||
containers: | ||
- image: docker.io/grafana/grafana:11.1.4 | ||
name: grafana | ||
volumeMounts: | ||
- mountPath: /etc/ssl/certs/ca-certificates.crt | ||
name: tls-ca-bundle | ||
readOnly: true | ||
subPath: tls-ca-bundle.pem | ||
volumes: | ||
- name: tls-ca-bundle | ||
secret: | ||
items: | ||
- key: tls-ca-bundle.pem | ||
path: tls-ca-bundle.pem | ||
secretName: tls-ca-bundle-secret | ||
version: 10.4.3 | ||
status: | ||
adminUrl: http://grafana-service.foo:3000 | ||
dashboards: | ||
- foo/dashboard-argocd/qPkgGHg7k | ||
datasources: | ||
- foo/cluster-local/927b3c23-e25f-4cbe-a82f-effbb0bbbf40 | ||
stage: deployment | ||
stageStatus: success | ||
version: 11.1.4 |
39 changes: 39 additions & 0 deletions
39
resource_customizations/grafana.integreatly.org/Grafana/testdata/provisioning.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: grafana.integreatly.org/v1beta1 | ||
kind: Grafana | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: '1' | ||
argocd.argoproj.io/tracking-id: foobar-admin:grafana.integreatly.org/Grafana:foo/grafana | ||
creationTimestamp: '2024-10-07T08:46:00Z' | ||
generation: 3 | ||
labels: | ||
dashboards: grafana | ||
folders: grafana | ||
name: grafana | ||
namespace: foo | ||
resourceVersion: '343511' | ||
uid: d2f0496d-cd5c-46bf-8630-de827b6d59b0 | ||
spec: | ||
deployment: | ||
metadata: {} | ||
spec: | ||
template: | ||
metadata: {} | ||
spec: | ||
containers: | ||
- image: docker.io/grafana/grafana:11.1.4 | ||
name: grafana | ||
volumeMounts: | ||
- mountPath: /etc/ssl/certs/ca-certificates.crt | ||
name: tls-ca-bundle | ||
readOnly: true | ||
subPath: tls-ca-bundle.pem | ||
volumes: | ||
- name: tls-ca-bundle | ||
secret: | ||
items: | ||
- key: tls-ca-bundle.pem | ||
path: tls-ca-bundle.pem | ||
secretName: tls-ca-bundle-secret | ||
version: 10.4.3 | ||
status: |
Oops, something went wrong.