-
Notifications
You must be signed in to change notification settings - Fork 5
/
gke.yaml
86 lines (82 loc) · 2.07 KB
/
gke.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
# TODO sed replace SERVICE_NAME
apiVersion: apps/v1
kind: Deployment
metadata:
name: SERVICE_NAME
labels:
app: SERVICE_NAME
spec:
replicas: 3
selector:
matchLabels:
app: SERVICE_NAME
template:
metadata:
labels:
app: SERVICE_NAME
spec:
containers:
- name: SERVICE_NAME-app
# TODO sed replace PROJECT_ID
image: gcr.io/PROIECT_ID/SERVICE_NAME
imagePullPolicy: Always
env:
- name: USE_CLOUD_SQL_AUTH_PROXY
value: "true"
- name: DATABASE_NAME
valueFrom:
secretKeyRef:
name: cloudsql
key: database
- name: DATABASE_USER
valueFrom:
secretKeyRef:
name: cloudsql
key: username
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: cloudsql
key: password
ports:
- containerPort: 8080
- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.16
# TODO sed replace CLOUDSQL_CONNECTION_STRING
command: [
"/cloud_sql_proxy",
"--dir=/cloudsql",
"-instances=CLOUDSQL_CONNECTION_STRING=tcp:5432",
"-credential_file=/secrets/cloudsql/credentials.json"
]
volumeMounts:
- name: cloudsql-oauth-credentials
mountPath: /secrets/cloudsql
readOnly: true
- name: ssl-certs
mountPath: /etc/ssl/certs
- name: cloudsql
mountPath: /cloudsql
volumes:
- name: cloudsql-oauth-credentials
secret:
secretName: cloudsql-oauth-credentials
- name: ssl-certs
hostPath:
path: /etc/ssl/certs
- name: cloudsql
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: SERVICE_NAME
labels:
app: SERVICE_NAME
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8080
selector:
app: SERVICE_NAME