AgnosticV operator is an implementation of agnosticv running in OpenShift / k8s. In short, AgnosticV is vars for the deployer agnosticD.
This is the operator that takes care of updating the Catalog in OpenShift, based on several agnosticV repos.
The output of the operator, the final catalog, is composed of OpenShift resources:
-
OpenShift Templates
-
AnarchyGovernors
See also the Babylon Project.
common.yaml ACCOUNT/ account.yaml CATALOGITEM1/ common.yaml dev.yaml test.yaml prod.yaml CATALOGITEM2/ common.yaml dev.yaml test.yaml prod.yaml
common.yaml gpte/ account.yaml OCP4_CLUSTER/ common.yaml dev.yaml test.yaml prod.yaml OCP_CLIENTVM/ common.yaml dev.yaml test.yaml prod.yaml
In this example above, agnosticv-operator will produce 6 catalog items:
-
gpte.ocp4-cluster.dev
-
gpte.ocp4-cluster.test
-
gpte.ocp4-cluster.prod
-
gpte.ocp-clientvm.dev
-
gpte.ocp-clientvm.test
-
gpte.ocp-clientvm.prod
The files are merged in this order:
-
common.yml
-
ACCOUNT/account.yml
-
ACCOUNT/CATALOG_ITEM/common.yml
-
ACCOUNT/CATALOG_ITEM/STAGE.yml
for example:
-
common.yml
-
gpte/account.yml
-
gpte/OCP4_CLUSTER/common.yml
-
gpte/OCP4_CLUSTER/dev.yml
The agnosticv-operator uses the default agnosticv implementation: agnosticv CLI written in go.
See the merging strategy here: https://github.com/redhat-cop/agnosticv#merging-strategies
This Helm chart will take care of most of the things you need:
-
serviceaccount/agnosticv-operator
-
role.rbac.authorization.k8s.io/agnosticv-operator
-
rolebinding.rbac.authorization.k8s.io/agnosticv-operator
-
deployment.apps/agnosticv-operator
-
clusterrole.authorization.openshift.io/agnosticv-operator
-
clusterrolebinding.rbac.authorization.k8s.io/agnosticv-operator-clusterrolebinding
-
customresourcedefinition.apiextensions.k8s.io/agnosticvrepos.gpte.redhat.com
-
namespaces "agnosticv-operator"
Just run the following:
helm install agnosticv-operator helm/
# or with OpenShift Template
oc process -f https://raw.githubusercontent.com/redhat-gpte-devopsautomation/agnosticv-operator/master/deploy-template.yaml|oc create -f -
The agnosticv-operator is listening on several agnosticV repos. This is represented by the Custom Resource AgnosticVRepo
.
Here is an example for a private github repo.
apiVersion: gpte.redhat.com/v1
kind: AgnosticVRepo
metadata:
generation: 1
name: gpte-agnosticv
namespace: "agnosticv-operator"
selfLink: /apis/gpte.redhat.com/v1/namespaces/agnosticv-operator/agnosticvrepos/gpte-agnosticv
spec:
ref: master
sshKey: agnosticv-operator-sshkey
url: git@github.com:redhat-gpe/agnosticv.git
contextDir: ''
babylon_anarchy_roles:
- name: babylon_anarchy_governor
src: https://github.com/redhat-gpte-devopsautomation/babylon_anarchy_governor.git
version: main
oc create -f agnosticv-gpte-private-repo.yaml
If you repo is public, then you can use HTTP repo for spec.url
and you don’t need the following steps.
oc create secret generic -n agnosticv-operator agnosticv-operator-sshkey --from-file=id_rsa=/home/ec2-user/.ssh/id_rsa