/openshift-gitops

Demonstrate gitops concepts in openshift

Primary LanguageMustache

OpenShift GitOps

A GitOps repo used to initialize various tools within an OpenShift cluster via ArgoCD.

Run the following commands to create a default ArgoCD instance and initiate the installation of all operators in this repository:

oc apply -k argocd
# Wait for argo to be available
oc apply -k main

TODO: This doesn't seem to work Optional - The default synchronization period is 3 minutes. Set it to a lower value for demo purposes:

# Set the sync period to 10 seconds
oc patch argocd/openshift-gitops -n openshift-gitops -p '{"spec":{"controller":{"appSync":"10s"}}}' --type=merge

# Restart the repo server
oc scale deployment/openshift-gitops-repo-server -n openshift-gitops --replicas=0

Operators

The following sub-sections describe the operators installed by this repository.

camelk

kafka

Also creates a KafkaCluster in the kafka namespace.


NOTE The subscription sets the environment variable FIPS_MODE to disabled to allow the operator to work properly in a FIPS enabled OpenShift installation.

knative

Also creates KnativeEventing, KnativeServing, and KnativeKafka instances in the correct namespaces. The KnativeKafka instance references the KafkaCluster that is created in the kafka namespace.

netobserv

A non-production Loki instance and FlowControl object will also be created. NetObserv will be available in the admin console.

servicemesh

This repository also installs the operators required by service mesh:

  • jaeger
  • kiali
  • elasticsearch

kubecost

Need to apply a label to the namespace to allow grafana and the controller to run privileged:

oc label  --overwrite ns kubecost  pod-security.kubernetes.io/enforce=privileged
oc adm policy add-scc-to-user anyuid -z kubecost-cluster-controller -n kubecost
oc adm policy add-scc-to-user anyuid -z kubecost-grafana -n kubecost

Deletion

  1. Delete the application sets (Will take a while, monitor progresss in argocd):
    oc delete appset openshift-operators-instances --cascade=foreground --wait -n openshift-gitops
    oc delete appset openshift-operators --cascade=foreground --wait -n openshift-gitops
  2. Delete the knative-* projects.
     oc get project --no-headers -o custom-columns=NAME:..metadata.name | grep knative | xargs oc delete project
  3. Manually delete all the remaining operators (cluster service versions) in the admin web console or by cli:
    # Delete individual CSVs
    oc get csv -n opesnhift-operators
    oc delete csv <NAME_HERE> -n openshift-operators
    
    # OR Delete all CSVs except the gitops csv. Only do this if you have not installed additional operators!
    # oc get csv -n openshift-operators --no-headers -o custom-columns=NAME:..metadata.name | grep -v gitops | xargs oc delete csv -n openshift-operators
    
  4. Run the service mesh cleanup script:
    scripts/servicemeshcleanup.sh