/
frontend-kube.yaml
86 lines (85 loc) · 2.94 KB
/
frontend-kube.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
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# kubectl create secret generic traintrack-creds --from-literal=mta-api-key=$MTA_API_KEY
# kubectl create secret generic mrjones-traintrack-service-account-key --from-file google-service-account-key.pem
# kubectl create secret generic traintrack-google-creds --from-literal=google-api-id=<xxx>.apps.googleusercontent.com --from-literal=google-api-secret=$GOOGLE_API_KEY
# kubectl apply -f kubernets.yaml
# kubectl expose deployment traintrack --type=LoadBalancer --port=80 --target-port=3837
apiVersion: apps/v1
kind: Deployment
metadata:
name: traintrack
spec:
replicas: 2
revisionHistoryLimit: 5
selector:
matchLabels:
run: traintrack
template:
metadata:
labels:
run: traintrack
spec:
containers:
- name: frontend
image: gcr.io/mrjones-gke/traintrack:2023-05-05.0
imagePullPolicy: IfNotPresent
env:
- name: GOOGLE_API_ID
valueFrom:
secretKeyRef:
name: traintrack-google-creds
key: google-api-id
- name: GOOGLE_API_SECRET
valueFrom:
secretKeyRef:
name: traintrack-google-creds
key: google-api-secret
- name: FIREBASE_API_KEY
valueFrom:
secretKeyRef:
name: traintrack-firebase-creds
key: firebase-api-key
args: [
"--proxy-url", "http://$(TRAINTRACK_FEEDPROXY_SERVICE_SERVICE_HOST):$(TRAINTRACK_FEEDPROXY_SERVICE_SERVICE_PORT)",
"--google-api-id", "$(GOOGLE_API_ID)",
"--google-api-secret", "$(GOOGLE_API_SECRET)",
"--firebase-api-key", "$(FIREBASE_API_KEY)",
"--google-service-account-pem-file", "/mnt/mrjones-traintrack-service-account-key/google-service-account-key.pem",
]
livenessProbe:
httpGet:
path: /
port: 3837 # TODO(mrjones): get this from dockerfile?
periodSeconds: 60
volumeMounts:
- name: mrjones-traintrack-service-account-key
mountPath: "/mnt/mrjones-traintrack-service-account-key"
readOnly: true
volumes:
- name: mrjones-traintrack-service-account-key
secret:
secretName: mrjones-traintrack-service-account-key
---
apiVersion: v1
kind: Service
metadata:
name: traintrack
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 3837
selector:
run: traintrack