Skip to content

Commit 1cac75d

Browse files
authored
SNO networking to match MNO networking (#621)
1 parent 2e9c542 commit 1cac75d

37 files changed

+300
-619
lines changed

ansible/mno-deploy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
vars_files:
1212
- vars/lab.yml
1313
- vars/all.yml
14+
pre_tasks:
15+
- name: Validate deploying MNO
16+
fail:
17+
msg: "cluster_type is not 'mno'"
18+
when: cluster_type != "mno"
1419
roles:
1520
- validate-vars
1621
- ocp-release

ansible/roles/create-ai-cluster/defaults/main/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ override_kni_infra_haproxy: false
1818
# Manually override the openshift-kni-haproxy max connections via a machineconfig that replaces the
1919
# haproxy templatized config file with one with greater max connections (Original default 20000)
2020
openshift_kni_infra_haproxy_maxconn: 40000
21+
22+
# SNO Only, Performance-addon-operator vars
23+
install_performance_addon_operator: false
24+
reserved_cpus: 0-1,32-33
25+
26+
# SNO Only
27+
du_profile: false

ansible/roles/create-ai-cluster/tasks/01_manifest_update.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
# create-ai-cluster manifest update
3+
14
- name: Add manifests before cluster install - {{ item.file_name }}
25
uri:
36
url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/clusters/{{ ai_cluster_id }}/manifests"
File renamed without changes.

ansible/roles/create-ai-cluster/tasks/main.yml

Lines changed: 148 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,115 @@
2222
set_fact:
2323
static_network_config: []
2424

25-
- name: Populate static network configuration with controlplane nodes
26-
include_tasks: static_network_config.yml
27-
loop: "{{ groups['controlplane'] }}"
25+
- name: SNO Cluster Creation
26+
block:
27+
- name: SNO - Populate static network configuration with SNO node
28+
include_tasks: static_network_config.yml
29+
when: not sno_use_lab_dhcp
30+
loop: "{{ groups['sno'] }}"
2831

29-
- name: MNO - Populate static network configuration with worker nodes
30-
include_tasks: static_network_config.yml
31-
when:
32-
- cluster_type == "mno"
33-
loop: "{{ groups['worker'] }}"
32+
- name: SNO - Set cluster_name
33+
set_fact:
34+
cluster_name: "{{ groups['sno'][0] }}"
3435

35-
- name: Create MNO cluster
36-
uri:
37-
url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/clusters"
38-
method: POST
39-
body_format: json
40-
status_code: [201]
41-
return_content: true
42-
body: {
43-
"name": "{{ cluster_name }}",
44-
"openshift_version": "{{ openshift_version }}",
45-
"base_dns_domain": "{{ base_dns_name }}",
46-
"cluster_network_cidr": "{{ cluster_network_cidr }}",
47-
"cluster_network_host_prefix": "{{ cluster_network_host_prefix }}",
48-
"service_network_cidr": "{{ service_network_cidr }}",
49-
"pull_secret": "{{ pull_secret | to_json }}",
50-
"ssh_public_key": "{{ lookup('file', ssh_public_key_file) }}",
51-
"vip_dhcp_allocation": "{{ vip_dhcp_allocation }}",
52-
"additional_ntp_source": "{{ bastion_controlplane_ip if use_bastion_registry else labs[lab]['ntp_server'] }}",
53-
"api_vips": [{"ip": "{{ controlplane_network_api }}"}],
54-
"ingress_vips": [{"ip": "{{ controlplane_network_ingress }}"}],
55-
"network_type": "OVNKubernetes"
56-
}
57-
register: create_cluster_return
36+
- name: SNO - Create cluster
37+
uri:
38+
url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/clusters"
39+
method: POST
40+
body_format: json
41+
status_code: [201]
42+
return_content: true
43+
body: {
44+
"name": "{{ cluster_name }}",
45+
"openshift_version": "{{ openshift_version }}",
46+
"high_availability_mode": "None",
47+
"base_dns_domain": "{{ base_dns_name }}",
48+
"cluster_network_cidr": "{{ cluster_network_cidr }}",
49+
"cluster_network_host_prefix": "{{ cluster_network_host_prefix }}",
50+
"service_network_cidr": "{{ service_network_cidr }}",
51+
"pull_secret": "{{ pull_secret | to_json }}",
52+
"ssh_public_key": "{{ lookup('file', ssh_public_key_file) }}",
53+
"additional_ntp_source": "{{ bastion_controlplane_ip if (lab in cloud_labs) or use_bastion_registry else labs[lab]['ntp_server'] }}"
54+
}
55+
register: create_cluster_return
5856

59-
- name: Set ai_cluster_id
60-
set_fact:
61-
ai_cluster_id: "{{ create_cluster_return.json.id }}"
57+
- name: SNO - Add entries in /etc/hosts
58+
blockinfile:
59+
path: "/etc/hosts"
60+
backup: true
61+
block: |
62+
{{ hostvars[cluster_name]['ip'] }} api.{{ cluster_name }}.{{ base_dns_name }}
63+
{{ hostvars[cluster_name]['ip'] }} api-int.{{ cluster_name }}.{{ base_dns_name }}
64+
{% for route in etc_hosts_ingress_routes %}
65+
{{ hostvars[cluster_name]['ip'] }} {{ route }}.apps.{{ cluster_name }}.{{ base_dns_name }}
66+
{% endfor %}
67+
insertafter: "EOF"
68+
marker: "# {mark} {{ cluster_name }} OCP CLUSTER MANAGED BLOCK"
69+
70+
- name: SNO - Set ai_cluster_id
71+
set_fact:
72+
ai_cluster_id: "{{ create_cluster_return.json.id }}"
73+
when: cluster_type == "sno"
74+
75+
- name: MNO Cluster Creation
76+
block:
77+
- name: MNO - Populate static network configuration with controlplane nodes
78+
include_tasks: static_network_config.yml
79+
loop: "{{ groups['controlplane'] }}"
80+
81+
- name: MNO - Populate static network configuration with worker nodes
82+
include_tasks: static_network_config.yml
83+
loop: "{{ groups['worker'] }}"
84+
85+
- name: MNO - Create cluster
86+
uri:
87+
url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/clusters"
88+
method: POST
89+
body_format: json
90+
status_code: [201]
91+
return_content: true
92+
body: {
93+
"name": "{{ cluster_name }}",
94+
"openshift_version": "{{ openshift_version }}",
95+
"base_dns_domain": "{{ base_dns_name }}",
96+
"cluster_network_cidr": "{{ cluster_network_cidr }}",
97+
"cluster_network_host_prefix": "{{ cluster_network_host_prefix }}",
98+
"service_network_cidr": "{{ service_network_cidr }}",
99+
"pull_secret": "{{ pull_secret | to_json }}",
100+
"ssh_public_key": "{{ lookup('file', ssh_public_key_file) }}",
101+
"vip_dhcp_allocation": "{{ vip_dhcp_allocation }}",
102+
"additional_ntp_source": "{{ bastion_controlplane_ip if use_bastion_registry else labs[lab]['ntp_server'] }}",
103+
"api_vips": [{"ip": "{{ controlplane_network_api }}"}],
104+
"ingress_vips": [{"ip": "{{ controlplane_network_ingress }}"}],
105+
"network_type": "OVNKubernetes"
106+
}
107+
register: create_cluster_return
108+
109+
- name: MNO - Add entries in /etc/hosts
110+
blockinfile:
111+
path: "/etc/hosts"
112+
backup: true
113+
block: |
114+
{{ controlplane_network_api }} api.{{ cluster_name }}.{{ base_dns_name }}
115+
{{ controlplane_network_api }} api-int.{{ cluster_name }}.{{ base_dns_name }}
116+
{% for route in etc_hosts_ingress_routes %}
117+
{{ controlplane_network_ingress }} {{ route }}.apps.{{ cluster_name }}.{{ base_dns_name }}
118+
{% endfor %}
119+
insertafter: "EOF"
120+
marker: "# {mark} {{ cluster_name }} OCP CLUSTER MANAGED BLOCK"
121+
122+
- name: MNO - Set ai_cluster_id
123+
set_fact:
124+
ai_cluster_id: "{{ create_cluster_return.json.id }}"
125+
when: cluster_type == "mno"
126+
127+
- name: Restart dnsmasq after /etc/hosts update
128+
systemd:
129+
state: restarted
130+
name: dnsmasq
131+
when:
132+
- controlplane_bastion_as_dns
133+
- not setup_coredns
62134

63135
- name: Patch cluster network settings
64136
uri:
@@ -83,6 +155,9 @@
83155
]
84156
}
85157

