Add readiness checks to ovs agent
This commit adds readiness checks to neutron ovs agent to check if the ovs and dpdk configurations are working without errors. Change-Id: I48277bdbd91ec8121e5fec300aeb646a80a65d29
This commit is contained in:
parent
c54f51c603
commit
fa92e365f5
@ -21,6 +21,10 @@ set -ex
|
||||
OVS_SOCKET=/run/openvswitch/db.sock
|
||||
chown neutron: ${OVS_SOCKET}
|
||||
|
||||
# This enables the usage of 'ovs-appctl' from neutron pod.
|
||||
OVS_PID=$(cat /run/openvswitch/ovs-vswitchd.pid)
|
||||
OVS_CTL=/run/openvswitch/ovs-vswitchd.${OVS_PID}.ctl
|
||||
chown neutron: ${OVS_CTL}
|
||||
|
||||
function get_dpdk_config_value {
|
||||
values=$1
|
||||
|
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
{{/*
|
||||
Copyright 2019 The Openstack-Helm Authors.
|
||||
|
||||
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
|
||||
|
||||
OVS_PID=$(cat /run/openvswitch/ovs-vswitchd.pid)
|
||||
OVS_CTL=/run/openvswitch/ovs-vswitchd.${OVS_PID}.ctl
|
||||
|
||||
ovs-vsctl list-br | grep -q br-int
|
||||
|
||||
[ -z "$(/usr/bin/ovs-vsctl show | grep error:)" ]
|
||||
|
||||
{{ if .Values.conf.ovs_dpdk.enabled }}
|
||||
|
||||
# Check if dpdk is initialized
|
||||
[ "$(ovs-vsctl get Open_vSwitch . dpdk_initialized)" == true ]
|
||||
|
||||
{{- if hasKey .Values.conf.ovs_dpdk "nics"}}
|
||||
# Check if port(s) and bridge(s) are configured.
|
||||
{{- range .Values.conf.ovs_dpdk.nics }}
|
||||
ovs-vsctl list-br | grep -q {{ .bridge }}
|
||||
ovs-vsctl list-ports {{ .bridge }} | grep -q {{ .name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if hasKey .Values.conf.ovs_dpdk "bonds"}}
|
||||
# Check if bond(s) and slave(s) are configured.
|
||||
{{- range .Values.conf.ovs_dpdk.bonds }}
|
||||
bond={{ .name }}
|
||||
ovs-appctl -t ${OVS_CTL} bond/list | grep -q ${bond}
|
||||
{{- range .nics }}
|
||||
ovs-appctl -t ${OVS_CTL} bond/show ${bond} | grep -q "slave {{ .name }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{ end }}
|
@ -67,6 +67,8 @@ data:
|
||||
{{ tuple "bin/_neutron-openvswitch-agent-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
neutron-openvswitch-agent-init-modules.sh: |
|
||||
{{ 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-sriov-agent.sh: |
|
||||
{{ tuple "bin/_neutron-sriov-agent.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
neutron-sriov-agent-init.sh: |
|
||||
|
@ -15,13 +15,9 @@ limitations under the License.
|
||||
*/}}
|
||||
|
||||
{{- define "ovsAgentReadinessProbeTemplate" }}
|
||||
# ensures this container can can see a br-int
|
||||
# bridge before its marked as ready
|
||||
exec:
|
||||
command:
|
||||
- bash
|
||||
- -c
|
||||
- 'ovs-vsctl list-br | grep -q br-int'
|
||||
- /tmp/neutron-openvswitch-agent-readiness.sh
|
||||
{{- end }}
|
||||
{{- define "ovsAgentLivenessProbeTemplate" }}
|
||||
exec:
|
||||
@ -204,6 +200,10 @@ spec:
|
||||
mountPath: /tmp/neutron-openvswitch-agent.sh
|
||||
subPath: neutron-openvswitch-agent.sh
|
||||
readOnly: true
|
||||
- name: neutron-bin
|
||||
mountPath: /tmp/neutron-openvswitch-agent-readiness.sh
|
||||
subPath: neutron-openvswitch-agent-readiness.sh
|
||||
readOnly: true
|
||||
- name: neutron-bin
|
||||
mountPath: /tmp/health-probe.py
|
||||
subPath: health-probe.py
|
||||
|
Loading…
x
Reference in New Issue
Block a user