bc8b3e80a4ca7515e291601100c667f1e1a39355
[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     networks:
18       mcpcontrol:
19         ipv4_address: {{ conf.SALT_MASTER }}
20       pxebr:
21         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) }}
22       mgmt:
23         ipv4_address: {{ nm.net_mgmt | ipnet_hostaddr(nm.start_ip[nm.net_mgmt] + nm.net_mgmt_hosts.index('opnfv_infra_config_address') +1) }}
24     volumes:
25       - /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro
26       - {{ conf.MCP_REPO_ROOT_PATH }}:/root/fuel
27       - {{ conf.MCP_REPO_ROOT_PATH }}/mcp/scripts/docker-compose/files/entrypoint.sh:/entrypoint.sh
28       - {{ conf.MCP_STORAGE_DIR }}/pod_config.yml:/root/pod_config.yml
29       - {{ conf.MCP_STORAGE_DIR }}/nodes:/srv/salt/reclass/nodes
30       - {{ conf.MCP_STORAGE_DIR }}/pki:/etc/pki
31       - {{ conf.MCP_STORAGE_DIR }}/salt:/etc/salt
32       - {{ conf.MCP_STORAGE_DIR }}/hosts:/etc/hosts
33 {%- if conf.MCP_VCP %}
34       - {{ conf.MCP_STORAGE_DIR }}/base_image_opnfv_fuel_vcp.img:/srv/salt/env/prd/salt/files/control/images/base_image_opnfv_fuel_vcp.img
35 {%- endif %}
36     hostname: cfg01
37     domainname: {{ conf.cluster.domain }}
38     privileged: true
39 {%- if nm.cluster.has_baremetal_nodes %}
40   opnfv-fuel-maas:
41     container_name: "maas"
42     image: "opnfv/fuel:saltminion-maas-{{ conf.MCP_DOCKER_TAG }}"
43     networks:
44       mcpcontrol:
45         ipv4_address: {{ conf.MAAS_IP }}
46       pxebr:
47         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) }}
48       mgmt:
49         ipv4_address: {{ nm.net_mgmt | ipnet_hostaddr(nm.start_ip[nm.net_mgmt] + nm.net_mgmt_hosts.index('opnfv_infra_maas_node01_address') +1) }}
50     volumes:
51       - /lib/modules:/lib/modules:ro
52       - /sys/fs/cgroup:/sys/fs/cgroup:ro
53       - /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro
54       - {{ conf.MCP_REPO_ROOT_PATH }}/mcp/scripts/docker-compose/files/entrypoint_maas.sh:/entrypoint.sh:ro
55       - {{ conf.MCP_STORAGE_DIR }}/hosts:/etc/hosts:ro
56       - {{ conf.MCP_STORAGE_DIR }}/mas01/etc/iptables:/etc/iptables
57       - {{ conf.MCP_STORAGE_DIR }}/mas01/var/lib/postgresql:/var/lib/postgresql
58       - {{ conf.MCP_STORAGE_DIR }}/mas01/var/lib/maas:/var/lib/maas
59       - {{ conf.MCP_STORAGE_DIR }}/mas01/var/spool/maas-proxy:/var/spool/maas-proxy
60       - {{ conf.MCP_STORAGE_DIR }}/mas01/etc/maas:/etc/maas
61     hostname: mas01
62     domainname: {{ conf.cluster.domain }}
63     privileged: true
64     ports:
65       - 5240:5240
66 {%- endif %}
67 networks:
68   mcpcontrol:
69     driver: bridge
70     driver_opts:
71       com.docker.network.driver.mtu: 9000
72     ipam:
73       config:
74         - subnet: {{ net_mcpcontrol }}
75   pxebr:
76     driver: macvlan
77     driver_opts:
78       parent: veth_mcp1  # Always untagged
79     ipam:
80       config:
81         - subnet: {{ nm.net_admin }}
82   mgmt:
83     driver: macvlan
84     driver_opts:
85 {%- if conf.idf.fuel.jumphost.get('trunks', {}).get('mgmt', False) %}
86       parent: {{ ma.interface_str('veth_mcp5', nm.vlan_mgmt) }}
87 {%- else %}
88       parent: veth_mcp3  # Untagged by default
89 {%- endif %}
90     ipam:
91       config:
92         - subnet: {{ nm.net_mgmt }}