Support deploying OVN as container services
[apex-tripleo-heat-templates.git] / docker / services / ovn-controller.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Ovn Controller agent.
5
6 parameters:
7   EndpointMap:
8     default: {}
9     description: Mapping of service endpoint -> protocol. Typically set
10                  via parameter_defaults in the resource registry.
11     type: json
12   ServiceNetMap:
13     default: {}
14     description: Mapping of service_name -> network name. Typically set
15                  via parameter_defaults in the resource registry.  This
16                  mapping overrides those in ServiceNetMapDefaults.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   DockerOvnControllerImage:
23     description: image
24     type: string
25   DockerOvnControllerConfigImage:
26     description: The container image to use for the ovn_controller config_volume
27     type: string
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39
40 resources:
41
42   ContainersCommon:
43     type: ./containers-common.yaml
44
45   OvnControllerBase:
46     type: ../../puppet/services/ovn-controller.yaml
47     properties:
48       EndpointMap: {get_param: EndpointMap}
49       ServiceData: {get_param: ServiceData}
50       ServiceNetMap: {get_param: ServiceNetMap}
51       DefaultPasswords: {get_param: DefaultPasswords}
52       RoleName: {get_param: RoleName}
53       RoleParameters: {get_param: RoleParameters}
54
55 outputs:
56   role_data:
57     description: Role data for the Ovn Controller agent.
58     value:
59       service_name: {get_attr: [OvnControllerBase, role_data, service_name]}
60       config_settings:
61         map_merge:
62           - get_attr: [OvnControllerBase, role_data, config_settings]
63       step_config: &step_config
64         get_attr: [OvnControllerBase, role_data, step_config]
65       service_config_settings: {get_attr: [OvnControllerBase, role_data, service_config_settings]}
66       # BEGIN DOCKER SETTINGS
67       puppet_config:
68         puppet_tags: vs_config
69         config_volume: ovn_controller
70         step_config: *step_config
71         config_image: {get_param: DockerOvnControllerConfigImage}
72         # We need to mount /run for puppet_config step. This is because
73         # puppet-vswitch runs the commands "ovs-vsctl set open_vswitch . external_ids:..."
74         # to configure the required parameters in ovs db which will be read
75         # by ovn-controller. And ovs-vsctl talks to the ovsdb-server (hosting conf.db)
76         # on the unix domain socket - /run/openvswitch/db.sock
77         volumes:
78           - /lib/modules:/lib/modules:ro
79           - /run/openvswitch:/run/openvswitch
80       kolla_config:
81         /var/lib/kolla/config_files/ovn_controller.json:
82           command: /usr/bin/ovn-controller --pidfile --log-file unix:/run/openvswitch/db.sock
83           permissions:
84             - path: /var/log/openvswitch
85               owner: root:root
86               recurse: true
87       docker_config:
88         step_4:
89           ovn_controller:
90             image: {get_param: DockerOvnControllerImage}
91             net: host
92             privileged: true
93             user: root
94             restart: always
95             volumes:
96               - /var/lib/kolla/config_files/ovn_controller.json:/var/lib/kolla/config_files/config.json:ro
97               - /lib/modules:/lib/modules:ro
98               - /run/openvswitch:/run/openvswitch
99               - /var/log/containers/openvswitch:/var/log/openvswitch
100             environment:
101               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
102       upgrade_tasks:
103         - name: Stop and disable ovn-controller service
104           tags: step2
105           service: name=ovn-controller state=stopped enabled=no