-
Notifications
You must be signed in to change notification settings - Fork 26
/
agent-config.yaml
64 lines (63 loc) · 2.56 KB
/
agent-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{% import 'static_network/config.j2' as static_network %}
{% set baremetal_prefix = baremetal_cidr.split('/')[1] %}
{% set baremetal_gateway = static_baremetal_gateway or baremetal_cidr|network_ip(1 if fake_network else -2) %}
{% if dns %}
{% set baremetal_dns = installer_ip %}
{% else %}
{% set baremetal_dns = static_baremetal_dns or baremetal_gateway %}
{% endif %}
{% set nic = 'ens192' if config_type == 'vsphere' else 'enp1s0' %}
{% set virtual_ctlplanes_nodes = [] %}
{% set virtual_workers_nodes = [] %}
{% if virtual_hub %}
{% for num in range(0, ctlplanes) %}
{% set new_ctlplane = {'ip': static_ips[num]} if static_network and static_ips|length > num else {} %}
{% do virtual_ctlplanes_nodes.append(new_ctlplane) %}
{% endfor %}
{% endif %}
{% if virtual_hub and workers > 0 %}
{% for num in range(0, workers) %}
{% set new_worker = {'ip': static_ips[ctlplanes + num]} if static_network and static_ips|length > ctlplanes + num else {} %}
{% do virtual_workers_nodes.append(new_worker) %}
{% endfor %}
{% endif %}
{% set hosts = baremetal_ctlplanes + virtual_ctlplanes_nodes + baremetal_workers + virtual_workers_nodes %}
{% set total_ctlplanes = (baremetal_ctlplanes + virtual_ctlplanes_nodes)|length %}
apiVersion: v1alpha1
kind: AgentConfig
metadata:
name: {{ cluster }}
rendezvousIP: {{ rendezvous_ip or static_ips[0] }}
hosts:
{% for host in hosts %}
{% set role = 'ctlplane' if loop.index0 < total_ctlplanes else 'worker' %}
{% set index = loop.index0 - total_ctlplanes if role == 'worker' else loop.index0 %}
- hostname: {{ host['name']|default("%s-%s-%s" % (cluster, role, index|string)) }}.{{ domain }}
role: {{ 'master' if role == 'ctlplane' else 'worker' }}
{% if 'disk' in host %}
rootDeviceHints:
deviceName: "/dev/{{ host['disk'] | basename }}"
{% elif 'hctl' in host %}
rootDeviceHints:
hctl: "{{ host['hctl'] }}"
{% elif 'serial' in host %}
rootDeviceHints:
serialNumber: "{{ host['serial'] }}"
{% elif 'wwn' in host %}
rootDeviceHints:
wwn: "{{ host['wwn'] }}"
{% else %}
rootDeviceHints:
deviceName: "/dev/{{ default_disk|basename }}"
{% endif %}
interfaces:
- macAddress: {{ host['mac']|default("%s:%0.2d" % (virtual_mac_prefix, loop.index)) }}
name: {{ host['nic']|default(nic) }}
{% if 'ip' in host %}
networkConfig:
{{ static_network.config(host['ip'], baremetal_prefix, host['gateway']|default(baremetal_gateway), host['dns']|default(baremetal_dns), cluster, domain, host['nic']|default(nic)) }}
{% elif 'network_config' in host %}
networkConfig:
{{ host['network_config']|replace('\n', '\n ') }}
{% endif %}
{% endfor %}