Update cert-manager install/uninstall process

This commit is contained in:
Amarpreet Minhas 2022-08-05 13:42:50 -04:00
parent 6a593a6ac7
commit 618739bef7
4 changed files with 37 additions and 20 deletions

View file

@ -1,14 +1,4 @@
--- ---
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: serviceaccounttoken
namespace: cert-manager
annotations:
kubernetes.io/service-account.name: "cert-manager"
...
---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:

View file

@ -1,16 +1,15 @@
#!/bin/bash #!/bin/bash
CHART_VERSION=1.8.0 CHART_VERSION=1.9.1
NAMESPACE=cert-manager NAMESPACE=cert-manager
EMAIL=amarpreet@minhas.io EMAIL=amarpreet@minhas.io
./vault-role.sh kubectl create ns ${NAMESPACE}
#kubectl create serviceaccount -n ${NAMESPACE} cert-manager
helm repo add jetstack https://charts.jetstack.io helm repo add jetstack https://charts.jetstack.io
helm repo update helm repo update
kubectl create ns ${NAMESPACE}
kubectl create serviceaccount -n ${NAMESPACE} cert-manager
kubectl apply -n ${NAMESPACE} -f external-secrets.yaml kubectl apply -n ${NAMESPACE} -f external-secrets.yaml
helm upgrade --install \ helm upgrade --install \
@ -22,6 +21,9 @@ helm upgrade --install \
--set installCRDs=true \ --set installCRDs=true \
--cleanup-on-fail --cleanup-on-fail
kubectl apply -n ${NAMESPACE} -f serviceaccounttoken.yaml
./vault-role.sh
helm upgrade -install \ helm upgrade -install \
cert-manager-csi-driver \ cert-manager-csi-driver \
jetstack/cert-manager-csi-driver \ jetstack/cert-manager-csi-driver \
@ -48,4 +50,6 @@ helm upgrade --install \
--cleanup-on-fail --cleanup-on-fail
popd popd
rm -rf cert-manager-webhook-namecheap
kubectl apply -f issuers.yaml kubectl apply -f issuers.yaml

View file

@ -0,0 +1,10 @@
---
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: serviceaccounttoken
namespace: cert-manager
annotations:
kubernetes.io/service-account.name: "cert-manager"
...

View file

@ -1,9 +1,22 @@
#!/bin/bash #!/bin/bash
CHART_VERSION=1.8.0 CHART_VERSION=1.9.1
kubectl delete -f vault-issuer.yaml kubectl delete -f issuers.yaml
kubectl get Issuers,ClusterIssuers,Certificates,CertificateRequests,Orders,Challenges --all-namespaces for i in $(kubectl get Issuers -n cert-manager | grep -v NAME | cut -d' ' -f1); do
#helm -n cert-manager delete cert-manager kubectl delete Issuers -n cert-manager $i
#kubectl delete ns cert-manager done
#kubectl delete -f https://github.com/jetstack/cert-manager/releases/download/v${CHART_VERSION}/cert-manager.crds.yaml for i in $(kubectl get ClusterIssuers | grep -v NAME | cut -d' ' -f1); do
kubectl delete ClusterIssuers $i
done
for i in $(kubectl get Certificates -n cert-manager | grep -v NAME | cut -d' ' -f1); do
kubectl delete Certificates -n cert-manager $i
done
helm -n cert-manager delete namecheap-webhook
helm -n cert-manager delete letsencrypt-namecheap-issuer
helm -n cert-manager delete cert-manager
kubectl delete -n ${NAMESPACE} -f external-secrets.yaml
kubectl delete -n ${NAMESPACE} -f serviceaccounttoken.yaml
kubectl delete ns cert-manager