Lookup container name in cni_ds_init

If your kuryr-cni pod definition consists of multiple containers (e.g.
you've added an initContainer), cni_ds_init script is prone to error
when looking up the container running kuryr-daemon. This is becasue it's
only looking at pod name and namespace. This commit extends it by adding
container.name=kuryr-cni to the conditions.

Change-Id: Ib45f6f9f366a62d373c6f37def07e7dcc862726d
Closes-Bug: 1808969
This commit is contained in:
Michał Dulko 2018-12-18 13:17:05 +01:00
parent 396a95140d
commit 65f86ae58e
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ for container in containers:
if (label_key in container and
container[label_key].get('io.kubernetes.pod.name') == '${KURYR_CNI_POD_NAME}' and
container[label_key].get('io.kubernetes.pod.namespace') == '${POD_NAMESPACE}' and
container[label_key].get('io.kubernetes.container.name') != 'POD'):
container[label_key].get('io.kubernetes.container.name') == 'kuryr-cni'):
print(container[id_key])
break
"