Skip to content

Commit a5be672

Browse files
Make the down.sh script exclude cleaning up CRDs by default
1 parent e6288c3 commit a5be672

File tree

4 files changed

+87
-3
lines changed

4 files changed

+87
-3
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
122122
cd config/default && $(KUSTOMIZE) edit set namespace ${NAMESPACE}
123123
$(KUSTOMIZE) build config/default | kubectl delete -f -
124124

125+
.PHONY: undeploy-keep-crd
126+
undeploy-keep-crd: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Prevents down.sh from stomping on other CRD's in the same cluster.
127+
cd config/default-keep-crd && $(KUSTOMIZE) edit set namespace ${NAMESPACE}
128+
$(KUSTOMIZE) build config/default-keep-crd | kubectl delete -f -
129+
125130
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
126131
ARCH := $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
127132

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This patch inject a sidecar container which is a HTTP proxy for the
2+
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
name: controller-manager
7+
namespace: system
8+
spec:
9+
template:
10+
spec:
11+
affinity:
12+
nodeAffinity:
13+
requiredDuringSchedulingIgnoredDuringExecution:
14+
nodeSelectorTerms:
15+
- matchExpressions:
16+
- key: kubernetes.io/arch
17+
operator: In
18+
values:
19+
- amd64
20+
- arm64
21+
- ppc64le
22+
- s390x
23+
- key: kubernetes.io/os
24+
operator: In
25+
values:
26+
- linux
27+
serviceAccountName: controller-manager
28+
automountServiceAccountToken: true
29+
containers:
30+
- name: kube-rbac-proxy
31+
securityContext:
32+
allowPrivilegeEscalation: false
33+
capabilities:
34+
drop:
35+
- "ALL"
36+
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0
37+
args:
38+
- "--secure-listen-address=0.0.0.0:8443"
39+
- "--upstream=http://127.0.0.1:8080/"
40+
- "--logtostderr=true"
41+
- "--v=0"
42+
ports:
43+
- containerPort: 8443
44+
protocol: TCP
45+
name: https
46+
resources:
47+
limits:
48+
cpu: 500m
49+
memory: 128Mi
50+
requests:
51+
cpu: 5m
52+
memory: 64Mi
53+
- name: eda-manager
54+
args:
55+
- "--health-probe-bind-address=:6789"
56+
- "--metrics-bind-address=127.0.0.1:8080"
57+
- "--leader-elect"
58+
- "--leader-election-id=eda-server-operator"
59+
resources:
60+
limits:
61+
cpu: 500m
62+
memory: 1500Mi
63+
requests:
64+
cpu: 5m
65+
memory: 64Mi

dev/eda-cr/eda-openshift-cr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
value: "Always"
3535

3636
# CA Bundle
37-
bundle_cacert_secret: my-custom-certs
37+
# bundle_cacert_secret: my-custom-certs
3838

3939
# -- Resource Requirements
4040
api:

down.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,23 @@ kubectl delete edarestore --all
2121
# Delete old operator deployment
2222
kubectl delete deployment eda-server-operator-controller-manager
2323

24+
# Parse command line arguments
25+
ALL_FLAG=false
26+
for arg in "$@"; do
27+
case $arg in
28+
--all)
29+
ALL_FLAG=true
30+
shift
31+
;;
32+
esac
33+
done
34+
2435
# Deploy Operator
25-
make undeploy IMG=$IMG NAMESPACE=$NAMESPACE
36+
if [ "$ALL_FLAG" = true ]; then
37+
make undeploy IMG=$IMG NAMESPACE=$NAMESPACE
38+
else
39+
make undeploy-keep-crd IMG=$IMG NAMESPACE=$NAMESPACE
40+
fi
2641

2742
# Remove PVCs
2843
kubectl delete pvc postgres-15-$EDA_CR-postgres-15-0
29-

0 commit comments

Comments
 (0)