Skip to content

Commit

Permalink
Consume quads API
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Sep 19, 2024
1 parent 9642767 commit af6dbc2
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 21 deletions.
12 changes: 6 additions & 6 deletions ansible/roles/create-inventory/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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 }}"

Expand All @@ -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]] }}"
Expand Down
5 changes: 3 additions & 2 deletions ansible/roles/create-inventory/templates/inventory-bm.j2
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions ansible/vars/all.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ansible/vars/lab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 11 additions & 5 deletions docs/deploy-bm-performancelab.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions docs/deploy-bm-scalelab.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af6dbc2

Please sign in to comment.