5.1 Setup
In order to explore GitOps processes, we are going to need appropriate tools: Gitea and ArgoCD.
Task 5.1.1: Gitea
Gitea is a lightweight Git server written in Go. It allows us to easily host a Git repository which we can use as our single source of truth.
Unfortunately, the default Operator catalog sources don’t contain a Gitea operator, but let’s change that.
Create the Gitea Operator by applying the YAML files from the Github repository:
oc apply -k https://github.com/rhpds/gitea-operator/OLMDeploy
Now check the status of the Gitea Operator in the web console.
Hints
- In the Administrator view of your web console, navigate to Operators, then Installed Operators
- Filter for “Gitea Operator” and wait for the Operator to finish its installation successfully
This was just the Operator part. We now have to create a Gitea instance.
First, create a new project.
Hints
oc new-project gitea
The instance you are going to create has the following content:
apiVersion: pfe.rhpds.com/v1
kind: Gitea
metadata:
name: gitea
namespace: gitea
spec:
giteaImageTag: latest
giteaVolumeSize: 1Gi
giteaSsl: true
postgresqlVolumeSize: 1Gi
Create the instance.
Hints
oc apply -f https://raw.githubusercontent.com/acend/openshift-operations-training/main/content/en/docs/05/resources/gitea_gitea.yaml
That’s it! Watch the pods start.
Hints
oc -n gitea get pods -w
As soon as the postgresql as well as the gitea pods are running, get the hostname from the route.
Hints
oc -n gitea get route gitea -o go-template='https://{{ .spec.host }}{{ "\n" }}'
Open the URL in your browser and register yourself a user. Note the username and password you chose, you will need them later.
Task 5.1.2: Argo CD
We are going to install Argo CD in the form of the OpenShift GitOps Operator. Install the GitOps Operator via OperatorHub in OpenShift’s web console.
Hints
- Head over to the OperatorHub on your cluster, filter for “gitops” and choose Red Hat OpenShift GitOps
- Click Install
- Leave the pre-filled values as-is and again click Install
This installs a nearly ready-to-use Argo CD instance.
You can see that when looking into the openshift-gitops namespace:
- An
argocdcustom resource namedopenshift-gitopswas created - This in turn led the Operator to create all the pods and routes you can see
What we need to do to make it fully operational is slightly adjust certain parameters in its custom resources configuration:
- Add tolerations and node selectors to make all pods run on infra nodes
- Change the route’s termination to reencrypt
Apply the following resources.
- The Argo CD custom resource to change the route termination and add the node placement definition:
apiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
name: openshift-gitops
namespace: openshift-gitops
spec:
applicationSet:
resources:
limits:
cpu: "2"
memory: 1Gi
requests:
cpu: 250m
memory: 512Mi
controller:
processors: {}
resources:
limits:
cpu: "2"
memory: 2Gi
requests:
cpu: 250m
memory: 1Gi
sharding: {}
dex:
openShiftOAuth: true
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 250m
memory: 128Mi
grafana:
enabled: false
ingress:
enabled: false
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 250m
memory: 128Mi
route:
enabled: false
ha:
enabled: false
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 250m
memory: 128Mi
initialSSHKnownHosts: {}
prometheus:
enabled: false
ingress:
enabled: false
route:
enabled: false
rbac:
policy: g, system:cluster-admins, role:admin
scopes: '[groups]'
redis:
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 250m
memory: 128Mi
repo:
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 250m
memory: 256Mi
resourceExclusions: |
- apiGroups:
- tekton.dev
clusters:
- '*'
kinds:
- TaskRun
- PipelineRun
server:
autoscale:
enabled: false
grpc:
ingress:
enabled: false
ingress:
enabled: false
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 125m
memory: 128Mi
route:
enabled: true
tls:
termination: reencrypt
service:
type: ""
nodePlacement:
nodeSelector:
node-role.kubernetes.io/infra: ""
tolerations:
- effect: NoSchedule
key: "node-role.kubernetes.io/infra"
tls:
ca: {}
- The GitOpsService custom resource to move the Operator itself onto infra nodes as well:
apiVersion: pipelines.openshift.io/v1alpha1
kind: GitopsService
metadata:
name: cluster
spec:
runOnInfra: true
tolerations:
- effect: NoSchedule
key: "node-role.kubernetes.io/infra"