From f61eb6a79b0560b9a8daa875db3dae3c1febb8cc Mon Sep 17 00:00:00 2001 From: minhtrannhat Date: Wed, 15 Jan 2025 12:00:00 -0500 Subject: [PATCH] chore(helm): add API deployment and service templates --- .../incidentops/templates/api-deployment.yaml | 61 +++++++++++++++++++ helm/incidentops/templates/api-service.yaml | 17 ++++++ 2 files changed, 78 insertions(+) create mode 100644 helm/incidentops/templates/api-deployment.yaml create mode 100644 helm/incidentops/templates/api-service.yaml diff --git a/helm/incidentops/templates/api-deployment.yaml b/helm/incidentops/templates/api-deployment.yaml new file mode 100644 index 0000000..55c38a1 --- /dev/null +++ b/helm/incidentops/templates/api-deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "incidentops.fullname" . }}-api + labels: + {{- include "incidentops.labels" . | nindent 4 }} + app.kubernetes.io/component: api +spec: + replicas: {{ .Values.api.replicas }} + selector: + matchLabels: + {{- include "incidentops.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: api + template: + metadata: + labels: + {{- include "incidentops.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: api + spec: + containers: + - name: api + image: "{{ .Values.api.image }}:{{ .Values.api.tag }}" + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: {{ .Values.api.port }} + protocol: TCP + env: + - name: ConnectionStrings__Postgres + value: {{ include "incidentops.postgresConnectionString" . | quote }} + - name: Redis__ConnectionString + value: {{ include "incidentops.redisConnectionString" . | quote }} + - name: Jwt__Issuer + value: {{ .Values.jwt.issuer | quote }} + - name: Jwt__Audience + value: {{ .Values.jwt.audience | quote }} + - name: Jwt__SigningKey + valueFrom: + secretKeyRef: + name: {{ include "incidentops.fullname" . }}-secrets + key: jwt-signing-key + - name: Jwt__AccessTokenExpirationMinutes + value: {{ .Values.jwt.accessTokenExpirationMinutes | quote }} + - name: Jwt__RefreshTokenExpirationDays + value: {{ .Values.jwt.refreshTokenExpirationDays | quote }} + - name: Cors__Origins__0 + value: "http://{{ .Values.ingress.host }}" + livenessProbe: + httpGet: + path: /healthz + port: http + initialDelaySeconds: 10 + periodSeconds: 10 + readinessProbe: + httpGet: + path: /readyz + port: http + initialDelaySeconds: 5 + periodSeconds: 5 + resources: + {{- toYaml .Values.api.resources | nindent 12 }} diff --git a/helm/incidentops/templates/api-service.yaml b/helm/incidentops/templates/api-service.yaml new file mode 100644 index 0000000..a911559 --- /dev/null +++ b/helm/incidentops/templates/api-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "incidentops.fullname" . }}-api + labels: + {{- include "incidentops.labels" . | nindent 4 }} + app.kubernetes.io/component: api +spec: + type: ClusterIP + ports: + - port: {{ .Values.api.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "incidentops.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: api