Add dep for neutron-openvswitch-agent on a working openvswitch.

This ps adds a bit of code to the neutron-openvswitch-agent to
ensure that the openvswitch is actually running before starting
as neutron-openvswitch has a bug where it hangs if not.

Change-Id: I8e8e3c33cb13f921bce9977d7e020b61332215a4
This commit is contained in:
Kevin Fox 2017-01-25 12:01:39 -08:00
parent f5becb6e96
commit ca0db91857
2 changed files with 45 additions and 20 deletions

View File

@ -69,21 +69,43 @@ spec:
]
},
{
"name": "update-permissions",
"name": "deps-and-update-permissions",
"image": "{{ $imageFull }}",
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"securityContext": {
"runAsUser": 0
"runAsUser": 0,
"privileged": true
},
"command": [
"/bin/sh",
"-c",
"chown --recursive neutron.kolla /var/log/kolla;"
"chown --recursive neutron.kolla /var/log/kolla;
echo Waiting for openvswitch kernel module to load;
while true; do
loaded=$(lsmod | grep openvswitch | wc -l);
[ $loaded -ne 0 ] && break;
sleep 1;
done;
echo Done.;
timeout 5s ovs-dpctl show;
echo Waiting for openvswitch daemon to be responsive;
while true; do
timeout 5s ovs-appctl version;
[ $? -eq 0 ] && break;
sleep 1;
echo Trying again.;
done;
echo Done.;
"
],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
},
{
"name": "host-run",
"mountPath": "/var/run"
}
]
}
@ -91,6 +113,7 @@ spec:
spec:
hostNetwork: True
hostIPC: True
hostPID: True #needed for openvswitch pid file
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
containers:

View File

@ -47,6 +47,23 @@ spec:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "reqdependencies",
"image": {{ include "kubernetes_entrypoint_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"env": [
{
"name": "DEPENDENCY_SOCKET",
"value": "/var/run/openvswitch/db.sock"
}
],
"volumeMounts": [
{
"name": "openvswitch-run",
"mountPath": "/var/run/openvswitch/"
}
]
},
{
"name": "initialize-ovs-vswitchd",
"image": "{{ $imageFull }}",
@ -72,28 +89,12 @@ spec:
"mountPath": "/var/run/openvswitch/"
}
]
},
{
"name": "reqdependencies",
"image": {{ include "kubernetes_entrypoint_image_full" . | quote }},
"imagePullPolicy": {{ $imagePullPolicy | quote }},
"env": [
{
"name": "DEPENDENCY_SOCKET",
"value": "/var/run/openvswitch/db.sock"
}
],
"volumeMounts": [
{
"name": "openvswitch-run",
"mountPath": "/var/run/openvswitch/"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
hostPID: True #Needed for pidfile.
nodeSelector:
{{ $selectorKey }}: {{ $selectorValue | quote }}
containers:
@ -127,6 +128,7 @@ spec:
-vfile:info
--mlockall
--log-file=/var/log/kolla/openvswitch/ovs-vswitchd.log
--pidfile=/var/run/openvswitch/ovs-vswitchd.pid
{{- include "common_containers" . | indent 8 }}
volumes:
{{- include "common_volumes" . | indent 8 }}