all: Actually honor public DNS set in IDF
[fuel.git] / mcp / scripts / docker-compose / docker-compose.yaml.j2
1 ##############################################################################
2 # Copyright (c) 2018 Mirantis Inc., Enea AB and others.
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7 ##############################################################################
8 {%- import 'net_map.j2' as nm with context %}
9 {%- import 'net_macros.j2' as ma with context %}
10 {#- conf.MCPCONTROL_NET & co are mandatory, defaults are set via globals.sh #}
11 {%- set net_mcpcontrol = [conf.MCPCONTROL_NET, conf.MCPCONTROL_PREFIX] | join("/") %}
12 version: '2'
13 services:
14   opnfv-fuel-salt-master:
15     container_name: "fuel"
16     image: "opnfv/fuel:saltmaster-reclass-{{ conf.MCP_DOCKER_TAG }}"
17     restart: always
18     networks:
19       mcpcontrol:
20         ipv4_address: {{ conf.SALT_MASTER }}
21       pxebr:
22         ipv4_address: {{ nm.net_admin | ipnet_hostaddr(nm.start_ip[nm.net_admin] + nm.net_admin_hosts.index('opnfv_infra_config_pxe_admin_address') +1) }}
23       mgmt:
24         ipv4_address: {{ nm.net_mgmt | ipnet_hostaddr(nm.start_ip[nm.net_mgmt] + nm.net_mgmt_hosts.index('opnfv_infra_config_address') +1) }}
25     volumes:
26       - /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro
27       - {{ conf.MCP_REPO_ROOT_PATH }}:/root/fuel
28       - {{ conf.MCP_REPO_ROOT_PATH }}/mcp/scripts/docker-compose/files/entrypoint.sh:/entrypoint.sh
29       - {{ conf.MCP_STORAGE_DIR }}/pod_config.yml:/root/pod_config.yml
30       - {{ conf.MCP_STORAGE_DIR }}/nodes:/srv/salt/reclass/nodes
31       - {{ conf.MCP_STORAGE_DIR }}/pki:/etc/pki
32       - {{ conf.MCP_STORAGE_DIR }}/salt:/etc/salt
33       - {{ conf.MCP_STORAGE_DIR }}/hosts:/etc/hosts
34 {%- if conf.MCP_VCP or '-vcp-' in conf.MCP_DEPLOY_SCENARIO %}
35       - {{ conf.MCP_STORAGE_DIR }}/base_image_opnfv_fuel_vcp.img:/srv/salt/env/prd/salt/files/control/images/base_image_opnfv_fuel_vcp.img
36 {%- endif %}
37     hostname: cfg01
38     domainname: {{ conf.cluster.domain }}
39     privileged: true
40     dns:
41 {%- for server in nm.dns_public %}
42       - {{ server }}
43 {%- endfor %}
44 {%- if nm.cluster.has_baremetal_nodes %}
45   opnfv-fuel-maas:
46     container_name: "maas"
47     image: "opnfv/fuel:saltminion-maas-{{ conf.MCP_DOCKER_TAG }}"
48     restart: always
49     networks:
50       mcpcontrol:
51         ipv4_address: {{ conf.MAAS_IP }}
52       pxebr:
53         ipv4_address: {{ nm.net_admin | ipnet_hostaddr(nm.start_ip[nm.net_admin] + nm.net_admin_hosts.index('opnfv_infra_maas_node01_deploy_address') +1) }}
54       mgmt:
55         ipv4_address: {{ nm.net_mgmt | ipnet_hostaddr(nm.start_ip[nm.net_mgmt] + nm.net_mgmt_hosts.index('opnfv_infra_maas_node01_address') +1) }}
56     volumes:
57       - /lib/modules:/lib/modules:ro
58       - /sys/fs/cgroup:/sys/fs/cgroup:ro
59       - /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro
60       - {{ conf.MCP_REPO_ROOT_PATH }}/mcp/scripts/docker-compose/files/entrypoint_maas.sh:/entrypoint.sh:ro
61       - {{ conf.MCP_STORAGE_DIR }}/hosts:/etc/hosts:ro
62       - {{ conf.MCP_STORAGE_DIR }}/mas01/etc/iptables:/etc/iptables
63       - {{ conf.MCP_STORAGE_DIR }}/mas01/var/lib/postgresql:/var/lib/postgresql
64       - {{ conf.MCP_STORAGE_DIR }}/mas01/var/lib/maas:/var/lib/maas
65       - {{ conf.MCP_STORAGE_DIR }}/mas01/var/spool/maas-proxy:/var/spool/maas-proxy
66       - {{ conf.MCP_STORAGE_DIR }}/mas01/etc/maas:/etc/maas
67     hostname: mas01
68     domainname: {{ conf.cluster.domain }}
69     privileged: true
70     dns:
71 {%- for server in nm.dns_public %}
72       - {{ server }}
73 {%- endfor %}
74     ports:
75       - 5240:5240
76 {%- endif %}
77 networks:
78   mcpcontrol:
79     driver: bridge
80     driver_opts:
81       com.docker.network.driver.mtu: 9000
82     ipam:
83       config:
84         - subnet: {{ net_mcpcontrol }}
85   pxebr:
86     driver: macvlan
87     driver_opts:
88       parent: veth_mcp1  # Always untagged
89     ipam:
90       config:
91         - subnet: {{ nm.net_admin }}
92   mgmt:
93     driver: macvlan
94     driver_opts:
95 {%- if conf.idf.fuel.jumphost.get('trunks', {}).get('mgmt', False) %}
96       parent: {{ ma.interface_str('veth_mcp3', nm.vlan_mgmt) }}
97 {%- else %}
98       parent: veth_mcp3  # Untagged by default
99 {%- endif %}
100     ipam:
101       config:
102         - subnet: {{ nm.net_mgmt }}