Merge "Default Ceph pg_num and pgp_num to 128" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / nova-migration-target.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Nova Migration Target service
5
6 parameters:
7   DockerNovaComputeImage:
8     description: image
9     type: string
10   DockerNovaLibvirtConfigImage:
11     description: The container image to use for the nova_libvirt config_volume
12     type: string
13   ServiceData:
14     default: {}
15     description: Dictionary packing service data
16     type: json
17   ServiceNetMap:
18     default: {}
19     description: Mapping of service_name -> network name. Typically set
20                  via parameter_defaults in the resource registry.  This
21                  mapping overrides those in ServiceNetMapDefaults.
22     type: json
23   DefaultPasswords:
24     default: {}
25     type: json
26   RoleName:
27     default: ''
28     description: Role name on which the service is applied
29     type: string
30   RoleParameters:
31     default: {}
32     description: Parameters specific to the role
33     type: json
34   EndpointMap:
35     default: {}
36     description: Mapping of service endpoint -> protocol. Typically set
37                  via parameter_defaults in the resource registry.
38     type: json
39   DockerNovaMigrationSshdPort:
40     default: 2022
41     description: Port that dockerized nova migration target sshd service
42                  binds to.
43     type: number
44   MigrationSshKey:
45     type: json
46     description: >
47       SSH key for migration.
48       Expects a dictionary with keys 'public_key' and 'private_key'.
49       Values should be identical to SSH public/private key files.
50     default:
51       public_key: ''
52       private_key: ''
53   MigrationSshPort:
54     default: 2022
55     description: Target port for migration over ssh
56     type: number
57
58 conditions:
59
60   # During Ocata->Pike upgrade initially configure the ssh service on port 22
61   # to proxy migration commands to the containerized sshd on port 2022.
62   # When the upgrade converges we can switch migrations over to port 2022.
63   enable_migration_proxy:
64     equals:
65       - {get_param: MigrationSshPort}
66       - 22
67
68 resources:
69
70   ContainersCommon:
71     type: ./containers-common.yaml
72
73   SshdBase:
74     type: ../../puppet/services/sshd.yaml
75     properties:
76       EndpointMap: {get_param: EndpointMap}
77       ServiceNetMap: {get_param: ServiceNetMap}
78       DefaultPasswords: {get_param: DefaultPasswords}
79       RoleName: {get_param: RoleName}
80       RoleParameters: {get_param: RoleParameters}
81
82   NovaMigrationTargetBase:
83     type: ../../puppet/services/nova-migration-target.yaml
84     properties:
85       EndpointMap: {get_param: EndpointMap}
86       ServiceNetMap: {get_param: ServiceNetMap}
87       DefaultPasswords: {get_param: DefaultPasswords}
88       RoleName: {get_param: RoleName}
89       RoleParameters: {get_param: RoleParameters}
90
91 outputs:
92   role_data:
93     description: Role data for the Nova Migration Target service.
94     value:
95       service_name: nova_migration_target
96       config_settings:
97         map_merge:
98           - get_attr: [SshdBase, role_data, config_settings]
99           - get_attr: [NovaMigrationTargetBase, role_data, config_settings]
100           # NB this prevents the baremetal ssh from listening on port 2022
101           # It doesn't affect the sshd port in the container as we override it below on the sshd cli
102           - tripleo::profile::base::sshd::port: 22
103           - if:
104             - enable_migration_proxy
105             - tripleo::profile::base::nova::migration::proxy::ssh_private_key: {get_param: [ MigrationSshKey, private_key ]}
106               tripleo::profile::base::nova::migration::proxy::target_port: {get_param: DockerNovaMigrationSshdPort}
107               tripleo::profile::base::nova::migration::proxy::target_host: "%{hiera('live_migration_ssh_inbound_addr')}"
108             - {}
109       step_config: &step_config
110         list_join:
111           - "\n"
112           - - get_attr: [SshdBase, role_data, step_config]
113             - get_attr: [NovaMigrationTargetBase, role_data, step_config]
114       puppet_config:
115         config_volume: nova_libvirt
116         step_config: *step_config
117         config_image: {get_param: DockerNovaLibvirtConfigImage}
118       kolla_config:
119         /var/lib/kolla/config_files/nova-migration-target.json:
120           command:
121             str_replace:
122               template: "/usr/sbin/sshd -D -p SSHDPORT"
123               params:
124                 SSHDPORT: {get_param: DockerNovaMigrationSshdPort}
125           config_files:
126             - source: "/var/lib/kolla/config_files/src/*"
127               dest: "/"
128               merge: true
129               preserve_properties: true
130             - source: /host-ssh/ssh_host_*_key
131               dest: /etc/ssh/
132               owner: "root"
133               perm: "0600"
134       docker_config:
135         step_4:
136           nova_migration_target:
137             image: {get_param: DockerNovaComputeImage}
138             net: host
139             privileged: true
140             user: root
141             restart: always
142             volumes:
143               list_concat:
144                 - {get_attr: [ContainersCommon, volumes]}
145                 -
146                   - /var/lib/kolla/config_files/nova-migration-target.json:/var/lib/kolla/config_files/config.json:ro
147                   - /var/lib/config-data/puppet-generated/nova_libvirt/:/var/lib/kolla/config_files/src:ro
148                   - /etc/ssh/:/host-ssh/:ro
149                   - /run:/run
150                   - /var/lib/nova:/var/lib/nova
151             environment:
152              - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS