Skip to content

Commit

Permalink
Updated for v4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vchintal committed Oct 19, 2019
1 parent a124153 commit 5b6c573
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 41 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

The goal of this repo is to make deploying and redeploying a new Openshift v4 cluster a snap. The document looks long but after you have used it till end once, you will appreciate how quickly VMs come up in vCenter for you to start working with.

Using the same repo and with minor tweaks, it can be applied to any version of Oepnshift higher than the current version of 4.1.
Using the same repo and with minor tweaks, it can be applied to any version of Openshift higher than the current version of 4.2.

## Prerequisites

1. vSphere ESXi and vCenter 6.7 installed
2. A datacenter created with vSphere host added to it
3. **VM and Template folder** created with the same name as the **Openshift cluster name** you would like to use, as described in the [documentation](https://docs.openshift.com/container-platform/4.1/installing/installing_vsphere/installing-vsphere.html#installation-vsphere-machines_installing-vsphere)
4. The OVF template deployed in the ***same folder*** from the OVA file [located here](https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/4.1/latest/rhcos-4.1.0-x86_64-vmware.ova) using instructions from **#6** step of the same documentation as in the previous step. Once deployed, on the template name, right-click and select **Edit Settings** and do the following:
3. **VM and Template folder** created with the same name as the **Openshift cluster name** you would like to use, as described in the [documentation](https://docs.openshift.com/container-platform/4.2/installing/installing_vsphere/installing-vsphere.html#installation-vsphere-machines_installing-vsphere)
4. The OVF template deployed in the ***same folder*** from the OVA file [located here](https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/4.2/latest/rhcos-4.2.0-x86_64-vmware.ova) using instructions from **#6** step of the same documentation as in the previous step. Once deployed, on the template name, right-click and select **Edit Settings** and do the following:
* Under `Virtual Hardware` 🠮 `Network adapter 1` 🠮 Highlight and delete it by clicking on the x symbol on the right. ***This is an important step if you would like to use the mac addresses as defined in the file***
* Under the `VM Options` 🠮 `Advanced` 🠮 Latency Sensitivity; set it to **High**
* Under the `VM Options` 🠮 `Advanced` 🠮 `Configuration Parameters` 🠮 Edit Configuration; add the following param (name, value) respectively:
1. `disk.EnableUUID`, TRUE
2. `guestinfo.ignition.config.data.encoding`, base64
3. `guestinfo.ignition.config.data`, blah
4. `guestinfo.ovfEnv`, blah
* Save the template
* Save the template
5. Ideally have [helper node](https://github.com/christianh814/ocp4-upi-helpernode) running in the same network to provide all the necessary services such as [DHCP/DNS/HAProxy as LB/FTP Server]
6. Ansible 2.8.5 installed on the machine where this repo is cloned

Expand All @@ -26,13 +25,13 @@ Using the same repo and with minor tweaks, it can be applied to any version of O
### Prerequisites

1. Get the ***pull secret*** from [here](https://cloud.redhat.com/openshift/install/vsphere/user-provisioned)
2. Generate a ssh key pair as per [instructions](https://docs.openshift.com/container-platform/4.1/installing/installing_vsphere/installing-vsphere.html#ssh-agent-using_installing-vsphere). The private key will then be used to log into bootstrap/master and worker nodes
2. Generate a ssh key pair as per [instructions](https://docs.openshift.com/container-platform/4.2/installing/installing_vsphere/installing-vsphere.html#ssh-agent-using_installing-vsphere). The private key will then be used to log into bootstrap/master and worker nodes
3. Get the vcenter details:
1. IP Address
2. Username
3. Password
4. Datacenter name *(created in the earlier prerequisites)*
4. Actual links to the Openshift Client and Install binaries *(prepopulated for 4.1.x)*
4. Actual links to the Openshift Client and Install binaries *(prepopulated for 4.2.x)*
5. Openshift cluster
1. base domain *(prepopulated with **example.com**)*
2. cluster name *(prepopulated with **ocp4**)*
Expand Down Expand Up @@ -78,7 +77,7 @@ scp install-dir/bootstrap.ign root@192.168.86.180:/var/www/html/ignition

### Prereqisites

1. Get the name of the OVF template as deployed in the vCenter folder *(prepopulated with name **rhcos-4.1.0-x86_64-vmware**)*
1. Get the name of the OVF template as deployed in the vCenter folder *(prepopulated with name **rhcos-4.2.0-x86_64-vmware**)*
2. Get the correct path of the vCenter folder *(prepopulated with an example path in **setup-vcenter-vms.yml**)*
3. Get the vCenter datastore you want the VMs to use *(prepopulated with **datastore1**)*

Expand Down
11 changes: 11 additions & 0 deletions patches/cluster-scheduler-02-config.yml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- cluster-scheduler-02-config.yml 2019-10-19 11:37:18.565233175 -0700
+++ cluster-scheduler-02-config.yml.fixed 2019-10-19 11:44:21.537311090 -0700
@@ -4,7 +4,7 @@
creationTimestamp: null
name: cluster
spec:
- mastersSchedulable: true
+ mastersSchedulable: false
policy:
name: ""
status: {}
12 changes: 8 additions & 4 deletions setup-ocp-vsphere.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@
src: "{{ playbook_dir }}/install-dir/install-config.yaml"
dest: "{{ playbook_dir }}/install-dir/install-config.yaml.orig"

- name: Generate the ignition manifests
command: "{{ playbook_dir }}/bin/openshift-install create manifests --dir={{ playbook_dir }}/install-dir"

- name: Apply the patch to set mastersSchedulable to false
patch:
src: "{{ playbook_dir }}/patches/cluster-scheduler-02-config.yml.patch"
dest: "{{ playbook_dir }}/install-dir/manifests/cluster-scheduler-02-config.yml"

- name: Generate the ignition configs
command: "{{ playbook_dir }}/bin/openshift-install create ignition-configs --dir={{ playbook_dir }}/install-dir"

# - copy:
# src: "{{ playbook_dir }}/install-dir/bootstrap.ign"
# dest: /var/www/html/ignition

- name: Copy append-bootstrap.ign file into install-dir
template:
src: "{{ playbook_dir }}/templates/append-bootstrap.ign.j2"
Expand Down
32 changes: 7 additions & 25 deletions setup-vcenter-vms.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
---
- hosts: localhost
vars:
bootstrapOvfEnvContent : "{{ lookup('file', '{{ playbook_dir }}/install-dir/append-bootstrap-vm-param.txt') }}"
masterOvfEnvContent : "{{ lookup('file', '{{ playbook_dir }}/install-dir/master-vm-param.txt') }}"
workerOvfEnvContent : "{{ lookup('file', '{{ playbook_dir }}/install-dir/worker-vm-param.txt') }}"
bootstrapContent : "{{ lookup('file', '{{ playbook_dir }}/install-dir/append-bootstrap.64') }}"
masterContent : "{{ lookup('file', '{{ playbook_dir }}/install-dir/master.64') }}"
workerContent : "{{ lookup('file', '{{ playbook_dir }}/install-dir/worker.64') }}"
templateName : rhcos-4.1.0-x86_64-vmware
templateName : rhcos-4.2.0-x86_64-vmware
folder : "/dc/vm/ocp4"
datastore: "datastore1"
tasks:
- name: "Bootstrap guest.ovfEnv"
debug:
msg: "{{ bootstrapOvfEnvContent }}"
- name: "Master guest.ovfEnv"
debug:
msg: "{{ masterOvfEnvContent }}"
- name: "Worker guest.ovfEnv"
debug:
msg: "{{ workerOvfEnvContent }}"
- name: "Bootstrap base64"
debug:
msg: "{{ bootstrapContent }}"
Expand Down Expand Up @@ -53,8 +41,6 @@
mac: "00:50:56:a8:aa:a1"
wait_for_ip_address: no
customvalues:
- key: guestinfo.ovfEnv
value: "{{ bootstrapOvfEnvContent }}"
- key: guestinfo.ignition.config.data
value: "{{ bootstrapContent }}"
- name: Create master VMs from ther template
Expand All @@ -81,10 +67,8 @@
mac: "{{ item.mac }}"
wait_for_ip_address: no
customvalues:
- key: guestinfo.ovfEnv
value: "{{ masterOvfEnvContent }}"
- key: guestinfo.ignition.config.data
value: "{{ masterContent }}"
- key: guestinfo.ignition.config.data
value: "{{ masterContent }}"
loop:
- { name : "master0", mac: "00:50:56:a8:aa:a2"}
- { name : "master1", mac: "00:50:56:a8:aa:a3"}
Expand All @@ -105,18 +89,16 @@
type: thin
datastore: "{{ datastore }}"
hardware:
memory_mb: 8192
num_cpus: 2
memory_mb: 16384
num_cpus: 4
memory_reservation_lock: True
networks:
- name: VM Network
mac: "{{ item.mac }}"
wait_for_ip_address: no
customvalues:
- key: guestinfo.ovfEnv
value: "{{ workerOvfEnvContent }}"
- key: guestinfo.ignition.config.data
value: "{{ workerContent }}"
- key: guestinfo.ignition.config.data
value: "{{ workerContent }}"
loop:
- { name : "worker0", mac: "00:50:56:a8:aa:a6"}
- { name : "worker1", mac: "00:50:56:a8:aa:a7"}
Expand Down
6 changes: 2 additions & 4 deletions vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ vcenter:
password: Password123!
datacenter: dc
download:
#oc_client: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp-dev-preview/latest/openshift-client-linux-4.2.0-0.nightly-2019-09-25-233506.tar.gz"
#openshift_install: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp-dev-preview/latest/openshift-install-linux-4.2.0-0.nightly-2019-09-25-233506.tar.gz"
oc_client: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux-4.1.18.tar.gz"
openshift_install: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux-4.1.18.tar.gz"
oc_client: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux-4.2.0.tar.gz"
openshift_install: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux-4.2.0.tar.gz"

0 comments on commit 5b6c573

Please sign in to comment.