Skip to content

Commit

Permalink
Fix hypershift (#5643)
Browse files Browse the repository at this point in the history
* Fix variable for ocp4 pull secret to use same as ocp4_installer role

* Updated instructions

Co-authored-by: Wolfgang Kulhanek <[email protected]>
  • Loading branch information
wkulhanek and Wolfgang Kulhanek authored Nov 16, 2022
1 parent 2ebed44 commit 28d5fc6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type: Opaque
data:
ssh-publickey: {{ r_hypershift_public_key.content }}
ssh-privatekey: {{ r_hypershift_private_key.content }}
pullSecret: {{ ocp4_token | b64encode }}
pullSecret: {{ ocp4_pull_secret | b64encode }}
baseDomain: {{ subdomain_base | b64encode }}
aws_secret_access_key: {{ aws_secret_access_key | b64encode }}
aws_access_key_id: {{ aws_access_key_id | b64encode }}
98 changes: 44 additions & 54 deletions docs/Setup AgnosticD on Mac.adoc
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
= Setup AgnosticD on M1 Macs for OpenShift development (non Execution Environment version)
= Setup AgnosticD on macOS for OpenShift development (non Execution Environment version)

[WARNING]
====
This is a stop gap solution until the Ansible BU supports building execution environments on M1 Macs.
====

This documents walks through how to set up AgnosticD development on a Mac (with M1 chip) for OpenShift development.
This documents walks through how to set up AgnosticD development on macOS (with M1 or Intel chip) for OpenShift development.

. Make sure you have Homebrew installed (https://brew.sh)
. Install Python 3, Virtualenv and jq
. Install prerequisites
+
[source,sh]
----
Expand All @@ -19,7 +14,6 @@ brew install python3 virtualenv jq openssl@3 rust
+
[source,sh]
----
mkdir -p ~/Development/agnosticd
mkdir -p ~/Development/agnosticd-vars
mkdir -p ~/Development/agnosticd-output
mkdir -p ~/Development/virtualenvs
Expand All @@ -30,7 +24,9 @@ mkdir -p ~/Development/virtualenvs
[source,sh]
----
cd ~/Development
git clone https://github.com/redhat-cop/agnosticd

# Use SSH clone, you can not push back to the repo using https
git clone [email protected]:redhat-cop/agnosticd
----

. Install XCode from the Mac App Store
Expand All @@ -50,25 +46,6 @@ xcode-select --install
cat ~/Development/agnosticd/tools/virtualenvs/ansible2.9-python3.6-2022-07-27.txt | grep -v pyinotify > ~/Development/virtualenvs/agnosticd.txt
----

.. Create requirements file for Ansible Collections (again this is mine, offial is at https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/ocp4-cluster/requirements.yml)
+
~/Development/virtualenvs/collections.yaml
[source,yaml]
----
---
collections:
- name: amazon.aws
version: 2.3.0 # Do not use anything newer than 2.x
- name: kubernetes.core
version: 2.3.2
- name: community.general
version: 5.4.0
- name: ansible.posix
version: 1.4.0
- name: community.crypto
version: 2.7.1
----
.. Create the virtualenv
+
[source,sh]
Expand All @@ -85,7 +62,7 @@ export LDFLAGS="-L$(brew --prefix openssl@3)/lib"
export CFLAGS="-Wno-error=implicit-function-declaration -I$(brew --prefix openssl@3)/include"
pip install -r ~/Development/virtualenvs/agnosticd.txt
ansible-galaxy install -r ~/Development/virtualenvs/collections.yaml
ansible-galaxy install -r ~/Development/agnosticd/ansible/configs/ocp4-cluster/requirements.yml
----

. Link the deployer scripts to you `~/bin` directory (make sure `~/bin` is in your PATH in either `.bashrc` or `.zshrc`):
Expand All @@ -98,11 +75,28 @@ ln -s ~/Development/agnosticd/tools/deployer_scripts/* ~/bin

== Deploy a new OpenShift Cluster

=== Setting up secrets
=== Create a Key Pair

In order to access the bastion VM of your cluster you need an ssh key pair. The easiest way to manage that is to store your public key on Github.

. Create a new key pair (hit enter twice for no passphrase)
+
[source,sh]
----
# XXXXXX is your redhat ID
ssh-keygen -f ~/.ssh/XXXXXXXXX-github
----

. Upload your public key to Github
.. Navigate to https://github.com/settings/keys
.. Click *New SSH Key*
.. Use a Title for you to remember what this is for e.g. `agnosticd-key` and paste your *public* key from `~/.ssh/XXXXXXXXX-github.pub`

=== Set up secrets

. Create a secrets file for generic secret information (RHN subscription, Pull Secret, ...)
+
~/Development/agnosticd-vars/secrets.yaml
.~/Development/agnosticd-vars/secrets.yaml
[source,yaml]
----
# Satellite
Expand Down Expand Up @@ -130,7 +124,7 @@ ssh_authorized_keys:

. Create a second secrets file for your cloud environment. E.g. for an AWS Open Environment (from https://demo.redhat.com)
+
~/Development/agnosticd-vars/secrets-sandbox.yaml
.~/Development/agnosticd-vars/secrets-sandbox.yaml
[source,yaml]
----
# Get these values from the Open Environment
Expand All @@ -142,23 +136,6 @@ subdomain_base_suffix: .sandboxXXXX.opentlc.com
agnosticd_aws_capacity_reservation_enable: false
----

== Create a Key Pair
In order to access the bastion VM of your cluster you need an ssh key pair. The easiest way to manage that is to store your public key on Github.
. Create a new key pair (hit enter twice for no passphrase)
+
[source,sh]
----
# XXXXXX is your redhat ID
ssh-keygen -f ~/.ssh/XXXXXXXXX-github
----
. Upload your public key to Github
.. Navigate to https://github.com/settings/keys
.. Click *New SSH Key*
.. Use a Title for you to remember what this is for e.g. `agnosticd-key` and paste your *public* key from `~/.ssh/XXXXXXXXX-github.pub`
== Deploying a base cluster

To start development on a workload you want to have a base OpenShift cluster available. The following variable file sets up an OpenShift cluster with Let's Encrypt certificates and HTPasswd authentication.
Expand Down Expand Up @@ -193,10 +170,6 @@ aws_region: us-east-2
# - us-east-2a
# - us-east-2b
# Use key from your Github
ssh_authorized_keys:
- key: https://github.com/GITHUBID.keys

cloud_tags:
- owner: "<< YOUR REDHAT EMAIL >>"
- Purpose: development
Expand Down Expand Up @@ -274,6 +247,23 @@ aad_create myguid ocp-cluster sandbox
aad_destroy myguid ocp-cluster sandbox
----

== Connecting to your cluster

Once your cluster has been created you can use either the ssh key you specified in the configuration or the ssh key that got generated during the deploy to access the bastion VM.

. SSH to your bastion VM:
+
[source,sh]
----
# Your Key (private key matching your public key in Github)
# (replace GUID with your guid and XXXX with your sandbox number)
ssh -i ~/.ssh/xxxxxxxxx-github [email protected]
# or using the key the deployer created
# (replace GUID with your guid and XXXX with your sandbox number)
ssh -i ~/Development/agnosticd-output/GUID/ssh_provision_GUID [email protected]
----

== Deploying a workload on a cluster

. To deploy a workload on an already provisioned base cluster create a vars file for your workload. The name of the vars file must be the same as the name of the workload role.
Expand Down

0 comments on commit 28d5fc6

Please sign in to comment.