-
Notifications
You must be signed in to change notification settings - Fork 0
/
script-test.sh
138 lines (126 loc) · 3.1 KB
/
script-test.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
# causes the shell to exit if any invoked command exits with a non-zero status
set -e
echo "Applying Ingress resource..."
kubectl label ingress argocd-server -n argocd nimble.opti.adapter/enabled=true
cat <<EOF | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: argocd-server
namespace: argocd
labels:
nimble.opti.adapter/enabled: "true"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
acme.cert-manager.io/http01-edit-in-place: 'true'
kubernetes.io/tls-acme: 'true'
spec:
ingressClassName: nginx
tls:
- hosts:
- argo.127.0.0.1.nip.io
secretName: letsencrypt-argo-example
rules:
- host: argo.127.0.0.1.nip.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
number: 443
EOF
cat <<EOF | kubectl apply -f -
kind: Service
apiVersion: v1
metadata:
name: svc-externalname-dashboard
namespace: default
spec:
type: ExternalName
externalName: kubernetes-dashboard.kubernetes-dashboard.svc.cluster.local
EOF
cat <<EOF | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
namespace: default
labels:
nimble.opti.adapter/enabled: "true"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
acme.cert-manager.io/http01-edit-in-place: 'true' # allows the cert-manager to edit the Ingress resource in place to solve the challenge, rather than creating additional resources.
spec:
ingressClassName: nginx
tls:
- hosts:
- ex.tech-ua.com
secretName: letsencrypt-example
rules:
- host: ex.tech-ua.com
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: svc-externalname-dashboard
port:
number: 80
EOF
echo "Ingress resource applied successfully."
echo "Applying NimbleOpti resource..."
cat <<EOF | kubectl apply -f -
apiVersion: adapter.uri-tech.github.io/v1
kind: NimbleOpti
metadata:
name: default
namespace: default
spec:
certificateRenewalThreshold: 30
annotationRemovalDelay: 10
EOF
echo "NimbleOpti resource applied successfully."
cat <<EOF | kubectl apply -f -
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: uri.al.1500@gmail.com
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- dns01:
clouddns:
project: your-gcp-project-id
serviceAccountSecretRef:
name: clouddns-dns01-solver-svc-acct
key: key.json
EOF
cat <<EOF | kubectl apply -f -
kind: Service
apiVersion: v1
metadata:
name: metrics-svc
namespace: nimble-opti-adapter-system
labels:
annotations:
spec:
ports:
- name: https
protocol: TCP
port: 8080
targetPort: 8080
selector:
control-plane: controller-manager
type: ClusterIP
EOF