forked from nre-learning/antidote-selfmedicate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyringe.yml
190 lines (180 loc) · 3.87 KB
/
syringe.yml
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: syringesa
---
apiVersion: v1
kind: ConfigMap
metadata:
name: git-clone
data:
git-clone.sh: |
#!/bin/sh -e
REPO=$1
REF=$2
DIR=$3
# Init Containers will re-run on Pod restart. Remove the directory's contents
# and reprovision when this happens.
if [ -d "$DIR" ]; then
rm -rf $( find $DIR -mindepth 1 )
fi
git clone $REPO $DIR
cd $DIR
git reset --hard $REF
---
# TODO(mierdin): This could probably use some pruning
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: syringerole
# rules:
# - apiGroups:
# - ""
# - "extensions"
# - "customresourcedefinitions"
# resources:
# - pods
# - services
# - networks
# - namespaces
# - customresourcedefinitions
# verbs:
# - create
# - list
# - get
# - delete
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: syringe-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: syringerole
subjects:
- kind: ServiceAccount
name: syringesa
namespace: default
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: syringe
spec:
replicas: 1
revisionHistoryLimit: 3
template:
metadata:
name: syringe
annotations:
foobar: ""
labels:
app: syringe
antidote_role: infra
spec:
initContainers:
- name: git-clone
image: alpine/git # Any image with git will do
command:
- /usr/local/git/git-clone.sh
args:
- "https://github.com/nre-learning/antidote.git"
- "master"
- "/antidote"
volumeMounts:
- name: git-clone
mountPath: /usr/local/git
- name: git-volume #?
mountPath: /antidote
# Might need an admission controller for this
serviceAccount: syringesa
containers:
- name: syringe
image: antidotelabs/syringe:latest
imagePullPolicy: Always
env:
- name: SYRINGE_LESSONS
value: "/antidote/lessons"
- name: SYRINGE_IGNORE_DISABLED
value: "true"
- name: SYRINGE_TIER
value: "local"
ports:
- containerPort: 50099 # GRPC
- containerPort: 8086 # REST/HTTP
readinessProbe:
httpGet:
path: /
port: 8086
volumeMounts:
- mountPath: /antidote
name: git-volume
volumes:
- name: git-volume
emptyDir: {}
- name: git-clone
configMap:
name: git-clone
defaultMode: 0755
# /var/run/secrets/kubernetes.io/serviceaccount
# kubectl create serviceaccount syringesa
# kubectl describe serviceaccount syringesa
# kubectl get secret syringesa-token-hjdjv -oyaml
---
kind: Service
apiVersion: v1
metadata:
name: syringe
namespace: default
spec:
selector:
app: syringe
ports:
- name: grpc
port: 50099
targetPort: 50099
# nodePort: 30010
- name: http
port: 8086
targetPort: 8086
type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/ssl-services: "syringe"
ingress.kubernetes.io/ssl-redirect: "false"
ingress.kubernetes.io/force-ssl-redirect: "false"
ingress.kubernetes.io/rewrite-target: "/"
nginx.ingress.kubernetes.io/rewrite-target: "/"
# ingress.kubernetes.io/limit-connections
# ingress.kubernetes.io/limit-rps
name: syringe-ingress
namespace: default
spec:
tls:
- hosts:
- antidote-local
rules:
- host: "antidote-local"
http:
paths:
- path: "/syringe"
backend:
serviceName: syringe
servicePort: 8086