diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..948f187 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +infrastructure.yaml + diff --git a/README.md b/README.md index 460f0ac..a1ab0d6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,43 @@ -# gitops -GitOps artefacts +# GitOps Artefacts for the MAD Roadshow France 2023 + +## Pre-requisites + +* Install the OpenShift GitOps operator. + +* Fix the ArgoCD ingress route in order to use the router default TLS certificate. + +```sh +oc patch argocd openshift-gitops -n openshift-gitops -p '{"spec":{"server":{"insecure":true,"route":{"enabled": true,"tls":{"termination":"edge","insecureEdgeTerminationPolicy":"Redirect"}}}}}' --type=merge +``` + +* Get the Webhook URL of your OpenShift Gitops installation + +```sh +oc get route -n openshift-gitops openshift-gitops-server -o jsonpath='https://{.spec.host}/api/webhook' +``` + +* Add a webhook to your GitHub/GitLab repo + + * Payload URL: *url above* + * Content-Type: Application/json + +* Create the required namespaces. + +```sh +oc new-project fruits-dev +``` + +* Label the `fruits-dev` namespace with argocd annotations + +```sh +oc label namespace fruits-dev argocd.argoproj.io/managed-by=openshift-gitops +``` + +* Give admin access rights on the **fruits-dev** namespace to the **OpenShift Gitops** operator. + +```sh +oc adm policy add-role-to-user admin -n fruits-dev system:serviceaccount:openshift-gitops:openshift-gitops-argocd-application-controller +``` ## Deploy Postgres CrunchyDB diff --git a/infrastructure.yaml.sample b/infrastructure.yaml.sample new file mode 100644 index 0000000..629f439 --- /dev/null +++ b/infrastructure.yaml.sample @@ -0,0 +1,33 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: mad-roadshow-france-2023 + namespace: openshift-gitops +spec: + destination: + name: '' + server: 'https://kubernetes.default.svc' + source: + path: infrastructure + repoURL: 'https://github.com/MAD-Roadshow-France-2023/gitops.git' + targetRevision: main + helm: + parameters: + - name: masterKey + value: my-secret-value + - name: openshift-dns-zone + value: apps.ocp.tld + project: default + syncPolicy: + automated: + prune: true + selfHeal: false + ignoreDifferences: + - jqPathExpressions: + - .spec.template.spec.containers[].image + group: apps.openshift.io + kind: DeploymentConfig + - jqPathExpressions: + - .spec.tags[].generation + group: image.openshift.io + kind: ImageStream diff --git a/infrastructure/Chart.yaml b/infrastructure/Chart.yaml new file mode 100644 index 0000000..04b7984 --- /dev/null +++ b/infrastructure/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: infrastructure +type: application +version: 0.0.1 +appVersion: "0.0.1" \ No newline at end of file diff --git a/infrastructure/templates/_helpers.tpl b/infrastructure/templates/_helpers.tpl new file mode 100644 index 0000000..abe3ba6 --- /dev/null +++ b/infrastructure/templates/_helpers.tpl @@ -0,0 +1,5 @@ +{{/* vim: set filetype=mustache: */}} + +{{- define "acs-admin-password" -}} +{{- trunc 16 (sha256sum (cat .Values.masterKey "acs-admin-password")) -}} +{{- end -}}