kolla-ansible/ansible/roles/zun/handlers/main.yml
Hongbin Lu 91678f67af Zun: Add zun-cni-daemon to compute node
Zun has a new component "zun-cni-daemon" which should be
deployed in every compute nodes. It is basically an implementation
of CNI (Container Network Interface) that performs the neutron
port binding.

If users is using the capsule (pod) API, the recommended deployment
option is using "cri" as capsule driver. This is basically to use
a CRI runtime (i.e. CRI plugin for containerd) for supporting
capsules (pods). A CRI runtime needs a CNI plugin which is what
the "zun-cni-daemon" provides.

The configuration is based on the Zun installation guide [1].
It consits of the following steps:
* Configure the containerd daemon in the host. The "zun-compute"
  container will use grpc to communicate with this service.
* Install the "zun-cni" binary at host. The containerd process
  will invoke this binary to call the CNI plugin.
* Run a "zun-cni-daemon" container. The "zun-cni" binary will
  communicate with this container via HTTP.

Relevant patches:
Blueprint: https://blueprints.launchpad.net/zun/+spec/add-support-cri-runtime
Install guide: https://review.opendev.org/#/c/707948/
Devstack plugin: https://review.opendev.org/#/c/705338/
Kolla image: https://review.opendev.org/#/c/708273/

[1] https://docs.openstack.org/zun/latest/install/index.html

Depends-On: https://review.opendev.org/#/c/721044/
Change-Id: I9c361a99b355af27907cf80f5c88d97191193495
2020-04-30 02:22:20 +00:00

85 lines
2.8 KiB
YAML

---
- name: Restart zun-api container
vars:
service_name: "zun-api"
service: "{{ zun_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
listen:
- zun-api container changed
when:
- kolla_action != "config"
- name: Restart zun-wsproxy container
vars:
service_name: "zun-wsproxy"
service: "{{ zun_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
listen:
- zun-wsproxy container changed
when:
- kolla_action != "config"
- name: Restart zun-compute container
vars:
service_name: "zun-compute"
service: "{{ zun_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
listen:
- zun-compute container changed
when:
- kolla_action != "config"
- name: Restart zun-cni-daemon container
vars:
service_name: "zun-cni-daemon"
service: "{{ zun_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
listen:
- zun-cni-daemon container changed
when:
- kolla_action != "config"
- name: Copy loopback binary from zun-cni-daemon container to host
vars:
service_name: "zun-cni-daemon"
service: "{{ zun_services[service_name] }}"
become: true
command: "docker cp {{ service.container_name }}:/opt/loopback /opt/cni/bin/"
# NOTE(yoctozepto): it would be cleaner to listen only on image change
# but there is no such mechanism (yet) and container change should be
# good enough (better than including config change triggers)
listen:
- zun-cni-daemon container changed