Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

be able to configure server liveness/readiness/startup probe #847

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crd-docs/cr/kiali.io_v1alpha1_kiali.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@ spec:
pod_labels:
sidecar.istio.io/inject: "true"
priority_class_name: ""
probes:
liveness:
initial_delay_seconds: 5
period_seconds: 30
readiness:
initial_delay_seconds: 5
period_seconds: 30
startup:
failure_threshold: 6
initial_delay_seconds: 30
period_seconds: 10
remote_cluster_resources_only: false
replicas: 1
# default: resources is undefined
Expand Down
30 changes: 30 additions & 0 deletions crd-docs/crd/kiali.io_kialis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,36 @@ spec:
priority_class_name:
description: "The priorityClassName used to assign the priority of the Kiali pod."
type: string
probes:
description: "Configures the liveness, readiness, and startup probes of the Kiali pod."
type: object
properties:
liveness:
description: "Configures the liveness probe of the Kiali pod."
type: object
properties:
initial_delay_seconds:
type: integer
period_seconds:
type: integer
readiness:
description: "Configures the readiness probe of the Kiali pod."
type: object
properties:
initial_delay_seconds:
type: integer
period_seconds:
type: integer
startup:
description: "Configures the startup probe of the Kiali pod."
type: object
properties:
failure_threshold:
type: integer
initial_delay_seconds:
type: integer
period_seconds:
type: integer
remote_cluster_resources_only:
description: "When `true`, only those resources necessary for a remote Kiali Server to access this cluster are created (such as the service account and roles/bindings). There will be no Kiali Server deployment/pod created when this is `true`."
type: boolean
Expand Down
42 changes: 42 additions & 0 deletions molecule/config-values-test/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@
that:
- kiali_configmap.extensions | length == 0

- name: Test the default configs for the probes
vars:
kiali_pod_container: "{{ kiali_pod.resources[0].spec.containers[0] }}"
assert:
that:
- kiali_pod_container.livenessProbe.initialDelaySeconds == 5
- kiali_pod_container.livenessProbe.periodSeconds == 30
- kiali_pod_container.readinessProbe.initialDelaySeconds == 5
- kiali_pod_container.readinessProbe.periodSeconds == 30
- kiali_pod_container.startupProbe.failureThreshold == 6
- kiali_pod_container.startupProbe.initialDelaySeconds == 30
- kiali_pod_container.startupProbe.periodSeconds == 10

# This test will change some config settings to make sure things work like we expect.
# We will add additional tasks and asserts in the future to test other config changes.
# We load in the current kiali CR and then alter it with new config and deploy that new CR.
Expand Down Expand Up @@ -229,6 +242,22 @@
set_fact:
current_kiali_cr: "{{ current_kiali_cr | combine({'spec': {'extensions': extensions}}, recursive=True) }}"

- name: Customize probes
vars:
probes:
liveness:
initial_delay_seconds: 11
period_seconds: 12
readiness:
initial_delay_seconds: 13
period_seconds: 14
startup:
failure_threshold: 2
initial_delay_seconds: 15
period_seconds: 16
set_fact:
current_kiali_cr: "{{ current_kiali_cr | combine({'spec': {'deployment': {'probes': probes }}}, recursive=True) }}"

- name: The new Kiali CR to be tested
debug:
msg: "{{ current_kiali_cr }}"
Expand Down Expand Up @@ -391,6 +420,19 @@
- kiali_configmap.extensions[0].name == "skupper"
- kiali_configmap.extensions[0].enabled == False

- name: Test the custom configs for the probes
vars:
kiali_pod_container: "{{ kiali_pod.resources[0].spec.containers[0] }}"
assert:
that:
- kiali_pod_container.livenessProbe.initialDelaySeconds == 11
- kiali_pod_container.livenessProbe.periodSeconds == 12
- kiali_pod_container.readinessProbe.initialDelaySeconds == 13
- kiali_pod_container.readinessProbe.periodSeconds == 14
- kiali_pod_container.startupProbe.failureThreshold == 2
- kiali_pod_container.startupProbe.initialDelaySeconds == 15
- kiali_pod_container.startupProbe.periodSeconds == 16