158+
# - debug:
159+
# msg: "{{ static_network_config }}"
160+
86161
- name: Create a connected infra-env
87162
uri:
88163
url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/infra-envs"
@@ -118,43 +193,53 @@
118193
}
119194
when: use_bastion_registry | default(false)
120195

121-
- name: Add entries in /etc/hosts
122-
blockinfile:
123-
path: "/etc/hosts"
124-
backup: true
125-
block: |
126-
{{ controlplane_network_api }} api.{{ cluster_name }}.{{ base_dns_name }}
127-
{{ controlplane_network_api }} api-int.{{ cluster_name }}.{{ base_dns_name }}
128-
{% for route in etc_hosts_ingress_routes %}
129-
{{ controlplane_network_ingress }} {{ route }}.apps.{{ cluster_name }}.{{ base_dns_name }}
130-
{% endfor %}
131-
insertafter: "EOF"
132-
marker: "# {mark} {{ cluster_name }} OCP CLUSTER MANAGED BLOCK"
133-
134-
- name: Restart dnsmasq after /etc/hosts update
135-
systemd:
136-
state: restarted
137-
name: dnsmasq
138-
when:
139-
- controlplane_bastion_as_dns
140-
- not setup_coredns
141-
142-
- name: Include custom manifests
196+
# Disable lab interface manifests, skip if SNO has sno_use_lab_dhcp=true
197+
- name: Include custom manifests to disable the lab interface
143198
include_tasks: 01_manifest_update.yml
144-
with_items:
199+
when: (cluster_type == "mno") or (cluster_type == "sno" and not sno_use_lab_dhcp)
200+
loop:
145201
- file_name: 50-controlplane-disable-lab-dhcp-interface.yaml
146202
template_name: 50-controlplane-disable-lab-dhcp-interface.yml.j2
147203
- file_name: 50-worker-disable-lab-dhcp-interface.yaml
148204
template_name: 50-worker-disable-lab-dhcp-interface.yml.j2
149-
- file_name: 50-controlplane-tune-kni-haproxy.yaml
150-
template_name: 50-controlplane-tune-kni-haproxy.yml.j2
151-
enabled: "{{ override_kni_infra_haproxy }}"
205+
206+
# MNO and SNO Custom manifests
207+
- name: Include custom manifests
208+
include_tasks: 01_manifest_update.yml
209+
loop:
152210
- file_name: 06-kdump-master.yaml
153211
template_name: 06-kdump-master.yaml
154212
enabled: "{{ kdump_master_config }}"
155-
- file_name: kubeletconfig-max-pods.yml
156-
template_name: kubeletconfig-max-pods.yml
157-
enabled: "{{ kubelet_config }}"
158213
- file_name: 99-disconnected-dns-workaround.yml
159214
template_name: 99-disconnected-dns-workaround.yml
160215
enabled: "{{ use_bastion_registry }}"
216+
217+
# MNO Custom manifests only
218+
- name: MNO - Include custom manifests
219+
include_tasks: 01_manifest_update.yml
220+
when: cluster_type == "mno"
221+
loop:
222+
- file_name: 50-controlplane-tune-kni-haproxy.yaml
223+
template_name: 50-controlplane-tune-kni-haproxy.yml.j2
224+
enabled: "{{ override_kni_infra_haproxy }}"
225+
- file_name: kubeletconfig-max-pods.yml
226+
template_name: kubeletconfig-max-pods.yml
227+
enabled: "{{ kubelet_config }}"
228+
229+
# SNO Custom manifests only
230+
- name: SNO - Include custom manifests
231+
include_tasks: 01_manifest_update.yml
232+
when: cluster_type == "sno"
233+
loop:
234+
- file_name: kubeletconfig-max-pods.yml
235+
template_name: kubeletconfig-max-pods.yml
236+
enabled: "{{ kubelet_config }}"
237+
vars:
238+
kubelet_config_max_pods_label: "pools.operator.machineconfiguration.openshift.io/master: ''"
239+
240+
# SNO with DU profile manifests
241+
- name: SNO - Include DU Profile manifests
242+
include_tasks: du_profile_manifest_tasks.yml
243+
when:
244+
- cluster_type == "sno"
245+
- du_profile
Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
---
22
# Separate tasks to populate static network configuration
33

