diff --git a/crd-docs/cr/kiali.io_v1alpha1_kiali.yaml b/crd-docs/cr/kiali.io_v1alpha1_kiali.yaml index c1a6002f..22ca29cc 100644 --- a/crd-docs/cr/kiali.io_v1alpha1_kiali.yaml +++ b/crd-docs/cr/kiali.io_v1alpha1_kiali.yaml @@ -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 diff --git a/crd-docs/crd/kiali.io_kialis.yaml b/crd-docs/crd/kiali.io_kialis.yaml index 81c18009..a0916706 100644 --- a/crd-docs/crd/kiali.io_kialis.yaml +++ b/crd-docs/crd/kiali.io_kialis.yaml @@ -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 diff --git a/molecule/config-values-test/converge.yml b/molecule/config-values-test/converge.yml index 061a971a..e710b38a 100644 --- a/molecule/config-values-test/converge.yml +++ b/molecule/config-values-test/converge.yml @@ -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. @@ -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 }}" @@ -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 }}" diff --git a/roles/default/kiali-deploy/defaults/main.yml b/roles/default/kiali-deploy/defaults/main.yml index 38579ae5..a4f59f78 100644 --- a/roles/default/kiali-deploy/defaults/main.yml +++ b/roles/default/kiali-deploy/defaults/main.yml @@ -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: diff --git a/roles/default/kiali-deploy/templates/kubernetes/deployment.yaml b/roles/default/kiali-deploy/templates/kubernetes/deployment.yaml index a669a22e..556bb528 100644 --- a/roles/default/kiali-deploy/templates/kubernetes/deployment.yaml +++ b/roles/default/kiali-deploy/templates/kubernetes/deployment.yaml @@ -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: diff --git a/roles/default/kiali-deploy/templates/openshift/deployment.yaml b/roles/default/kiali-deploy/templates/openshift/deployment.yaml index c62442d2..7c60d787 100644 --- a/roles/default/kiali-deploy/templates/openshift/deployment.yaml +++ b/roles/default/kiali-deploy/templates/openshift/deployment.yaml @@ -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: