Skip to content

Commit c13abce

Browse files
Per Goncalves da Silvaperdasilva
authored andcommitted
Add feature demo
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 9966e0a commit c13abce

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed

hack/demo/own-namespace-demo.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Welcome to the OwnNamespace 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+
# install cluster extension in own namespace install mode (watch-namespace == install namespace == argocd-system)
24+
cat ${DEMO_RESOURCE_DIR}/own-namespace-demo.yaml
25+
26+
# apply cluster extension
27+
kubectl apply -f ${DEMO_RESOURCE_DIR}/own-namespace-demo.yaml
28+
29+
# wait for cluster extension installation to succeed
30+
kubectl wait --for=condition=Installed clusterextension/argocd-operator --timeout="60s"
31+
32+
# check argocd-operator controller deployment pod template olm.targetNamespaces annotation
33+
kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.metadata.annotations.olm\.targetNamespaces}"
34+
35+
# check for argocd-operator rbac in watch namespace
36+
kubectl get roles,rolebindings -n argocd-system -o name
37+
38+
# get controller service-account name
39+
kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.spec.serviceAccount}"
40+
41+
# check service account for role binding is the same as controller service-account
42+
rolebinding=$(kubectl get rolebindings -n argocd-system -o name | grep 'argocd-operator' | head -n 1)
43+
kubectl get -n argocd-system $rolebinding -o jsonpath='{.subjects}' | jq .[0]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: olm.operatorframework.io/v1
2+
kind: ClusterExtension
3+
metadata:
4+
name: argocd-operator
5+
annotations:
6+
# watch namespace is the same as intall namespace
7+
olm.operatorframework.io/watch-namespace: argocd-system
8+
spec:
9+
namespace: argocd-system
10+
serviceAccount:
11+
name: argocd-installer
12+
source:
13+
sourceType: Catalog
14+
catalog:
15+
packageName: argocd-operator
16+
version: 0.6.0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: olm.operatorframework.io/v1
2+
kind: ClusterExtension
3+
metadata:
4+
name: argocd-operator
5+
annotations:
6+
# watch-namespace is different from install namespace
7+
olm.operatorframework.io/watch-namespace: argocd
8+
spec:
9+
namespace: argocd-system
10+
serviceAccount:
11+
name: argocd-installer
12+
source:
13+
sourceType: Catalog
14+
catalog:
15+
packageName: argocd-operator
16+
version: 0.6.0

hack/demo/single-own-namespace.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

Comments
 (0)