diff --git a/deploy/Chart/templates/database/configmaps.yaml b/deploy/Chart/templates/database/configmaps.yaml new file mode 100644 index 0000000000..6c902390ff --- /dev/null +++ b/deploy/Chart/templates/database/configmaps.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: database-secret + namespace: "{{ .Release.Namespace }}" + labels: + control-plane: database + app.kubernetes.io/name: database + app.kubernetes.io/part-of: radius +data: + POSTGRES_DB: ps_db + POSTGRES_USER: ps_user + POSTGRES_PASSWORD: SecurePassword \ No newline at end of file diff --git a/deploy/Chart/templates/database/service.yaml b/deploy/Chart/templates/database/service.yaml new file mode 100644 index 0000000000..c10a9818fd --- /dev/null +++ b/deploy/Chart/templates/database/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: database + namespace: "{{ .Release.Namespace }}" + labels: + app.kubernetes.io/name: database + app.kubernetes.io/part-of: radius +spec: + ports: + - port: 5432 + name: postgres + protocol: TCP + targetPort: 5432 + selector: + app.kubernetes.io/name: database \ No newline at end of file diff --git a/deploy/Chart/templates/database/serviceaccount.yaml b/deploy/Chart/templates/database/serviceaccount.yaml new file mode 100644 index 0000000000..617e26e0eb --- /dev/null +++ b/deploy/Chart/templates/database/serviceaccount.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: database + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: database + app.kubernetes.io/part-of: radius diff --git a/deploy/Chart/templates/database/statefulset.yaml b/deploy/Chart/templates/database/statefulset.yaml new file mode 100644 index 0000000000..33d32f2be6 --- /dev/null +++ b/deploy/Chart/templates/database/statefulset.yaml @@ -0,0 +1,52 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: database + namespace: "{{ .Release.Namespace }}" + labels: + control-plane: database + app.kubernetes.io/name: database + app.kubernetes.io/part-of: radius +spec: + serviceName: "database" + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: database + template: + metadata: + labels: + control-plane: database + app.kubernetes.io/name: database + app.kubernetes.io/part-of: radius + spec: + serviceAccountName: database + containers: + - name: database + securityContext: + allowPrivilegeEscalation: false + image: "{{ .Values.database.image }}:{{ .Values.database.tag }}" + imagePullPolicy: IfNotPresent + resources: + requests: + memory: "{{ .Values.database.resources.requests.memory }}" + cpu: "{{ .Values.database.resources.requests.cpu }}" + limits: + memory: "{{ .Values.database.resources.limits.memory }}" + cpu: "{{ .Values.database.resources.limits.cpu }}" + envFrom: + - configMapRef: + name: database-secret + ports: + - containerPort: 5432 + name: postgres + + volumeClaimTemplates: + - metadata: + name: database + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: "{{ .Values.database.storageClassName }}" + resources: + requests: + storage: {{ .Values.database.storageSize }} \ No newline at end of file diff --git a/deploy/Chart/values.yaml b/deploy/Chart/values.yaml index d750295570..8367ebf730 100644 --- a/deploy/Chart/values.yaml +++ b/deploy/Chart/values.yaml @@ -112,3 +112,16 @@ dashboard: memory: "60Mi" limits: memory: "300Mi" + +database: + image: ghcr.io/radius-project/mirror/postgres + tag: latest + storageClassName: "standard" # set to the storage class name if required + storageSize: "1Gi" + resources: + requests: + cpu: "2" + memory: "512Mi" + limits: + cpu: "2" + memory: "1024Mi" \ No newline at end of file diff --git a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-sqldb-manual.bicep b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-sqldb-manual.bicep index 1439c50243..746b539c81 100644 --- a/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-sqldb-manual.bicep +++ b/test/functional-portable/datastoresrp/noncloud/resources/testdata/datastoresrp-resources-sqldb-manual.bicep @@ -100,5 +100,21 @@ resource sqlContainer 'Applications.Core/containers@2023-10-01-preview' = { } } } + runtimes: { + kubernetes: { + pod: { + resources: { + requests: { + cpu: '1200m' + memory: '2048Mi' + } + limits: { + cpu: '1500m' + memory: '4096Mi' + } + } + } + } + } } }