diff --git a/Dockerfile b/Dockerfile index 2f7e480..fda8f56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -ARG PYTHON_VERSION=3.10-slim-bullseye +ARG PYTHON_VERSION=3.10-slim-bookworm -FROM node:18-bullseye-slim as client-builder +FROM node:18-bookworm-slim as client-builder ARG APP_HOME=/app WORKDIR ${APP_HOME} diff --git a/deploy/charts/mycarehub-backend/templates/deployment.yaml b/deploy/charts/mycarehub-backend/templates/deployment.yaml index cea9226..665fd40 100644 --- a/deploy/charts/mycarehub-backend/templates/deployment.yaml +++ b/deploy/charts/mycarehub-backend/templates/deployment.yaml @@ -37,7 +37,12 @@ spec: containerPort: {{ .Values.service.port }} protocol: TCP resources: - {{- toYaml .Values.resources | nindent 12 }} + limits: + cpu: {{ .Values.app.resources.limits.cpu }} + memory: {{ .Values.app.resources.limits.memory }} + requests: + cpu: {{ .Values.app.resources.requests.cpu }} + memory: {{ .Values.app.resources.requests.memory }} env: - name: GOOGLE_CLOUD_PROJECT diff --git a/deploy/charts/mycarehub-backend/templates/hpa.yaml b/deploy/charts/mycarehub-backend/templates/hpa.yaml new file mode 100644 index 0000000..06f24a1 --- /dev/null +++ b/deploy/charts/mycarehub-backend/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "mycarehub-backend.fullname" . }} + labels: + {{- include "mycarehub-backend.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "mycarehub-backend.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/deploy/charts/mycarehub-backend/values.yaml b/deploy/charts/mycarehub-backend/values.yaml index f53c7f7..62cfe02 100644 --- a/deploy/charts/mycarehub-backend/values.yaml +++ b/deploy/charts/mycarehub-backend/values.yaml @@ -5,15 +5,23 @@ replicaCount: 1 app: - replicaCount: 1 - container: - imagePullPolicy: "Always" - port: 8080 - env: - googleApplicationCredentialsSecret: - name: "mycarehub-backend-service-account" - filePath: "/secrets/gcp/key.json" - mountPath: "/secrets/gcp" + resources: + limits: + cpu: 700m + memory: 1024Mi + requests: + cpu: 500m + memory: 768Mi + + replicaCount: 1 + container: + imagePullPolicy: "Always" + port: 8080 + env: + googleApplicationCredentialsSecret: + name: "mycarehub-backend-service-account" + filePath: "/secrets/gcp/key.json" + mountPath: "/secrets/gcp" service: type: NodePort @@ -38,8 +46,8 @@ ingress: # - chart-example.local autoscaling: - enabled: false + enabled: true minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 + maxReplicas: 20 + targetCPUUtilizationPercentage: 90 + targetMemoryUtilizationPercentage: 90