Skip to content

Commit b794aa2

Browse files
jparolyopenshift-merge-bot[bot]
authored andcommitted
Add uni alpha adoption network values
1 parent 794cc44 commit b794aa2

File tree

1 file changed

+169
-0
lines changed
  • roles/ci_gen_kustomize_values/templates/uni01alpha-adoption/network-values

1 file changed

+169
-0
lines changed
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
---
2+
# source: uni01alpha-adoption/network-values/values.yaml.j2
3+
{% set _ipv = cifmw_ci_gen_kustomize_values_ip_version_var_mapping %}
4+
{% set ns = namespace(interfaces={},
5+
ocp_index=0,
6+
lb_tools={}) %}
7+
data:
8+
{% for host in cifmw_networking_env_definition.instances.keys() -%}
9+
{% if host is match('^(ocp|crc).*') %}
10+
node_{{ ns.ocp_index }}:
11+
{% set ns.ocp_index = ns.ocp_index+1 %}
12+
name: {{ cifmw_networking_env_definition.instances[host]['hostname'] }}
13+
{% for network in cifmw_networking_env_definition.instances[host]['networks'].values() %}
14+
{% set ns.interfaces = ns.interfaces |
15+
combine({network.network_name: (network.parent_interface |
16+
default(network.interface_name)
17+
)
18+
},
19+
recursive=true) %}
20+
{{ network.network_name }}_ip: {{ network[_ipv.ip_vX] }}
21+
{% endfor %}
22+
{% endif %}
23+
{% endfor %}
24+
25+
{% for network in cifmw_networking_env_definition.networks.values() %}
26+
{% set ns.lb_tools = {} %}
27+
{{ network.network_name }}:
28+
dnsDomain: {{ network.search_domain }}
29+
{% if network.tools is defined and network.tools.keys() | length > 0 %}
30+
{% for tool in network.tools.keys() %}
31+
{% if tool is match('.*lb$') %}
32+
{% set _ = ns.lb_tools.update({tool: []}) %}
33+
{% endif %}
34+
{% endfor %}
35+
{% if network.tools.netconfig is defined %}
36+
subnets:
37+
- name: subnet1
38+
cidr: {{ network[_ipv.network_vX] }}
39+
gateway: {{ omit if network[_ipv.gw_vX] is not defined else network[_ipv.gw_vX] }}
40+
vlan: {{ omit if network.vlan_id is not defined else network.vlan_id }}
41+
allocationRanges:
42+
{% for range in network.tools.netconfig[_ipv.ipvX_ranges] %}
43+
- end: {{ range.end }}
44+
start: {{ range.start }}
45+
{% endfor %}
46+
{% endif %}
47+
{% if ns.lb_tools | length > 0 %}
48+
lb_addresses:
49+
{% for tool in ns.lb_tools.keys() %}
50+
{% for lb_range in network.tools[tool][_ipv.ipvX_ranges] %}
51+
- {{ lb_range.start }}-{{ lb_range.end }}
52+
{% set _ = ns.lb_tools[tool].append(lb_range.start) %}
53+
{% endfor %}
54+
endpoint_annotations:
55+
{{ tool }}.universe.tf/address-pool: {{ network.network_name }}
56+
{{ tool }}.universe.tf/allow-shared-ip: {{ network.network_name }}
57+
{{ tool }}.universe.tf/loadBalancerIPs: {{ ','.join(ns.lb_tools[tool]) }}
58+
{% endfor %}
59+
{% endif %}
60+
{% endif %}
61+
prefix-length: {{ network[_ipv.network_vX] | ansible.utils.ipaddr('prefix') }}
62+
mtu: {{ network.mtu | default(1500) }}
63+
{% if network.vlan_id is defined %}
64+
vlan: {{ network.vlan_id }}
65+
iface: {{ omit if ns.interfaces[network.network_name] is not defined else network.network_name }}
66+
base_iface: {{ omit if ns.interfaces[network.network_name] is not defined else ns.interfaces[network.network_name] }}
67+
{% elif network.network_name != "ironic" %}
68+
iface: {{ omit if ns.interfaces[network.network_name] is not defined else ns.interfaces[network.network_name] }}
69+
{% else %}
70+
iface: {{ omit if ns.interfaces[network.network_name] is not defined else network.network_name }}
71+
{% endif %}
72+
{% if network.tools.multus is defined and network.network_name == "ctlplane" %}
73+
net-attach-def: |
74+
{
75+
"cniVersion": "0.3.1",
76+
"name": "{{ network.network_name }}",
77+
"type": "macvlan",
78+
"master": "ospbr",
79+
"ipam": {
80+
"type": "whereabouts",
81+
"range": "{{ network[_ipv.network_vX] }}",
82+
"range_start": "{{ network.tools.multus[_ipv.ipvX_ranges].0.start }}",
83+
"range_end": "{{ network.tools.multus[_ipv.ipvX_ranges].0.end }}"
84+
}
85+
}
86+
{% endif %}
87+
{% if network.tools.multus is defined and network.network_name == "octavia" %}
88+
net-attach-def: |
89+
{
90+
"cniVersion": "0.3.1",
91+
"name": "octavia",
92+
"type": "bridge",
93+
"bridge": "octbr",
94+
"ipam": {
95+
"type": "whereabouts",
96+
"range": "{{ network[_ipv.network_vX] }}",
97+
{% if _ipv.ipvX_routes in network.tools.multus and network.tools.multus[_ipv.ipvX_routes] | length > 0 %}
98+
"routes": [
99+
{% for route in network.tools.multus[_ipv.ipvX_routes] %}
100+
{
101+
"dst": "{{ route.destination }}",
102+
"gw": "{{ route.gateway }}"
103+
}{% if not loop.last %},{% endif %}
104+
{% endfor %}
105+
],
106+
{% endif %}
107+
"range_start": "{{ network.tools.multus[_ipv.ipvX_ranges].0.start }}",
108+
"range_end": "{{ network.tools.multus[_ipv.ipvX_ranges].0.end }}"
109+
}
110+
}
111+
{% endif %}
112+
{% if network.tools.multus is defined and network.network_name == "ironic" %}
113+
net-attach-def: |
114+
{
115+
"cniVersion": "0.3.1",
116+
"name": "ironic",
117+
"type": "bridge",
118+
"bridge": "ironic",
119+
"ipam": {
120+
"type": "whereabouts",
121+
"range": "{{ network[_ipv.network_vX] }}",
122+
"range_start": "{{ network.tools.multus[_ipv.ipvX_ranges].0.start }}",
123+
"range_end": "{{ network.tools.multus[_ipv.ipvX_ranges].0.end }}"
124+
}
125+
}
126+
{% endif %}
127+
{% if network.tools.multus is defined and network.network_name not in ["ctlplane", "octavia", "ironic"] %}
128+
net-attach-def: |
129+
{
130+
"cniVersion": "0.3.1",
131+
"name": "{{ network.network_name }}",
132+
"type": "macvlan",
133+
"master": "{{ network.network_name if network.vlan_id is defined else ns.interfaces[network.network_name] }}",
134+
"ipam": {
135+
"type": "whereabouts",
136+
"range": "{{ network[_ipv.network_vX] }}",
137+
"range_start": "{{ network.tools.multus[_ipv.ipvX_ranges].0.start }}",
138+
"range_end": "{{ network.tools.multus[_ipv.ipvX_ranges].0.end }}"
139+
}
140+
}
141+
{% endif %}
142+
{% endfor %}
143+
dns-resolver:
144+
config:
145+
server:
146+
- "{{ cifmw_networking_env_definition.networks.ctlplane[_ipv.gw_vX] }}"
147+
search: []
148+
options:
149+
- key: server
150+
values:
151+
- {{ cifmw_networking_env_definition.networks.ctlplane[_ipv.gw_vX] }}
152+
{% for nameserver in cifmw_ci_gen_kustomize_values_nameservers %}
153+
- key: server
154+
values:
155+
- {{ nameserver }}
156+
{% endfor %}
157+
158+
# Hardcoding the last IP bit since we don't have support for endpoint_annotations in the networking_mapper output
159+
rabbitmq:
160+
endpoint_annotations:
161+
metallb.universe.tf/address-pool: internalapi
162+
metallb.universe.tf/loadBalancerIPs: {{ cifmw_networking_env_definition.networks['internalapi'][_ipv.network_vX] | ansible.utils.ipmath(85) }}
163+
rabbitmq-cell1:
164+
endpoint_annotations:
165+
metallb.universe.tf/address-pool: internalapi
166+
metallb.universe.tf/loadBalancerIPs: {{ cifmw_networking_env_definition.networks['internalapi'][_ipv.network_vX] | ansible.utils.ipmath(86) }}
167+
168+
lbServiceType: LoadBalancer
169+
storageClass: {{ cifmw_ci_gen_kustomize_values_storage_class }}

0 commit comments

Comments
 (0)