Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PERFSCALE-3427] Public VLAN improvements #549

Merged
merged 10 commits into from
Oct 2, 2024
44 changes: 41 additions & 3 deletions ansible/roles/create-inventory/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,44 @@
ocpinventory_sno_nodes: []
ocpinventory_hv_nodes: []

- name: Public VLAN in BM cluster
when: public_vlan and cluster_type == "bm"
block:
- name: Public VLAN - Configuring controlplane_network_interface_idx to the last interface
set_fact:
controlplane_network_interface_idx: "{{ ocpinventory.json.nodes[0].mac | length - 1 }}"

- name: Get assignment from scalelab quads
uri:
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 }}"
validate_certs: false
register: quads_assignment
when: lab == "scalelab"

- name: Public scalelab VLAN - Set addressing information
set_fact:
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 }}"
when: lab == "scalelab"

- name: Get VLAN info from performancelab quads
shell: "curl -sk https://wiki.rdu3.labs.perfscale.redhat.com/vlans/ | grep -B7 {{ lab_cloud }} | sed -E 's#</?td>##g'| tr '\n' ' ' | column -J --table-columns vlan_id,cidr,netmask,gateway,ipfree,owner,ticket,cloud"
register: vlan_info
when: lab == "performancelab"

- name: Public performancelab VLAN - Set addressing information
set_fact:
controlplane_network: "{{ (vlan_info.stdout | from_json).table[0].cidr }}"
network_prefix: "{{ (vlan_info.stdout | from_json).table[0].cidr | ipaddr('prefix') }}"
gateway: "{{ (vlan_info.stdout | from_json).table[0].gateway }}"
cluster_name: "vlan{{ (vlan_info.stdout | from_json).table[0].vlan_id }}"
when: lab == "performancelab"

- name: Bare metal cluster and remote worker node cluster type tasks
when: cluster_type == "mno" or cluster_type == "rwn"
block:
Expand All @@ -55,9 +93,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
12 changes: 11 additions & 1 deletion ansible/roles/create-inventory/templates/inventory-mno.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
[all:vars]
allocation_node_count={{ ocpinventory.json.nodes | length }}
supermicro_nodes={{ has_supermicro | bool }}
{% if public_vlan %}
cluster_name={{ cluster_name }}
{% if lab == "scalelab" %}
base_dns_name=rdu2.scalelab.redhat.com
{% elif lab == "performancelab" %}
base_dns_name=rdu3.labs.perfscale.redhat.com
{% else %}
base_dns_name={{ base_dns_name }}
{% endif %}
{% endif %}

[bastion]
{{ bastion_machine }} ansible_ssh_user=root bmc_address=mgmt-{{ bastion_machine }}
Expand Down Expand Up @@ -32,7 +42,7 @@ dns2={{ labs[lab]['dns'][1] | default('') }}

[worker]
{% for worker in ocpinventory_worker_nodes %}
{{ worker.pm_addr.split('.')[0] | replace('mgmt-','') }} bmc_address={{ worker.pm_addr }} network_mac={{ worker.mac[controlplane_network_interface_idx] }} lab_mac={{ ( (mno_foreman_data.results| selectattr('json.name', 'eq', worker.pm_addr | replace('mgmt-',''))|first).json.interfaces | selectattr('primary', 'eq', True)|first).mac }} ip={{ controlplane_network | ansible.utils.nthhost(loop.index + mno_worker_node_offset) }} vendor={{ hw_vendor[(worker.pm_addr.split('.')[0]).split('-')[-1]] }} install_disk={{ worker_install_disk }}
{{ worker.pm_addr.split('.')[0] | replace('mgmt-','') }} bmc_address={{ worker.pm_addr }} network_mac={{ worker.mac[controlplane_network_interface_idx|int] }} lab_mac={{ ( (mno_foreman_data.results| selectattr('json.name', 'eq', worker.pm_addr | replace('mgmt-',''))|first).json.interfaces | selectattr('primary', 'eq', True)|first).mac }} ip={{ controlplane_network | ansible.utils.nthhost(loop.index + mno_worker_node_offset) }} vendor={{ hw_vendor[(worker.pm_addr.split('.')[0]).split('-')[-1]] }} install_disk={{ worker_install_disk }}
{% endfor %}

