Skip to content

Latest commit

 

History

History
195 lines (181 loc) · 10.7 KB

manual-steps.md

File metadata and controls

195 lines (181 loc) · 10.7 KB

Creating the test infrastructure

The following steps create the virtual test environment infrastructure including VMs, libvirt networks and setting up the virtual BMCs. The same steps can be achieved from the ocp-edge-demo-virt job by selecting the Provision stage only, without running the Deploy stage.

mkdir ocp-edge-virt-env
cd ocp-edge-virt-env/
yum install -y libvirt-devel python3-virtualenv gcc git python3-libvirt
dnf localinstall -y http://download.eng.bos.redhat.com/brewroot/vol/rhel-8/packages/sshpass/1.06/3.el8ae/x86_64/sshpass-1.06-3.el8ae.x86_64.rpm
virtualenv virtualenv
source virtualenv/bin/activate
pip install ansible==2.8 linchpin==1.7.6.2 libvirt-python netaddr lxml
curl -o virtualenv/bin/install_selinux_venv.sh https://raw.githubusercontent.com/CentOS-PaaS-SIG/linchpin/1792bb8fa02c4acbef63c987f715f0c3cf8b193e/scripts/install_selinux_venv.sh; bash -x virtualenv/bin/install_selinux_venv.sh
git -c http.sslVerify=false clone https://gitlab.cee.redhat.com/ocp-edge-qe/ocp-edge-demo.git
cd ocp-edge-demo/linchpin-workspace/
## Edit custom vars in hooks/ansible/ocp-edge-setup/extravars.yaml if needed
ansible -c local localhost -m template -a "src=hooks/ansible/ocp-edge-setup/extravars.yaml dest=$PWD/extravars.yaml" -e @hooks/ansible/ocp-edge-setup/extravars.yaml
linchpin --template-data @extravars.yaml -v destroy libvirt-network libvirt-new
linchpin --template-data @extravars.yaml -v up libvirt-network libvirt-new cfgs
virsh list --all

 Id    Name                           State
----------------------------------------------------
 15    worker-3                       running
 -     master-0                       shut off
 -     master-1                       shut off
 -     master-2                       shut off
 -     worker-0                       shut off
 -     worker-1                       shut off
 -     worker-2                       shut off

virsh net-list

  Name                 State      Autostart     Persistent
 ----------------------------------------------------------
  baremetal            active     no            yes
  default              active     yes           yes
  provisioning         active     no            yes

/root/.virtualenvs/vbmc/bin/python /root/.virtualenvs/vbmc/bin/vbmc list
  +-------------+---------+----------------------+------+
  | Domain name | Status  | Address              | Port |
  +-------------+---------+----------------------+------+
  | master-0    | running | ::ffff:192.168.123.1 | 6230 |
  | master-1    | running | ::ffff:192.168.123.1 | 6231 |
  | master-2    | running | ::ffff:192.168.123.1 | 6232 |
  | worker-0    | running | ::ffff:192.168.123.1 | 6233 |
  | worker-1    | running | ::ffff:192.168.123.1 | 6234 |
  | worker-2    | running | ::ffff:192.168.123.1 | 6235 |
  +-------------+---------+----------------------+------+

Running dev-scripts

The commands below include all steps required for deploying the environment with dev-scripts

ssh kni@provisionhost
sudo subscription-manager register --serverurl=https://subscription.rhn.stage.redhat.com --username rhhi-next-qe --password redhat
sudo subscription-manager attach --pool=8a99f9a96def8e1a016df3fd21a60519
sudo dnf install -y git make firewalld
sudo systemctl --now enable firewalld
git clone https://github.com/openshift-metal3/dev-scripts.git
cd dev-scripts/
cp config_example.sh config_$USER.sh
## Edit config file
vi config_$USER.sh
#!/bin/bash

set +x
export PULL_SECRET='{ "auths": { "cloud.openshift.com":{"auth":"b3BlbnNoaWZ0LXJlbGVhc2UtZGV2K21jb3JuZWFyZWRoYXRjb20xZmM0MHZzZ3h3cWVxa294dmpxeWk0eHF0ZXk6V0YxU0U2Rk82NlYzSE5CMVczUVFDOE9CSk81MFJGTFVNRVZPTUhUNEE2WVQ5MlVRRFJTTUZOVEQyNjYzRUQ3Vg==","email":"[email protected]"},"quay.io":{"auth":"b3BlbnNoaWZ0LXJlbGVhc2UtZGV2K21jb3JuZWFyZWRoYXRjb20xZmM0MHZzZ3h3cWVxa294dmpxeWk0eHF0ZXk6V0YxU0U2Rk82NlYzSE5CMVczUVFDOE9CSk81MFJGTFVNRVZPTUhUNEE2WVQ5MlVRRFJTTUZOVEQyNjYzRUQ3Vg==","email":"[email protected]"},"registry.connect.redhat.com":{"auth":"NzQ4NDMyN3x1aGMtMUZDNDBWc0d4V3FFcWtPeFZKUXlJNFhRVGV5OmV5SmhiR2NpT2lKU1V6VXhNaUo5LmV5SnpkV0lpT2lJ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3SU8zVEU5SU55S3BqTmo5eTIwNmtFN0NNSVNMWmRWWFl3MkpIQ1BmSmJQMHNJY3V0dnFvOTdGdw==" } } }'
set -x

