-
Notifications
You must be signed in to change notification settings - Fork 0
/
cert-manager-setup.sh
executable file
·60 lines (48 loc) · 1.18 KB
/
cert-manager-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
source ./env.sh
setupCertManager() {
local context=${1}
values_cluster="${context/kind/values}"
helm upgrade \
cert-manager ./charts/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.16.1 \
--values=./charts/cert-manager/"${values_cluster}".yaml \
--install \
--wait \
--kube-context=${context}
}
createIssuer() {
local context=${1}
local clustername=${2}
kubectl apply --context="${context}" -f - <<EOF
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: istio-ca
namespace: istio-system
spec:
vault:
server: http://host.docker.internal:8200
path: pki_int_${clustername}/sign/istio-ca-${clustername}
auth:
kubernetes:
mountPath: /v1/auth/${context}
role: issuer
secretRef:
name: issuer-token-lmzpj
key: token
EOF
}
main () {
helm repo add jetstack https://charts.jetstack.io
setupCertManager ${CTX_CLUSTER1}
setupCertManager ${CTX_CLUSTER2}
createIssuer ${CTX_CLUSTER1} istio-cluster1
createIssuer ${CTX_CLUSTER2} istio-cluster2
}
main