diff --git a/rnd/infra/helm/autogpt-server/templates/configmap.yaml b/rnd/infra/helm/autogpt-server/templates/configmap.yaml new file mode 100644 index 0000000000..f5b5eeae1b --- /dev/null +++ b/rnd/infra/helm/autogpt-server/templates/configmap.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "autogpt-server.fullname" . }}-config + labels: + {{- include "autogpt-server.labels" . | nindent 4 }} +data: + {{- range $key, $value := .Values.env }} + {{ $key }}: {{ $value | quote }} + {{- end }} \ No newline at end of file diff --git a/rnd/infra/helm/autogpt-server/templates/deployment.yaml b/rnd/infra/helm/autogpt-server/templates/deployment.yaml index 7cb0a3d5dc..8c337e5729 100644 --- a/rnd/infra/helm/autogpt-server/templates/deployment.yaml +++ b/rnd/infra/helm/autogpt-server/templates/deployment.yaml @@ -32,6 +32,9 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} + envFrom: + - configMapRef: + name: {{ include "autogpt-server.fullname" . }}-config securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -50,6 +53,15 @@ spec: volumeMounts: {{- toYaml . | nindent 12 }} {{- end }} + - name: cloud-sql-proxy + image: "{{ .Values.cloudSqlProxy.image.repository }}:{{ .Values.cloudSqlProxy.image.tag }}" + args: + - "--structured-logs" + {{- if .Values.cloudSqlProxy.usePrivateIp }} + - "--private-ip" + {{- end }} + - "--port={{ .Values.cloudSqlProxy.port }}" + - "{{ .Values.cloudSqlProxy.instanceConnectionName }}" {{- with .Values.volumes }} volumes: {{- toYaml . | nindent 8 }} diff --git a/rnd/infra/helm/autogpt-server/values.dev.yaml b/rnd/infra/helm/autogpt-server/values.dev.yaml index 8a7fbda2e2..1e81e78004 100644 --- a/rnd/infra/helm/autogpt-server/values.dev.yaml +++ b/rnd/infra/helm/autogpt-server/values.dev.yaml @@ -11,7 +11,7 @@ serviceAccount: name: "dev-agpt-server-sa" service: - type: ClusterIP + type: LoadBalancer port: 80 targetPort: 8000 @@ -37,4 +37,18 @@ resources: cpu: 500m memory: 512Mi -domain: "server.agpt.co" \ No newline at end of file +domain: "server.agpt.co" + +cloudSqlProxy: + image: + repository: gcr.io/cloud-sql-connectors/cloud-sql-proxy + tag: 2.11.4 + instanceConnectionName: "agpt-dev:us-central1:agpt-server-dev" + port: 5432 + resources: + requests: + memory: "2Gi" + cpu: "1" + +env: + APP_ENV: "dev" \ No newline at end of file diff --git a/rnd/infra/terraform/environments/dev.tfvars b/rnd/infra/terraform/environments/dev.tfvars index 8fbd6bb554..7113a50d58 100644 --- a/rnd/infra/terraform/environments/dev.tfvars +++ b/rnd/infra/terraform/environments/dev.tfvars @@ -36,5 +36,11 @@ role_bindings = { ], "roles/cloudsql.editor" = [ "serviceAccount:dev-agpt-server-sa@agpt-dev.iam.gserviceaccount.com" + ], + "roles/cloudsql.instanceUser" = [ + "serviceAccount:dev-agpt-server-sa@agpt-dev.iam.gserviceaccount.com" + ], + "roles/iam.workloadIdentityUser" = [ + "serviceAccount:dev-agpt-server-sa@agpt-dev.iam.gserviceaccount.com" ] }