NODES_PLATFORM=baremetal
INT_IF=eth1
PRO_IF=eth0
CLUSTER_PRO_IF=ens3
ROOT_DISK=/dev/sda
NODES_FILE=/home/kni/instackenv.json
MANAGE_BR_BRIDGE=n
NUM_WORKERS=1
CLUSTER_NAME=ostest
BASE_DOMAIN=test.metalkube.org
DNS_VIP=192.168.123.6
EXTERNAL_SUBNET=192.168.123.0/24

# Create json file to define nodes IPMI details
# Note: change MAC addresses according to the VMs created on your setup
# This file can also be copied from the hypervisor, in /tmp/ipmi_nodes.json

[kni@worker-1 dev-scripts]$ vi /home/kni/instackenv.json
{
  "nodes": [
    {
      "name": "openshift-master-0",
      "driver": "ipmi",
      "resource_class": "baremetal",
      "driver_info": {
        "username": "admin",
        "password": "password",
        "address": "ipmi://192.168.123.1:6230",
        "deploy_kernel": "http://172.22.0.1/images/ironic-python-agent.kernel",
        "deploy_ramdisk": "http://172.22.0.1/images/ironic-python-agent.initramfs"
      },
      "ports": [{
        "address": "52:54:00:31:bc:53",
        "pxe_enabled": true
      }],
      "properties": {
        "local_gb": "0",
        "cpu_arch": "x86_64"
      }
    }
        ,
          {
      "name": "openshift-master-1",
      "driver": "ipmi",
      "resource_class": "baremetal",
      "driver_info": {
        "username": "admin",
        "password": "password",
        "address": "ipmi://192.168.123.1:6231",
        "deploy_kernel": "http://172.22.0.1/images/ironic-python-agent.kernel",
        "deploy_ramdisk": "http://172.22.0.1/images/ironic-python-agent.initramfs"
      },
      "ports": [{
        "address": "52:54:00:0c:25:58",
        "pxe_enabled": true
      }],
      "properties": {
        "local_gb": "0",
        "cpu_arch": "x86_64"
      }
    }
        ,
          {
      "name": "openshift-master-2",
      "driver": "ipmi",
      "resource_class": "baremetal",
      "driver_info": {
        "username": "admin",
        "password": "password",
        "address": "ipmi://192.168.123.1:6232",
        "deploy_kernel": "http://172.22.0.1/images/ironic-python-agent.kernel",
        "deploy_ramdisk": "http://172.22.0.1/images/ironic-python-agent.initramfs"
      },
      "ports": [{
        "address": "52:54:00:06:c6:9a",
        "pxe_enabled": true
      }],
      "properties": {
        "local_gb": "0",
        "cpu_arch": "x86_64"
      }
    }
        ,
          {
      "name": "openshift-worker-0",
      "driver": "ipmi",
      "resource_class": "baremetal",
      "driver_info": {
        "username": "admin",
        "password": "password",
        "address": "ipmi://192.168.123.1:6233",
        "deploy_kernel": "http://172.22.0.1/images/ironic-python-agent.kernel",
        "deploy_ramdisk": "http://172.22.0.1/images/ironic-python-agent.initramfs"
      },
      "ports": [{
        "address": "52:54:00:1a:04:53",
        "pxe_enabled": true
      }],
      "properties": {
        "local_gb": "0",
        "cpu_arch": "x86_64"
      }
    }
        ]
}
## Run make
make

Reaching the environment from the corporate network

In order to reach the environment from your laptop you need to set up NAT rules which forward traffic to the API and ingress VIPs. To set them up we can use the following playbook:

cd ocp-edge-virt-env/
source virtualenv/bin/activate
cd ocp-edge-demo/linchpin-workspace/
ansible-playbook -i inventories/ocp-edge.inventory hooks/ansible/ocp-edge-setup/iptables_console.yaml -e @extravars.yaml