Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixcontrollerdeleetebug #757

Merged
merged 1 commit into from
Jul 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions pkg/KubeArmorAnnotation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,31 @@ docker-push: ## Push docker image with the manager.

##@ Deployment

deploy-cert-manager: ## Deploy cert-manager before deploying the admission controller
deploy-cert-manager: ensure-cmctl ## Deploy cert-manager before deploying the admission controller
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml
kubectl wait pods --for=condition=ready -n cert-manager -l app.kubernetes.io/instance=cert-manager
@echo "Waiting for cert manager to inject CA bundle, this can take up to 5 minutes"
$(CMCTL) check api --wait 300s

CMCTL = /usr/local/bin/cmctl
ensure-cmctl:
$(call get-cmctl,$(CMCTL))

define get-cmctl
@[ -f $(1) ] || { \
OS=$$(go env GOOS) ;\
ARCH=$$(go env GOARCH) ;\
echo "Downloading cmctl" ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
curl -sSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/download/v1.7.2/cmctl-$$OS-$$ARCH.tar.gz ;\
echo "Installing ..." ;\
tar xzf cmctl.tar.gz ;\
sudo mv cmctl $(1) ;\
rm -rf $$TMP_DIR ;\
echo "cmctl is now under $(1)" ;\
}
endef

delete-cert-manager: ## Delete cert-manager when deleting the admission controller
kubectl delete -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml
Expand All @@ -92,8 +114,14 @@ deploy: manifests kustomize deploy-cert-manager ## Deploy controller to the K8s
sed 's/kubearmor-annotation-controller-manager/kubearmor-annotation-manager/g' | \
sed -e "1,7d" | kubectl apply -f -

delete: delete-cert-manager ## Delete controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete -f -
delete-annotation-controller: ## Delete controller from the K8s cluster specified in ~/.kube/config.
cd $(CURDIR); $(KUSTOMIZE) build config/default | \
sed 's/control-plane: controller-manager/kubearmor-app: kubearmor-annotation-manager/g' | \
sed 's/kubearmor-annotation-controller-manager/kubearmor-annotation-manager/g' | \
sed -e "1,7d" | kubectl delete -f -

delete: delete-annotation-controller delete-cert-manager ## Delete annotation controller and cert manager from the K8s cluster specified in ~/.kube/config.


deployment: manifests kustomize
cd config/manager; $(KUSTOMIZE) edit set image controller=${IMG}:latest
Expand Down