- name: Test custom_envs
vars:
kiali_pod_envs: "{{ kiali_pod.resources[0].spec.containers[0].env }}"
Expand Down
11 changes: 11 additions & 0 deletions roles/default/kiali-deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ kiali_defaults:
pod_annotations: {}
pod_labels: {}
priority_class_name: ""
probes:
liveness:
initial_delay_seconds: 5
period_seconds: 30
readiness:
initial_delay_seconds: 5
period_seconds: 30
startup:
failure_threshold: 6
initial_delay_seconds: 30
period_seconds: 10
remote_cluster_resources_only: false
replicas: 1
#resources:
Expand Down
14 changes: 7 additions & 7 deletions roles/default/kiali-deploy/templates/kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,23 @@ spec:
path: {{ kiali_vars.server.web_root | regex_replace('\\/$', '') }}/healthz
port: api-port
scheme: {{ 'HTTP' if kiali_vars.identity.cert_file == "" else 'HTTPS' }}
initialDelaySeconds: 5
periodSeconds: 30
initialDelaySeconds: {{ kiali_vars.deployment.probes.readiness.initial_delay_seconds|int }}
periodSeconds: {{ kiali_vars.deployment.probes.readiness.period_seconds|int }}
livenessProbe:
httpGet:
path: {{ kiali_vars.server.web_root | regex_replace('\\/$', '') }}/healthz
port: api-port
scheme: {{ 'HTTP' if kiali_vars.identity.cert_file == "" else 'HTTPS' }}
initialDelaySeconds: 5
periodSeconds: 30
initialDelaySeconds: {{ kiali_vars.deployment.probes.liveness.initial_delay_seconds|int }}
periodSeconds: {{ kiali_vars.deployment.probes.liveness.period_seconds|int }}
startupProbe:
httpGet:
path: {{ kiali_vars.server.web_root | regex_replace('\\/$', '') }}/healthz
port: api-port
scheme: {{ 'HTTP' if kiali_vars.identity.cert_file == "" else 'HTTPS' }}
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
failureThreshold: {{ kiali_vars.deployment.probes.startup.failure_threshold|int }}
initialDelaySeconds: {{ kiali_vars.deployment.probes.startup.initial_delay_seconds|int }}
periodSeconds: {{ kiali_vars.deployment.probes.startup.period_seconds|int }}
env:
- name: ACTIVE_NAMESPACE
valueFrom:
Expand Down
14 changes: 7 additions & 7 deletions roles/default/kiali-deploy/templates/openshift/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,23 @@ spec:
path: {{ kiali_vars.server.web_root | regex_replace('\\/$', '') }}/healthz
port: api-port
scheme: {{ 'HTTP' if kiali_vars.identity.cert_file == "" else 'HTTPS' }}
initialDelaySeconds: 5
periodSeconds: 30
initialDelaySeconds: {{ kiali_vars.deployment.probes.readiness.initial_delay_seconds|int }}
periodSeconds: {{ kiali_vars.deployment.probes.readiness.period_seconds|int }}
livenessProbe:
httpGet:
path: {{ kiali_vars.server.web_root | regex_replace('\\/$', '') }}/healthz
port: api-port
scheme: {{ 'HTTP' if kiali_vars.identity.cert_file == "" else 'HTTPS' }}
initialDelaySeconds: 5
periodSeconds: 30
initialDelaySeconds: {{ kiali_vars.deployment.probes.liveness.initial_delay_seconds|int }}
periodSeconds: {{ kiali_vars.deployment.probes.liveness.period_seconds|int }}
startupProbe:
httpGet:
path: {{ kiali_vars.server.web_root | regex_replace('\\/$', '') }}/healthz
port: api-port
scheme: {{ 'HTTP' if kiali_vars.identity.cert_file == "" else 'HTTPS' }}
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
failureThreshold: {{ kiali_vars.deployment.probes.startup.failure_threshold|int }}
initialDelaySeconds: {{ kiali_vars.deployment.probes.startup.initial_delay_seconds|int }}
periodSeconds: {{ kiali_vars.deployment.probes.startup.period_seconds|int }}
env:
- name: ACTIVE_NAMESPACE
valueFrom:
Expand Down