4-
- name: Assemble static network config for Red Hat labs
4+
- name: RH Lab and BYOL Populate static network configuration
55
set_fact:
66
item_network_config:
7-
network_yaml: "{{ lookup('template', 'nmstate.yml.j2') }}"
8-
mac_interface_map: "{{ lookup('template', 'mac_interface_map.json.j2') }}"
9-
when: lab in rh_labs or lab == "byol"
7+
network_yaml: "{{ lookup('template', 'rhlab_nmstate.yml.j2') }}"
8+
mac_interface_map: "{{ lookup('template', 'rhlab_mac_interface_map.json.j2') }}"
9+
when:
10+
- lab in rh_labs or lab == "byol"
1011

11-
- name: Assemble static network config for ibmcloud lab
12+
- name: SNO - Cloud Lab Populate static network configuration
1213
set_fact:
1314
item_network_config:
14-
network_yaml: "{{ lookup('template', 'ibmcloud_nmstate.yml.j2') }}"
15-
mac_interface_map: "{{ lookup('template', 'ibmcloud_mac_interface_map.json.j2') }}"
16-
when: lab in cloud_labs
15+
- network_yaml: "{{ lookup('template', 'ibmcloud_sno_nmstate.yml.j2') }}"
16+
mac_interface_map: "{{ lookup('template', 'ibmcloud_sno_mac_interface_map.json.j2') }}"
17+
when:
18+
- cluster_type == "sno"
19+
- lab in cloud_labs
20+
21+
- name: MNO - Cloud Lab Populate static network configuration
22+
set_fact:
23+
item_network_config:
24+
network_yaml: "{{ lookup('template', 'ibmcloud_mno_nmstate.yml.j2') }}"
25+
mac_interface_map: "{{ lookup('template', 'ibmcloud_mno_mac_interface_map.json.j2') }}"
26+
when:
27+
- cluster_type == "mno"
28+
- lab in cloud_labs
1729

1830
- name: Add {{ item }} ip config
1931
set_fact:
2032
static_network_config: "{{ static_network_config + [ item_network_config ] }}"
33+
when: item_network_config is defined
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)