From 483287239726e76f238d8d9a58506f0f405ec5f9 Mon Sep 17 00:00:00 2001 From: Alexey Odinokov Date: Tue, 25 Apr 2023 21:36:17 -0500 Subject: [PATCH] Include readiness check into liveness probe It appears that readiness probe may not pass but liveness probe passes in some rare cases and it would be nice to restart the pod if readiness probe doesn't pass for a long time. Change-Id: I12049e4e84e2bc7d5ad90334ecdf91e25c61e575 --- neutron/Chart.yaml | 2 +- ..._neutron-openvswitch-agent-liveness.sh.tpl | 33 +++++++++++++++++++ neutron/templates/configmap-bin.yaml | 2 ++ neutron/templates/daemonset-ovs-agent.yaml | 17 +++------- releasenotes/notes/neutron.yaml | 1 + 5 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 neutron/templates/bin/_neutron-openvswitch-agent-liveness.sh.tpl diff --git a/neutron/Chart.yaml b/neutron/Chart.yaml index 342755bf64..6e042c9c85 100644 --- a/neutron/Chart.yaml +++ b/neutron/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Neutron name: neutron -version: 0.3.8 +version: 0.3.9 home: https://docs.openstack.org/neutron/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Neutron/OpenStack_Project_Neutron_vertical.png sources: diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-liveness.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-liveness.sh.tpl new file mode 100644 index 0000000000..274ec53264 --- /dev/null +++ b/neutron/templates/bin/_neutron-openvswitch-agent-liveness.sh.tpl @@ -0,0 +1,33 @@ +#!/bin/bash + +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +set -e + +/tmp/neutron-openvswitch-agent-readiness.sh + +python \ + /tmp/health-probe.py \ + --config-file \ + /etc/neutron/neutron.conf \ + --config-file \ + /etc/neutron/plugins/ml2/openvswitch_agent.ini \ + --agent-queue-name \ + q-agent-notifier-tunnel-update \ + --liveness-probe +{{- if .Values.pod.use_fqdn.neutron_agent }} + --use-fqdn \ +{{- end }} + --liveness-probe diff --git a/neutron/templates/configmap-bin.yaml b/neutron/templates/configmap-bin.yaml index a701c52a30..cee77235b0 100644 --- a/neutron/templates/configmap-bin.yaml +++ b/neutron/templates/configmap-bin.yaml @@ -67,6 +67,8 @@ data: {{ tuple "bin/_neutron-openvswitch-agent-init-modules.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} neutron-openvswitch-agent-readiness.sh: | {{ tuple "bin/_neutron-openvswitch-agent-readiness.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + neutron-openvswitch-agent-liveness.sh: | +{{ tuple "bin/_neutron-openvswitch-agent-liveness.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} neutron-sriov-agent.sh: | {{ tuple "bin/_neutron-sriov-agent.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} neutron-sriov-agent-init.sh: | diff --git a/neutron/templates/daemonset-ovs-agent.yaml b/neutron/templates/daemonset-ovs-agent.yaml index 59e33f0ffa..5a2d03701a 100644 --- a/neutron/templates/daemonset-ovs-agent.yaml +++ b/neutron/templates/daemonset-ovs-agent.yaml @@ -20,18 +20,7 @@ exec: {{- define "ovsAgentLivenessProbeTemplate" }} exec: command: - - python - - /tmp/health-probe.py - - --config-file - - /etc/neutron/neutron.conf - - --config-file - - /etc/neutron/plugins/ml2/openvswitch_agent.ini - - --agent-queue-name - - q-agent-notifier-tunnel-update - - --liveness-probe -{{- if .Values.pod.use_fqdn.neutron_agent }} - - --use-fqdn -{{- end }} + - /tmp/neutron-openvswitch-agent-liveness.sh {{- end }} {{- define "neutron.ovs_agent.daemonset" }} @@ -212,6 +201,10 @@ spec: mountPath: /tmp/neutron-openvswitch-agent-readiness.sh subPath: neutron-openvswitch-agent-readiness.sh readOnly: true + - name: neutron-bin + mountPath: /tmp/neutron-openvswitch-agent-liveness.sh + subPath: neutron-openvswitch-agent-liveness.sh + readOnly: true - name: neutron-bin mountPath: /tmp/health-probe.py subPath: health-probe.py diff --git a/releasenotes/notes/neutron.yaml b/releasenotes/notes/neutron.yaml index 9f99ad9558..ccbe5662a5 100644 --- a/releasenotes/notes/neutron.yaml +++ b/releasenotes/notes/neutron.yaml @@ -50,4 +50,5 @@ neutron: - 0.3.6 Fix the issue that ovn metadata not work in muti-node enviroment - 0.3.7 Sync neutron db to ovn nb db when neutron-server start - 0.3.8 Define service_type in keystone_authtoken to support application credentials with access rules + - 0.3.9 Extend neutron liveness probe with readiness probe ...