Skip to content

Commit 24d0e36

Browse files
author
Per Goncalves da Silva
committed
add feature demo
Signed-off-by: Per Goncalves da Silva <[email protected]> Signed-off-by: Per G. da Silva <[email protected]>
1 parent 8ef957c commit 24d0e36

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Welcome to the single- own namespace 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 and installer service account
15+
kubectl create ns argocd-system
16+
kubectl create serviceaccount -n argocd-system argocd-installer
17+
18+
# give installer service account admin privileges (not for production environments)
19+
kubectl create clusterrolebinding argocd-installer-crb --clusterrole=cluster-admin --serviceaccount=argocd-system:argocd-installer
20+
21+
# create watch namespace
22+
kubectl create namespace argocd
23+
24+
# install cluster extension in single namespace install mode
25+
cat <<EOF | kubectl apply -f -
26+
apiVersion: olm.operatorframework.io/v1
27+
kind: ClusterExtension
28+
metadata:
29+
name: argocd-operator
30+
annotations:
31+
olm.operatorframework.io/watch-namespace: argocd
32+
spec:
33+
namespace: argocd-system
34+
serviceAccount:
35+
name: argocd-installer
36+
source:
37+
sourceType: Catalog
38+
catalog:
39+
packageName: argocd-operator
40+
version: 0.6.0
41+
EOF
42+
43+
# wait for cluster extension installation to succeed
44+
kubectl wait --for=condition=Installed clusterextension/argocd-operator --timeout="60s"
45+
46+
# check argocd-operator controller deployment pod template olm.targetNamespaces annotation
47+
kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.metadata.annotations.olm\.targetNamespaces}"
48+
49+
sleep 3
50+
51+
# check for argocd-operator rbac in watch namespace
52+
kubectl get roles,rolebindings -n argocd -o name
53+
54+
sleep 3
55+
56+
# check service account for role binding
57+
rolebinding=$(kubectl get rolebindings -n argocd -o name | grep 'argocd-operator' | head -n 1)
58+
kubectl get -n argocd $rolebinding -o jsonpath='{.subjects}' | jq .[0]
59+
60+
# done in 3...2...1...
61+
sleep 3

0 commit comments

Comments
 (0)