Files
workshops/data/app-delivery/README.org

2.8 KiB

OpenShift Workshops

This repository contains a basic nextjs frontend designed to be exported as a static site and served via github pages.

The frontend is used to serve workshop instructions for several workshops.

Setting up a cluster for the workshop

The workshop expects an OpenShift 4.14 cluster with a few pre-requisites.

Add redhat-cop helm chart repository

Required so the Gitea helm chart will be available for all users.

cat << EOF | oc apply --filename -
apiVersion: helm.openshift.io/v1beta1
kind: HelmChartRepository
metadata:
  name: redhat-cop
spec:
  connectionConfig:
    url: 'https://redhat-cop.github.io/helm-charts'
  name: Red Hat Community
EOF

Install web terminal operator

So our workshop participants don't need to install oc locally.

cat << EOF | oc apply --filename -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: web-terminal
  namespace: openshift-operators
spec:
  channel: fast
  installPlanApproval: Automatic
  name: web-terminal
  source: redhat-operators
  sourceNamespace: openshift-marketplace
EOF

Create an operatorgroup for each user

We want each user to be able to install the same operator so we can pre-create namespaces and seed them with OperatorGroups to reduce complexity.

cat << EOF > operatorgroup.yaml
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: grafana-og
spec:
  targetNamespaces:
    - user$user
  upgradeStrategy: Default
EOF

for user in $(seq 1 30); do
    export user=${user}
    oc new-project user"${user}"
    envsubst < operatorgroup.yaml | oc create --filename - --namespace user"${user}"
    oc adm policy add-role-to-user --namespace user"${user}" admin user"${user}"
done

Install openshift gitops operator

Each user will deploy their own argocd instance so we need to install the openshift gitops operator for all namespaces.

cat << EOF | oc apply --filename -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: openshift-gitops-operator
  namespace: openshift-gitops-operator                                                                                                                       
spec:
  channel: latest
  installPlanApproval: Automatic
  name: openshift-gitops-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
  startingCSV: openshift-gitops-operator.v1.13.0
EOF

Scale cluster worker nodes

We are going to have ~25 workshop attendees all deploying applications, let's ensure the cluster has enough capacity to handle it!

oc scale machineset cluster-xxz98-mk8x7-worker-ap-southeast-1b -n openshift-machine-api --replicas 10