Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user facing documnetation on how to install hypershift and HASC CR
- Loading branch information
Showing
1 changed file
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# Hypershift zero worker deployment | ||
|
||
## Prerequisites | ||
1. Deploy hub cluster using [dev-scripts]((https://github.com/javipolo/openshift-assisted-installer-tests/tree/4515edfc9d60a587cabd3bcfdd77826cab8cc02d/ai-in-zero-worker-hypershift#deploy-an-l0-hub-cluster-using-dev-scripts)) | ||
2. Hive [installation](https://github.com/javipolo/openshift-assisted-installer-tests/tree/4515edfc9d60a587cabd3bcfdd77826cab8cc02d/ai-in-zero-worker-hypershift#install-hypershift) | ||
3. Create [hypershift cluster](https://github.com/javipolo/openshift-assisted-installer-tests/tree/4515edfc9d60a587cabd3bcfdd77826cab8cc02d/ai-in-zero-worker-hypershift#create-hypershift-cluster) | ||
|
||
## Deploying the hub cluster | ||
### Set up our environment | ||
```bash | ||
AGENT_NAMESPACE=myclusters | ||
CLUSTERNAME=acm-1 | ||
CLUSTER_NAMESPACE=${AGENT_NAMESPACE}-${CLUSTERNAME} | ||
BASEDOMAIN=redhat.com | ||
SSHKEY=~/.ssh/id_rsa.pub | ||
``` | ||
|
||
### Deploy Hypershift | ||
```bash | ||
export HYPERSHIFT_IMAGE=quay.io/hypershift/hypershift-operator:4.11 | ||
|
||
alias hypershift="podman run --net host --rm --entrypoint /usr/bin/hypershift -e KUBECONFIG=/credentials/kubeconfig -v /root/.ssh:/root/.ssh -v /tmp/kubeconfig:/credentials/kubeconfig -v /tmp/pull-secret.json:/tmp/pull-secret.json $HYPERSHIFT_IMAGE" | ||
|
||
hypershift install --hypershift-image $HYPERSHIFT_IMAGE | ||
oc -n hypershift get pods -w | ||
``` | ||
|
||
### Deploy Hyperhisft cluster | ||
```bash | ||
# Create namespace | ||
oc create namespace $AGENT_NAMESPACE | ||
|
||
# Create hypershift cluster | ||
hypershift create cluster agent --name $CLUSTERNAME --base-domain $BASEDOMAIN --pull-secret /tmp/pull-secret.json --ssh-key $SSHKEY --agent-namespace $AGENT_NAMESPACE --namespace $AGENT_NAMESPACE | ||
|
||
# Wait for hypershift cluster (wait for available) | ||
oc get po -n $CLUSTER_NAMESPACE -w | ||
oc get hostedclusters -A -w | ||
|
||
# Generate kubeconfig for the generated spoke (hypershift) cluster | ||
hypershift create kubeconfig --name $CLUSTERNAME --namespace $AGENT_NAMESPACE | sed s/admin/$CLUSTERNAME/g > /tmp/kubeconfig.$CLUSTERNAME | ||
|
||
# save the generated kubeconfig in a secret on the hub cluster | ||
oc -n $CLUSTERNAME create secret generic $CLUSTERNAME-kubeconfig --from-file=kubeconfig=/tmp/kubeconfig.$CLUSTERNAME | ||
``` | ||
|
||
## Install CRDS | ||
```bash | ||
# install assisted-service CRDs on the spoke cluster | ||
oc --kubeconfig /tmp/kubeconfig.$CLUSTERNAME create namespace $CLUSTERNAME | ||
KUBECONFIG=/tmp/kubeconfig.$CLUSTERNAME ENABLE_KUBE_API=true make deploy-resources | ||
|
||
# install hive CRDs on the hub cluster | ||
oc apply -f hive.openshift.io_clusterdeployments.yaml | ||
oc apply -f hive.openshift.io_clusterimagesets.yaml | ||
oc apply -f metal3.io_baremetalhosts.yaml | ||
|
||
# install hive CRDs on the spoke cluster | ||
oc --kubeconfig /tmp/kubeconfig.$CLUSTERNAME apply -f hive.openshift.io_clusterdeployments.yaml | ||
oc --kubeconfig /tmp/kubeconfig.$CLUSTERNAME apply -f hive.openshift.io_clusterimagesets.yaml | ||
oc --kubeconfig /tmp/kubeconfig.$CLUSTERNAME apply -f metal3.io_baremetalhosts.yaml | ||
``` | ||
|
||
## Infrastructure Operator | ||
### Install the operator | ||
```bash | ||
# install OLM (change versions as they progress) | ||
# download the installation script | ||
https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.22.0/install.sh -o install.sh | ||
|
||
# run the installation script | ||
chmod +x install.sh | ||
./install.sh v0.22.0 | ||
|
||
# install assisted infrastructure operator | ||
oc create namespace $CLUSTERNAME | ||
operator-sdk run bundle -n assisted-installer $BUNDLE_IMAGE | ||
operator-sdk run bundle -n assisted-installer $BUNDLE_IMAGE | ||
``` | ||
|
||
### Define HypershiftAgenConfigService | ||
```bash | ||
cat <<EOF | kubectl create -f - | ||
apiVersion: agent-install.openshift.io/v1beta1 | ||
kind: HypershiftAgentServiceConfig | ||
metadata: | ||
name: agent-$CLUSTERNAME | ||
namespace: $CLUSTERNAME | ||
spec: | ||
databaseStorage: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
filesystemStorage: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 20Gi | ||
imageStorage: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
osImages: | ||
- cpuArchitecture: x86_64 | ||
openshiftVersion: '4.11' | ||
url: https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.11/4.11.0/rhcos-4.11.0-x86_64-live.x86_64.iso | ||
version: 411.86.202207150124-0 | ||
EOF | ||
``` | ||
|
||
# Sanity test | ||
## Create an infraenv | ||
```bash | ||
oc create --context $CLUSTERNAME ns test | ||
|
||
# create pull secret | ||
oc create --context $CLUSTERNAME secret generic pull-secret -n test --from-file=.dockerconfigjson=pull-secret.json --type=kubernetes.io/dockerconfigjson | ||
|
||
# create infraenv | ||
cat << EOF | oc apply --context $CLUSTERNAME -f - | ||
apiVersion: agent-install.openshift.io/v1beta1 | ||
kind: InfraEnv | ||
metadata: | ||
name: test | ||
namespace: test | ||
spec: | ||
pullSecretRef: | ||
name: pull-secret | ||
EOF | ||
|
||
# Check that discovery ISO is generated and downloadable | ||
oc get infraenv --context $CLUSTERNAME -n test test -ojsonpath={.status.isoDownloadURL} | xargs curl -kI | ||
|
||
# Look in agentinstalladmission logs that validations have been done for new infraenv | ||
oc logs -n $NAMESPACE -l app=agentinstalladmission | ||
``` |