forked from estafette/estafette-gke-preemptible-killer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubernetes.yaml
97 lines (97 loc) · 2.26 KB
/
kubernetes.yaml
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
apiVersion: v1
kind: Namespace
metadata:
name: ${NAMESPACE}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: ${APP_NAME}
namespace: ${NAMESPACE}
labels:
app: ${APP_NAME}
team: ${TEAM_NAME}
---
apiVersion: v1
kind: Secret
metadata:
name: ${APP_NAME}-secrets
namespace: ${NAMESPACE}
labels:
app: ${APP_NAME}
team: ${TEAM_NAME}
type: Opaque
data:
google-service-account.json: ${GOOGLE_SERVICE_ACCOUNT}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ${APP_NAME}
namespace: ${NAMESPACE}
labels:
app: ${APP_NAME}
team: ${TEAM_NAME}
spec:
replicas: 1
strategy:
type: Recreate
revisionHistoryLimit: 10
selector:
matchLabels:
app: ${APP_NAME}
template:
metadata:
labels:
app: ${APP_NAME}
team: ${TEAM_NAME}
version: ${VERSION}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9001"
spec:
serviceAccount: ${APP_NAME}
terminationGracePeriodSeconds: 300
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 10
preference:
matchExpressions:
- key: cloud.google.com/gke-preemptible
operator: In
values:
- "true"
containers:
- name: ${APP_NAME}
image: estafette/estafette-gke-preemptible-killer:${GO_PIPELINE_LABEL}
ports:
- name: prom-metrics
containerPort: 9001
env:
- name: DRAIN_TIMEOUT
value: "${DRAIN_TIMEOUT}"
- name: INTERVAL
value: "${INTERVAL}"
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/app-secrets/google-service-account.json
resources:
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
livenessProbe:
httpGet:
path: /metrics
port: prom-metrics
initialDelaySeconds: 30
timeoutSeconds: 1
volumeMounts:
- name: app-secrets
mountPath: /etc/app-secrets
volumes:
- name: app-secrets
secret:
secretName: ${APP_NAME}-secrets