From af6dbc24e7e5b655c5b73ca091664eb66ff5d2f5 Mon Sep 17 00:00:00 2001 From: Raul Sevilla Date: Fri, 20 Sep 2024 01:45:33 +0200 Subject: [PATCH] Consume quads API Signed-off-by: Raul Sevilla --- ansible/roles/create-inventory/tasks/main.yml | 12 ++++++------ .../create-inventory/templates/inventory-bm.j2 | 5 +++-- ansible/vars/all.sample.yml | 5 +++-- ansible/vars/lab.yml | 2 +- docs/deploy-bm-performancelab.md | 16 +++++++++++----- docs/deploy-bm-scalelab.md | 16 +++++++++++----- 6 files changed, 35 insertions(+), 21 deletions(-) diff --git a/ansible/roles/create-inventory/tasks/main.yml b/ansible/roles/create-inventory/tasks/main.yml index 7532a454..00559e39 100644 --- a/ansible/roles/create-inventory/tasks/main.yml +++ b/ansible/roles/create-inventory/tasks/main.yml @@ -56,7 +56,7 @@ - name: Get assignment from quads uri: - url: "https://{{ labs[lab]['quads'] }}/api/v1/assignments/active/{{ lab_cloud}}/" + url: "https://{{ labs[lab]['quads'] }}/api/v3/assignments/active/{{ lab_cloud }}" force_basic_auth: yes user: "{{ lab_cloud }}" password: "{{ ocpinventory.json.nodes[0].pm_password }}" @@ -65,8 +65,8 @@ - name: Public VLAN - Set addressing information set_fact: - controlplane_network: "{{ quads_assignment.json.vlan.address }}" - network_prefix: "{{ quads_assignment.json.vlan.prefix }}" + controlplane_network: "{{ quads_assignment.json.vlan.ip_range }}" + network_prefix: "{{ quads_assignment.json.vlan.ip_range | ipaddr('prefix') }}" gateway: "{{ quads_assignment.json.vlan.gateway }}" cluster_name: "vlan{{ quads_assignment.json.vlan.vlan_id }}" @@ -78,9 +78,9 @@ controlplane0: "{{ ocpinventory.json.nodes[1].pm_addr }}" controlplane1: "{{ ocpinventory.json.nodes[2].pm_addr }}" controlplane2: "{{ ocpinventory.json.nodes[3].pm_addr }}" - controlplane0_network_mac: "{{ ocpinventory.json.nodes[1].mac[controlplane_network_interface_idx] }}" - controlplane1_network_mac: "{{ ocpinventory.json.nodes[2].mac[controlplane_network_interface_idx] }}" - controlplane2_network_mac: "{{ ocpinventory.json.nodes[3].mac[controlplane_network_interface_idx] }}" + controlplane0_network_mac: "{{ ocpinventory.json.nodes[1].mac[controlplane_network_interface_idx | int] }}" + controlplane1_network_mac: "{{ ocpinventory.json.nodes[2].mac[controlplane_network_interface_idx | int] }}" + controlplane2_network_mac: "{{ ocpinventory.json.nodes[3].mac[controlplane_network_interface_idx | int] }}" controlplane0_vendor: "{{ hw_vendor[(ocpinventory.json.nodes[1].pm_addr.split('.')[0]).split('-')[-1]] }}" controlplane1_vendor: "{{ hw_vendor[(ocpinventory.json.nodes[2].pm_addr.split('.')[0]).split('-')[-1]] }}" controlplane2_vendor: "{{ hw_vendor[(ocpinventory.json.nodes[3].pm_addr.split('.')[0]).split('-')[-1]] }}" diff --git a/ansible/roles/create-inventory/templates/inventory-bm.j2 b/ansible/roles/create-inventory/templates/inventory-bm.j2 index 4ef027c3..7cf02fe7 100644 --- a/ansible/roles/create-inventory/templates/inventory-bm.j2 +++ b/ansible/roles/create-inventory/templates/inventory-bm.j2 @@ -1,10 +1,11 @@ [all:vars] allocation_node_count={{ ocpinventory.json.nodes | length }} supermicro_nodes={{ has_supermicro | bool }} +cluster_name={{ cluster_name }} {% if public_vlan %} -{% if lab_name == "scalelab" %} +{% if lab == "scalelab" %} base_dns_name=rdu2.scalelab.redhat.com -{% elif lab_name == "performancelab" %} +{% elif lab == "performancelab" %} base_dns_name=rdu3.labs.perfscale.redhat.com {% else %} base_dns_name=example.com diff --git a/ansible/vars/all.sample.yml b/ansible/vars/all.sample.yml index 60638e78..464ae347 100644 --- a/ansible/vars/all.sample.yml +++ b/ansible/vars/all.sample.yml @@ -38,8 +38,9 @@ networktype: OVNKubernetes # Set this variable if you want to host your SNO cluster on lab public routable # VLAN network, set this ONLY if you have public routable VLAN enabled in your # scalelab cloud -# For bm clusters, enable this variable to autoconfigure controlplane_network_interface_idx and -# base_dns_name to the according values +# For bm clusters, enable this variable to autoconfigure controlplane_network_interface_idx, +# base_dns_name, cluster_name, controlplane_network, network_prefix, gateway to the values +# required in the public VLAN public_vlan: false # Enables FIPs security standard diff --git a/ansible/vars/lab.yml b/ansible/vars/lab.yml index 9fcb08c0..8cb1bb6c 100644 --- a/ansible/vars/lab.yml +++ b/ansible/vars/lab.yml @@ -24,7 +24,7 @@ labs: - 10.1.36.2 foreman: foreman.rdu2.scalelab.redhat.com ntp_server: clock1.rdu2.redhat.com - quads: quads.rdu2.scalelab.redhat.com + quads: quads2.rdu2.scalelab.redhat.com # NOTE: This should map every server model in the Scale and Performance labs to # the vendor. Right now, Jetlag supports only the Dell and Supermicro vendors, diff --git a/docs/deploy-bm-performancelab.md b/docs/deploy-bm-performancelab.md index 6f22c2a6..061093e6 100644 --- a/docs/deploy-bm-performancelab.md +++ b/docs/deploy-bm-performancelab.md @@ -286,10 +286,15 @@ controlplane_lab_interface: eno8303 ### Deploy in the public VLAN -In order to deploy in the public VLAN, some variables need to be configured: +In order to deploy in the public VLAN, set the variable `public_vlan` in `all.yml` to true. Once this variable is enable jetlag: -- `public_vlan`: Enable this variable **before creating the inventory**, to let jetlag to auto-configure the interface number (`controlplane_network_interface_idx`) to the last of the available NICs of the ocpinventory.json file, when this variable is configured, `base_dns_name` is set to `rdu2.scalelab.redhat.com` in the inventory file. -- `cluster_name`: Should be configured to the public VLAN name. i.e: `vlan600`, check the public VLANs allocation info in the [scalelab's wiki](https://wiki.rdu3.labs.perfscale.redhat.com/vlans/) +- Auto-configures the interface number (`controlplane_network_interface_idx`) to the last of the available NICs of the ocpinventory.json file. +- `base_dns_name` is set to `rdu3.lab.perfscale.redhat.com` in the inventory +- With the help of the `quads` API these variables are also configured automatically: + - `controlplane_network`: public VLAN subnet + - `network_prefix`: public VLAN network mask + - `gateway`: public VLAN default gateway + - `cluster_name`: cluster name according to the pre-existing DNS records in the public VLAN, i.e: `vlan604` Once the deployment is completed, the cluster API and routes should be reachable directly from the VPN. @@ -350,8 +355,9 @@ worker_node_count: 2 # Set this variable if you want to host your SNO cluster on lab public routable # VLAN network, set this ONLY if you have public routable VLAN enabled in your # Red Hat cloud -# For bm clusters, enable this variable to autoconfigure controlplane_network_interface_idx and -# base_dns_name to the according values +# For bm clusters, enable this variable to autoconfigure controlplane_network_interface_idx, +# base_dns_name, cluster_name, controlplane_network, network_prefix, gateway to the values +# required in the public VLAN public_vlan: false # Enter whether the build should use 'dev' (early candidate builds) or 'ga' for Generally Available versions of OpenShift diff --git a/docs/deploy-bm-scalelab.md b/docs/deploy-bm-scalelab.md index 79d04892..6257994f 100644 --- a/docs/deploy-bm-scalelab.md +++ b/docs/deploy-bm-scalelab.md @@ -284,10 +284,15 @@ controlplane_lab_interface: eno12399np0 ### Deploy in the public VLAN -In order to deploy in the public VLAN, some variables need to be configured: +In order to deploy in the public VLAN, set the variable `public_vlan` in `all.yml` to true. Once this variable is enable jetlag: -- `public_vlan`: Enable this variable **before creating the inventory**, to let jetlag to auto-configure the interface number (`controlplane_network_interface_idx`) to the last of the available NICs of the ocpinventory.json file, when this variable is configured, `base_dns_name` is set to `rdu2.scalelab.redhat.com` in the inventory file. -- `cluster_name`: Should be configured to the public VLAN name. i.e: `vlan600`, check the public VLANs allocation info in the [scalelab's wiki](https://wiki.rdu2.scalelab.redhat.com/vlans/) +- Auto-configures the interface number (`controlplane_network_interface_idx`) to the last of the available NICs of the ocpinventory.json file. +- `base_dns_name` is set to `rdu2.scalelab.redhat.com` in the inventory +- With the help of the `quads` API these variables are also configured automatically: + - `controlplane_network`: public VLAN subnet + - `network_prefix`: public VLAN network mask + - `gateway`: public VLAN default gateway + - `cluster_name`: cluster name according to the pre-existing DNS records in the public VLAN, i.e: `vlan604` Once the deployment is completed, the cluster API and routes should be reachable directly from the VPN. @@ -347,8 +352,9 @@ worker_node_count: 0 # Set this variable if you want to host your SNO cluster on lab public routable # VLAN network, set this ONLY if you have public routable VLAN enabled in your # Red Hat cloud -# For bm clusters, enable this variable to autoconfigure controlplane_network_interface_idx and -# base_dns_name to the according values +# For bm clusters, enable this variable to autoconfigure controlplane_network_interface_idx, +# base_dns_name, cluster_name, controlplane_network, network_prefix, gateway to the values +# required in the public VLAN public_vlan: false # Enter whether the build should use 'dev' (early candidate builds) or 'ga' for Generally Available versions of OpenShift