From ccbdfaea5c43702b35aa9fd28d9abfcf123e32e4 Mon Sep 17 00:00:00 2001
From: wuchunyang <wuchunyang@yovole.com>
Date: Wed, 19 Oct 2022 19:39:11 +0800
Subject: [PATCH] Mount /run directory into zun_cni_daemon container

During zun_cni_daemon binds the port to container netns,
zun_cni_damon creates a new net namepsaces(cni-xxx),
Currently, the namespace is only present inside the
zun_cni_daemon container, if this container restart or
rerun, all zun capsules will lost network capability.

Closes-Bug: #1993551

Change-Id: I3642bbf1ad8e8f4744b215fb8deff25fd4ceae75
---
 ansible/roles/zun/defaults/main.yml                          | 1 +
 .../notes/fix-zun_cni_daemon-mounts-9a7664896cfc7a9f.yaml    | 5 +++++
 2 files changed, 6 insertions(+)
 create mode 100644 releasenotes/notes/fix-zun_cni_daemon-mounts-9a7664896cfc7a9f.yaml

diff --git a/ansible/roles/zun/defaults/main.yml b/ansible/roles/zun/defaults/main.yml
index 8a2533d007..edb727c9ca 100644
--- a/ansible/roles/zun/defaults/main.yml
+++ b/ansible/roles/zun/defaults/main.yml
@@ -188,6 +188,7 @@ zun_cni_daemon_default_volumes:
   - "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}"
   - "kolla_logs:/var/log/kolla/"
   - "{{ kolla_dev_repos_directory ~ '/zun/zun:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/zun' if zun_dev_mode | bool else '' }}"
+  - "/run:/run:shared"
 
 zun_extra_volumes: "{{ default_extra_volumes }}"
 zun_api_extra_volumes: "{{ zun_extra_volumes }}"
diff --git a/releasenotes/notes/fix-zun_cni_daemon-mounts-9a7664896cfc7a9f.yaml b/releasenotes/notes/fix-zun_cni_daemon-mounts-9a7664896cfc7a9f.yaml
new file mode 100644
index 0000000000..536af8d132
--- /dev/null
+++ b/releasenotes/notes/fix-zun_cni_daemon-mounts-9a7664896cfc7a9f.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Fix zun capsules lose the network namespaces after restarting
+    zun_cni_daemon container
-- 
GitLab