From 2b66685594304806dae765ebe23bcfee05a5bd1a Mon Sep 17 00:00:00 2001 From: "rajesh.kudaka" Date: Fri, 19 Jul 2019 11:37:44 -0500 Subject: [PATCH] Enable probes override from values.yaml for ovs This commit enables overriding liveness/readiness probes configurations for openvswitch pods from values.yaml Change-Id: I4ec2b9e88bf8ed57e8ac9293f333969b63cef335 --- openvswitch/templates/daemonset-ovs-db.yaml | 33 +++++++++---------- .../templates/daemonset-ovs-vswitchd.yaml | 29 ++++++++-------- openvswitch/values.yaml | 29 ++++++++++++++++ 3 files changed, 61 insertions(+), 30 deletions(-) diff --git a/openvswitch/templates/daemonset-ovs-db.yaml b/openvswitch/templates/daemonset-ovs-db.yaml index 527d5b130..fed7b4413 100644 --- a/openvswitch/templates/daemonset-ovs-db.yaml +++ b/openvswitch/templates/daemonset-ovs-db.yaml @@ -14,6 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "ovsdblivenessProbeTemplate" }} +exec: + command: + - /usr/bin/ovs-vsctl + - show +{{- end }} +{{- define "ovsdbreadinessProbeTemplate" }} +exec: + command: + - /usr/bin/ovs-vsctl + - list + - Open_Vswitch +{{- end }} + {{- if .Values.manifests.daemonset_ovs_db }} {{- $envAll := . }} @@ -70,23 +84,8 @@ spec: {{ tuple $envAll "openvswitch_db_server" | include "helm-toolkit.snippets.image" | indent 10 }} {{ dict "envAll" $envAll "application" "openvswitch_db_server" "container" "server" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.ovs.db | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - readinessProbe: - exec: - command: - - /usr/bin/ovs-vsctl - - list - - Open_Vswitch - initialDelaySeconds: 90 - periodSeconds: 30 - timeoutSeconds: 5 - livenessProbe: - exec: - command: - - /usr/bin/ovs-vsctl - - show - initialDelaySeconds: 60 - periodSeconds: 30 - timeoutSeconds: 5 +{{ dict "envAll" $envAll "component" "ovs_db" "container" "ovs_db" "type" "liveness" "probeTemplate" (include "ovsdblivenessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} +{{ dict "envAll" $envAll "component" "ovs_db" "container" "ovs_db" "type" "readiness" "probeTemplate" (include "ovsdbreadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} command: - /tmp/openvswitch-db-server.sh - start diff --git a/openvswitch/templates/daemonset-ovs-vswitchd.yaml b/openvswitch/templates/daemonset-ovs-vswitchd.yaml index b855316b1..c98019897 100644 --- a/openvswitch/templates/daemonset-ovs-vswitchd.yaml +++ b/openvswitch/templates/daemonset-ovs-vswitchd.yaml @@ -14,6 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "ovsvswitchlivenessProbeTemplate" }} +exec: + command: + - /usr/bin/ovs-appctl + - bond/list +{{- end }} +{{- define "ovsvswitchreadinessProbeTemplate" }} +exec: + command: + - /bin/bash + - -c + - '! /usr/bin/ovs-vsctl show | grep -q error:' +{{- end }} + {{- if .Values.manifests.daemonset_ovs_vswitchd }} {{- $envAll := . }} @@ -84,19 +98,8 @@ of hugepages must still be defined in the values.yaml.*/}} {{ tuple $envAll $envAll.Values.pod.resources.ovs.vswitchd | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} # ensures this container can speak to the ovs database # successfully before its marked as ready - readinessProbe: - exec: - command: - - /usr/bin/ovs-vsctl - - show - livenessProbe: - exec: - command: - - /usr/bin/ovs-appctl - - bond/list - initialDelaySeconds: 60 - periodSeconds: 30 - timeoutSeconds: 5 +{{ dict "envAll" $envAll "component" "ovs_vswitch" "container" "ovs_vswitch" "type" "liveness" "probeTemplate" (include "ovsvswitchlivenessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} +{{ dict "envAll" $envAll "component" "ovs_vswitch" "container" "ovs_vswitch" "type" "readiness" "probeTemplate" (include "ovsvswitchreadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} command: - /tmp/openvswitch-vswitchd.sh - start diff --git a/openvswitch/values.yaml b/openvswitch/values.yaml index ee0a35eef..a2b20a2de 100644 --- a/openvswitch/values.yaml +++ b/openvswitch/values.yaml @@ -38,6 +38,35 @@ labels: node_selector_value: enabled pod: + probes: + ovs_db: + ovs_db: + liveness: + enabled: true + params: + initialDelaySeconds: 60 + periodSeconds: 30 + timeoutSeconds: 5 + readiness: + enabled: true + params: + initialDelaySeconds: 90 + periodSeconds: 30 + timeoutSeconds: 5 + ovs_vswitch: + ovs_vswitch: + liveness: + enabled: true + params: + initialDelaySeconds: 60 + periodSeconds: 30 + timeoutSeconds: 5 + readiness: + enabled: true + params: + failureThreshold: 3 + periodSeconds: 10 + timeoutSeconds: 1 security_context: openvswitch_db_server: pod: