Add API deployment, service, and db-credentials secret templates
This commit is contained in:
@@ -0,0 +1,70 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "groombook.fullname" . }}-api
|
||||||
|
labels:
|
||||||
|
{{- include "groombook.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: api
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.api.replicas }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "groombook.selectorLabels" . | nindent 6 }}
|
||||||
|
app.kubernetes.io/component: api
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "groombook.selectorLabels" . | nindent 8 }}
|
||||||
|
app.kubernetes.io/component: api
|
||||||
|
spec:
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ include "groombook.serviceAccountName" . }}
|
||||||
|
containers:
|
||||||
|
- name: api
|
||||||
|
image: {{ include "groombook.apiImage" . }}
|
||||||
|
imagePullPolicy: {{ .Values.api.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- containerPort: 3000
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: PORT
|
||||||
|
value: {{ .Values.api.env.port | quote }}
|
||||||
|
- name: NODE_ENV
|
||||||
|
value: {{ .Values.api.env.nodeEnv | quote }}
|
||||||
|
- name: AUTH_DISABLED
|
||||||
|
value: {{ .Values.api.env.authDisabled | quote }}
|
||||||
|
{{- if .Values.api.env.corsOrigin }}
|
||||||
|
- name: CORS_ORIGIN
|
||||||
|
value: {{ .Values.api.env.corsOrigin | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.api.env.oidcIssuer }}
|
||||||
|
- name: OIDC_ISSUER
|
||||||
|
value: {{ .Values.api.env.oidcIssuer | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.api.env.oidcAudience }}
|
||||||
|
- name: OIDC_AUDIENCE
|
||||||
|
value: {{ .Values.api.env.oidcAudience | quote }}
|
||||||
|
{{- end }}
|
||||||
|
- name: DATABASE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "groombook.databaseSecretName" . }}
|
||||||
|
key: {{ include "groombook.databaseSecretKey" . }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.api.resources | nindent 12 }}
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 3000
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
periodSeconds: 10
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 3000
|
||||||
|
initialDelaySeconds: 15
|
||||||
|
periodSeconds: 30
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "groombook.fullname" . }}-api
|
||||||
|
labels:
|
||||||
|
{{- include "groombook.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: api
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.api.service.type }}
|
||||||
|
selector:
|
||||||
|
{{- include "groombook.selectorLabels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: api
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.api.service.port }}
|
||||||
|
targetPort: 3000
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{{- if eq .Values.postgresql.mode "integrated" }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "groombook.fullname" . }}-db-credentials
|
||||||
|
labels:
|
||||||
|
{{- include "groombook.labels" . | nindent 4 }}
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
database-url: {{ printf "postgres://%s:%s@%s-postgresql:5432/%s" .Values.postgresql.integrated.auth.username (default (randAlphaNum 16) .Values.postgresql.integrated.auth.password) (include "groombook.fullname" .) .Values.postgresql.integrated.auth.database | quote }}
|
||||||
|
{{- end }}
|
||||||
Reference in New Issue
Block a user