2023-02-02 11:01:05 -08:00
|
|
|
{{ if eq .ENVIRONMENT "production" }}
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: {{ .NAME }}
|
|
|
|
namespace: {{ .NAMESPACE }}
|
|
|
|
labels:
|
|
|
|
app: {{ .NAME }}
|
|
|
|
spec:
|
|
|
|
type: NodePort
|
|
|
|
selector:
|
|
|
|
app: {{ .NAME }}
|
|
|
|
ports:
|
2023-02-02 12:31:41 -08:00
|
|
|
- port: 80
|
2023-02-02 11:01:05 -08:00
|
|
|
targetPort: {{ .PORT }}
|
|
|
|
name: {{ .NAME }}
|
|
|
|
protocol: TCP
|
|
|
|
{{ else }}
|
2022-12-14 12:07:55 -08:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: {{ .NAME }}
|
|
|
|
namespace: {{ .NAMESPACE }}
|
|
|
|
annotations:
|
|
|
|
external-dns.alpha.kubernetes.io/hostname: {{ .HOSTNAME }}
|
|
|
|
labels:
|
|
|
|
app: {{ .NAME }}
|
|
|
|
spec:
|
|
|
|
type: LoadBalancer
|
|
|
|
selector:
|
|
|
|
app: {{ .NAME }}
|
|
|
|
ports:
|
2023-02-02 12:31:41 -08:00
|
|
|
- port: 80
|
2022-12-14 12:07:55 -08:00
|
|
|
targetPort: {{ .PORT }}
|
|
|
|
name: {{ .NAME }}
|
|
|
|
protocol: TCP
|
2023-02-02 11:01:05 -08:00
|
|
|
{{ end }}
|
2022-12-14 12:07:55 -08:00
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: {{ .NAME }}
|
|
|
|
namespace: {{ .NAMESPACE }}
|
|
|
|
spec:
|
|
|
|
replicas: {{ .REPLICAS }}
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: {{ .NAME }}
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: {{ .NAME }}
|
|
|
|
spec:
|
|
|
|
restartPolicy: Always
|
|
|
|
terminationGracePeriodSeconds: 40
|
|
|
|
containers:
|
|
|
|
- name: {{ .NAME }}
|
|
|
|
image: {{ .IMAGE_NAME }}
|
|
|
|
readinessProbe:
|
|
|
|
initialDelaySeconds: 30
|
|
|
|
periodSeconds: 20
|
|
|
|
timeoutSeconds: 3
|
|
|
|
failureThreshold: 3
|
|
|
|
httpGet:
|
|
|
|
path: /api/ready
|
|
|
|
port: 8000
|
|
|
|
livenessProbe:
|
|
|
|
initialDelaySeconds: 30
|
|
|
|
periodSeconds: 30
|
|
|
|
timeoutSeconds: 3
|
|
|
|
failureThreshold: 3
|
|
|
|
httpGet:
|
|
|
|
path: /api/health
|
|
|
|
port: 8000
|
|
|
|
env:
|
|
|
|
- name: MONGODB_URI
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: mongodb
|
|
|
|
key: mongo-uri
|
|
|
|
- name: MONGODB_DATABASE
|
2023-01-05 11:40:24 -08:00
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: config
|
|
|
|
key: mongo-database
|
2022-12-14 12:07:55 -08:00
|
|
|
- name: GRPC_ADDRESS
|
|
|
|
value: {{ .GRPC_ADDRESS }}
|
|
|
|
- name: PORT
|
|
|
|
value: "8000"
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
memory: {{ .RESOURCES_LIMITS_MEMORY }}
|
|
|
|
cpu: {{ .RESOURCES_LIMITS_CPU }}
|
|
|
|
requests:
|
|
|
|
memory: {{ .RESOURCES_REQUESTS_MEMORY }}
|
2023-02-02 11:01:05 -08:00
|
|
|
cpu: {{ .RESOURCES_REQUESTS_CPU }}
|