Adds network/cidr mapping into a new service property
[apex-tripleo-heat-templates.git] / docker / services / swift-proxy.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized swift proxy service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerSwiftProxyImage:
12     description: image
13     default: 'centos-binary-swift-proxy-server:latest'
14     type: string
15   DockerSwiftConfigImage:
16     description: The container image to use for the swift config_volume
17     default: 'centos-binary-swift-proxy-server:latest'
18     type: string
19   EndpointMap:
20     default: {}
21     description: Mapping of service endpoint -> protocol. Typically set
22                  via parameter_defaults in the resource registry.
23     type: json
24   ServiceData:
25     default: {}
26     description: Dictionary packing service data
27     type: json
28   ServiceNetMap:
29     default: {}
30     description: Mapping of service_name -> network name. Typically set
31                  via parameter_defaults in the resource registry.  This
32                  mapping overrides those in ServiceNetMapDefaults.
33     type: json
34   DefaultPasswords:
35     default: {}
36     type: json
37   RoleName:
38     default: ''
39     description: Role name on which the service is applied
40     type: string
41   RoleParameters:
42     default: {}
43     description: Parameters specific to the role
44     type: json
45   EnableInternalTLS:
46     type: boolean
47     default: false
48
49 conditions:
50
51   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
52
53 resources:
54
55   ContainersCommon:
56     type: ./containers-common.yaml
57
58   SwiftProxyBase:
59     type: ../../puppet/services/swift-proxy.yaml
60     properties:
61       EndpointMap: {get_param: EndpointMap}
62       ServiceData: {get_param: ServiceData}
63       ServiceNetMap: {get_param: ServiceNetMap}
64       DefaultPasswords: {get_param: DefaultPasswords}
65       RoleName: {get_param: RoleName}
66       RoleParameters: {get_param: RoleParameters}
67
68 outputs:
69   role_data:
70     description: Role data for the swift proxy.
71     value:
72       service_name: {get_attr: [SwiftProxyBase, role_data, service_name]}
73       config_settings: {get_attr: [SwiftProxyBase, role_data, config_settings]}
74       step_config: &step_config
75         get_attr: [SwiftProxyBase, role_data, step_config]
76       service_config_settings: {get_attr: [SwiftProxyBase, role_data, service_config_settings]}
77       # BEGIN DOCKER SETTINGS
78       puppet_config:
79         config_volume: swift
80         puppet_tags: swift_proxy_config
81         step_config: *step_config
82         config_image:
83           list_join:
84             - '/'
85             - [ {get_param: DockerNamespace}, {get_param: DockerSwiftConfigImage} ]
86       kolla_config:
87         /var/lib/kolla/config_files/swift_proxy.json:
88           command: /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf
89           config_files:
90             - source: "/var/lib/kolla/config_files/src/*"
91               dest: "/"
92               merge: true
93               preserve_properties: true
94           permissions:
95             - path: /var/log/swift
96               owner: swift:swift
97               recurse: true
98         /var/lib/kolla/config_files/swift_proxy_tls_proxy.json:
99           command: /usr/sbin/httpd -DFOREGROUND
100           config_files:
101             - source: "/var/lib/kolla/config_files/src/*"
102               dest: "/"
103               merge: true
104               preserve_properties: true
105       docker_config:
106         step_4:
107           map_merge:
108             - swift_proxy:
109                 image: &swift_proxy_image
110                   list_join:
111                     - '/'
112                     - [ {get_param: DockerNamespace}, {get_param: DockerSwiftProxyImage} ]
113                 net: host
114                 user: swift
115                 restart: always
116                 volumes:
117                   list_concat:
118                     - {get_attr: [ContainersCommon, volumes]}
119                     -
120                       - /var/lib/kolla/config_files/swift_proxy.json:/var/lib/kolla/config_files/config.json:ro
121                       - /var/lib/config-data/puppet-generated/swift/:/var/lib/kolla/config_files/src:ro
122                       - /run:/run
123                       - /srv/node:/srv/node
124                       - /dev:/dev
125                       - /var/log/containers/swift:/var/log/swift
126                 environment:
127                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
128             - if:
129                 - internal_tls_enabled
130                 - swift_proxy_tls_proxy:
131                     image: *swift_proxy_image
132                     net: host
133                     user: root
134                     restart: always
135                     volumes:
136                       list_concat:
137                         - {get_attr: [ContainersCommon, volumes]}
138                         -
139                           - /var/lib/kolla/config_files/swift_proxy_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
140                           - /var/lib/config-data/puppet-generated/swift/:/var/lib/kolla/config_files/src:ro
141                           - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
142                           - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
143                     environment:
144                       - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
145                 - {}
146       host_prep_tasks:
147         - name: create persistent directories
148           file:
149             path: "{{ item }}"
150             state: directory
151           with_items:
152             - /var/log/containers/swift
153             - /srv/node
154       upgrade_tasks:
155         - name: Stop and disable swift_proxy service
156           tags: step2
157           service: name=openstack-swift-proxy state=stopped enabled=no
158       metadata_settings:
159         get_attr: [SwiftProxyBase, role_data, metadata_settings]