blob: ec3a47dfb62ecb746a7882d390b960e0e0efb697 [file] [log] [blame]
apiVersion: v1
kind: Service
metadata:
labels:
app: gold-{{.INSTANCE_ID}}-baselineserver
name: gold-{{.INSTANCE_ID}}-baselineserver
spec:
ports:
- name: http
port: 8000
- name: metrics
port: 20000
selector:
app: gold-{{.INSTANCE_ID}}-baselineserver
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gold-{{.INSTANCE_ID}}-baselineserver
spec:
replicas: 3
selector:
matchLabels:
app: gold-{{.INSTANCE_ID}}-baselineserver
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: gold-{{.INSTANCE_ID}}-baselineserver
appgroup: gold-{{.INSTANCE_ID}}
date: "{{.NOW}}" # Forces a re-deploy even if just the config file changes.
annotations:
prometheus.io.scrape: "true"
prometheus.io.port: "20000"
spec:
affinity:
nodeAffinity: # Schedule these pods to a specific set of nodes.
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
# The following label/key will be available in 1.17
# "node.kubernetes.io/instance-type": "n1-standard-16"
- matchExpressions:
- key: "{{.K8S_NODE_SELECTOR_KEY}}"
operator: In
values: # Either of these two values are fine.
- "{{.K8S_NODE_SELECTOR_VALUE1}}"
- "{{.K8S_NODE_SELECTOR_VALUE2}}"
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- gold-{{.INSTANCE_ID}}-baselineserver
topologyKey: "kubernetes.io/hostname"
automountServiceAccountToken: false
securityContext:
runAsUser: 2000 # aka skia
fsGroup: 2000 # aka skia
containers:
- name: gold-{{.INSTANCE_ID}}-baselineserver
image: {{.BASELINE_SERVER_IMAGE}}
args:
- "--common_instance_config=/etc/gold-config/{{.INSTANCE_ID}}.json5"
- "--config=/etc/gold-config/{{.INSTANCE_ID}}-baselineserver.json5"
- "--logtostderr"
ports:
- containerPort: 8000
name: http
- containerPort: 20000
name: prom
volumeMounts:
- name: gold-{{.INSTANCE_ID}}-config-volume
mountPath: /etc/gold-config/
- name: gold-service-account-secrets
mountPath: /etc/gold-secrets/
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/gold-secrets/service-account.json
resources:
requests:
memory: "500Mi"
cpu: "500m"
readinessProbe:
httpGet:
path: /healthz
port: 8000
initialDelaySeconds: 5
periodSeconds: 3
volumes:
- name: gold-{{.INSTANCE_ID}}-config-volume
configMap:
defaultMode: 400
name: gold-{{.INSTANCE_ID}}-config
- name: gold-service-account-secrets
secret:
secretName: gold-service-account-secrets