|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# |
| 4 | +# Welcome to the SingleNamespace install mode demo |
| 5 | +# |
| 6 | +trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT |
| 7 | + |
| 8 | +# enable 'SingleOwnNamespaceInstallSupport' feature gate |
| 9 | +kubectl patch deployment -n olmv1-system operator-controller-controller-manager --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--feature-gates=SingleOwnNamespaceInstallSupport=true"}]' |
| 10 | + |
| 11 | +# wait for operator-controller to become available |
| 12 | +kubectl rollout status -n olmv1-system deployment/operator-controller-controller-manager |
| 13 | + |
| 14 | +# create install namespace |
| 15 | +kubectl create ns argocd-system |
| 16 | + |
| 17 | +# create installer service account |
| 18 | +kubectl create serviceaccount -n argocd-system argocd-installer |
| 19 | + |
| 20 | +# give installer service account admin privileges (not for production environments) |
| 21 | +kubectl create clusterrolebinding argocd-installer-crb --clusterrole=cluster-admin --serviceaccount=argocd-system:argocd-installer |
| 22 | + |
| 23 | +# create watch namespace |
| 24 | +kubectl create namespace argocd |
| 25 | + |
| 26 | +# install cluster extension in single namespace install mode (watch namespace != install namespace) |
| 27 | +cat ${DEMO_RESOURCE_DIR}/single-namespace-demo.yaml |
| 28 | + |
| 29 | +# apply cluster extension |
| 30 | +kubectl apply -f ${DEMO_RESOURCE_DIR}/single-namespace-demo.yaml |
| 31 | + |
| 32 | +# wait for cluster extension installation to succeed |
| 33 | +kubectl wait --for=condition=Installed clusterextension/argocd-operator --timeout="60s" |
| 34 | + |
| 35 | +# check argocd-operator controller deployment pod template olm.targetNamespaces annotation |
| 36 | +kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.metadata.annotations.olm\.targetNamespaces}" |
| 37 | + |
| 38 | +# check for argocd-operator rbac in watch namespace |
| 39 | +kubectl get roles,rolebindings -n argocd -o name |
| 40 | + |
| 41 | +# get controller service-account name |
| 42 | +kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.spec.serviceAccount}" |
| 43 | + |
| 44 | +# check service account for role binding is the controller deployment service account |
| 45 | +rolebinding=$(kubectl get rolebindings -n argocd -o name | grep 'argocd-operator' | head -n 1) |
| 46 | +kubectl get -n argocd $rolebinding -o jsonpath='{.subjects}' | jq .[0] |
0 commit comments