[worker:vars]
Expand Down
11 changes: 9 additions & 2 deletions ansible/vars/all.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ lab_cloud:
# Either mno or rwn or sno
cluster_type:

# Applies to both mno/rwn clusters
# Applies to both bm/rwn clusters
cluster_name: mno
worker_node_count:

# Applies to mno/rwn/sno clusters
base_dns_name: example.com

# Enter whether the build should use 'dev' (early candidate builds) or 'ga' for Generally Available versions of OpenShift
# Empty value results in playbook failing with error message. Example of dev builds would be 'candidate-4.17', 'candidate-4.16'
# or 'latest' (which would point to the early candidate build of the latest in development release) and examples of 'ga' builds would
Expand All @@ -31,10 +35,13 @@ ocp_version: "latest-4.16"
# Either "OVNKubernetes" or "OpenShiftSDN" (Only for MNO/RWN cluster types)
networktype: OVNKubernetes

# Lab Network type, applies to sno cluster_type only
# Lab Network type, applies to sno and bm cluster_type only
# 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,
# 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
41 changes: 31 additions & 10 deletions docs/deploy-mno-performancelab.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ Assuming you received an Performance lab allocation named `cloud99`, this guide
_**Table of Contents**_

<!-- TOC -->
- [Bastion setup](#bastion-setup)
- [Configure Ansible vars in `all.yml`](#configure-ansible-vars-in-allyml)
- [Review vars all.yml](#review-vars-allyml)
- [Run playbooks](#run-playbooks)
- [Monitor install and interact with cluster](#monitor-install-and-interact-with-cluster)
- [Deploy a Bare Metal cluster via Jetlag from a Performance Lab Bastion Machine quickstart](#deploy-a-bare-metal-cluster-via-jetlag-from-a-performance-lab-bastion-machine-quickstart)
- [Bastion setup](#bastion-setup)
- [Configure Ansible vars in `all.yml`](#configure-ansible-vars-in-allyml)
- [Lab \& cluster infrastructure vars](#lab--cluster-infrastructure-vars)
- [Bastion node vars](#bastion-node-vars)
- [OCP node vars](#ocp-node-vars)
- [Deploy in the public VLAN](#deploy-in-the-public-vlan)
- [Extra vars](#extra-vars)
- [Disconnected and ipv6 vars](#disconnected-and-ipv6-vars)
- [Review vars `all.yml`](#review-vars-allyml)
- [Run playbooks](#run-playbooks)
- [Monitor install and interact with cluster](#monitor-install-and-interact-with-cluster)
<!-- /TOC -->

<!-- Bastion setup is duplicated in multiple files and should be kept in sync!
Expand Down Expand Up @@ -277,6 +284,19 @@ controlplane_lab_interface: eno8303

** If your machine types are not homogeneous, then you will have to manually edit your generated inventory file to correct any nic names until this is reasonably automated.

### Deploy in the public VLAN

In order to deploy a cluster using the public VLAN, set the variable `public_vlan` in `all.yml` to `true`. Once enabled the following variables are automatically configured:

- `controlplane_network_interface_idx`: Is set to the corresponding interface number
- `base_dns_name` is set to `rdu3.lab.perfscale.redhat.com` in the inventory
- `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`

When the deployment is completed, the cluster API and routes should be reachable directly from the VPN.

### Extra vars

For multi node deployment of OCP 4.13 or later, it's advisable to configure the following extra variables.
Expand Down Expand Up @@ -321,16 +341,17 @@ lab: performancelab
# Which cloud in the lab environment (Ex cloud42)
lab_cloud: cloud99

# Either mno or rwn or sno
cluster_type: mno

# Applies to both mno/rwn clusters
# Applies to both bm/rwn clusters
cluster_name: mno
worker_node_count: 2

# Lab Network type, applies to sno cluster_type only
# Lab Network type, applies to sno and bm cluster_type only
# 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,
# base_dns_name, cluster_name, controlplane_network, network_prefix, gateway to the values
# required in the public VLAN attached to the lab assignment
public_vlan: false

# Enter whether the build should use 'dev' (early candidate builds) or 'ga' for Generally Available versions of OpenShift
Expand Down
53 changes: 40 additions & 13 deletions docs/deploy-mno-scalelab.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ Assuming you received a scale lab allocation named `cloud99`, this guide will wa
_**Table of Contents**_

<!-- TOC -->
- [Bastion setup](#bastion-setup)
- [Configure Ansible vars in `all.yml`](#configure-ansible-vars-in-allyml)
- [Review vars all.yml](#review-vars-allyml)
- [Run playbooks](#run-playbooks)
- [Monitor install and interact with cluster](#monitor-install-and-interact-with-cluster)
- [Deploy a Multi Node OpenShift cluster via Jetlag from a Scale Lab Bastion Machine quickstart](#deploy-a-multi-node-openshift-cluster-via-jetlag-from-a-scale-lab-bastion-machine-quickstart)
- [Bastion setup](#bastion-setup)
- [Configure Ansible vars in `all.yml`](#configure-ansible-vars-in-allyml)
- [Lab \& cluster infrastructure vars](#lab--cluster-infrastructure-vars)
- [Bastion node vars](#bastion-node-vars)
- [OCP node vars](#ocp-node-vars)
- [Deploy in the public VLAN](#deploy-in-the-public-vlan)
- [Extra vars](#extra-vars)
- [Disconnected and ipv6 vars](#disconnected-and-ipv6-vars)
- [Review vars `all.yml`](#review-vars-allyml)
- [Run playbooks](#run-playbooks)
- [Monitor install and interact with cluster](#monitor-install-and-interact-with-cluster)
<!-- /TOC -->

<!-- Bastion setup is duplicated in multiple files and should be kept in sync!
Expand Down Expand Up @@ -275,6 +282,19 @@ controlplane_lab_interface: eno12399np0

** If your machine types are not homogeneous, then you will have to manually edit your generated inventory file to correct any nic names until this is reasonably automated.

### Deploy in the public VLAN

In order to deploy a cluster using the public VLAN, set the variable `public_vlan` in `all.yml` to `true`. Once enabled the following variables are automatically configured:

- `controlplane_network_interface_idx`: Is set to the corresponding interface number
- `base_dns_name` is set to `rdu2.scalelab.redhat.com` in the inventory
- `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`

When the deployment is completed, the cluster API and routes should be reachable directly from the VPN.

### Extra vars

For multi node deployment of OCP 4.13 or later, it's advisable to configure the following extra variables.
Expand Down Expand Up @@ -321,8 +341,21 @@ lab_cloud: cloud99
# Either mno or rwn or sno
cluster_type: mno

# Applies to both mno/rwn clusters
worker_node_count: 0
# Applies to both bm/rwn clusters
cluster_name: mno
worker_node_count: 2

# Applies to bm/rwn/sno clusters
base_dns_name: example.com

# Lab Network type, applies to sno and bm cluster_type only
# 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,
# base_dns_name, cluster_name, controlplane_network, network_prefix, gateway to the values
# required in the public VLAN attached to the lab assignment
public_vlan: false

# Enter whether the build should use 'dev' (early candidate builds) or 'ga' for Generally Available versions of OpenShift
# Empty value results in playbook failing with error message. Example of dev builds would be 'candidate-4.17', 'candidate-4.16'
Expand All @@ -341,12 +374,6 @@ ocp_version: "latest-4.16"
# Either "OVNKubernetes" or "OpenShiftSDN" (Only for MNO/RWN cluster types)
networktype: OVNKubernetes

# Lab Network type, applies to sno cluster_type only
# 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
public_vlan: false

ssh_private_key_file: ~/.ssh/id_rsa
ssh_public_key_file: ~/.ssh/id_rsa.pub
# Place your pull_secret.txt in the base directory of the cloned Jetlag repo, Example:
Expand Down