diff --git a/argocd-apps/my-recipes.yaml b/argocd-apps/my-recipes.yaml new file mode 100644 index 0000000..120e053 --- /dev/null +++ b/argocd-apps/my-recipes.yaml @@ -0,0 +1,21 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: my-recipes + namespace: argocd +spec: + project: my-apps + source: + repoURL: https://git.dvirlabs.com/dvirlabs/my-apps.git + targetRevision: HEAD + path: charts/my-recipes-chart + helm: + valueFiles: + - ../../manifests/my-recipes/values.yaml + destination: + server: https://kubernetes.default.svc + namespace: my-apps + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/charts/my-recipes-chart/Chart.yaml b/charts/my-recipes-chart/Chart.yaml new file mode 100644 index 0000000..022edee --- /dev/null +++ b/charts/my-recipes-chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: recipes-db +description: PostgreSQL (StatefulSet) for Recipes backend +type: application +version: 0.1.0 +appVersion: "16" diff --git a/charts/my-recipes-chart/templates/service.yaml b/charts/my-recipes-chart/templates/service.yaml new file mode 100644 index 0000000..1509ee1 --- /dev/null +++ b/charts/my-recipes-chart/templates/service.yaml @@ -0,0 +1,11 @@ +service.yamlapiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-headless +spec: + clusterIP: None + selector: + app: {{ .Release.Name }} + ports: + - port: {{ .Values.service.port }} + targetPort: 5432 diff --git a/charts/my-recipes-chart/templates/statefulset.yaml b/charts/my-recipes-chart/templates/statefulset.yaml new file mode 100644 index 0000000..7622449 --- /dev/null +++ b/charts/my-recipes-chart/templates/statefulset.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-db +spec: + serviceName: {{ .Release.Name }}-headless + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }} + spec: + containers: + - name: postgres + image: {{ .Values.image }} + ports: + - containerPort: 5432 + env: + - name: POSTGRES_USER + value: {{ .Values.postgres.user | quote }} + - name: POSTGRES_PASSWORD + value: {{ .Values.postgres.password | quote }} + - name: POSTGRES_DB + value: {{ .Values.postgres.database | quote }} + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} + {{- if .Values.persistence.storageClass }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} diff --git a/charts/my-recipes-chart/values.yaml b/charts/my-recipes-chart/values.yaml new file mode 100644 index 0000000..db6626f --- /dev/null +++ b/charts/my-recipes-chart/values.yaml @@ -0,0 +1,15 @@ +image: postgres:16 + +postgres: + user: recipes_user + password: recipes_password # simple for POC + database: recipes_db + +service: + port: 5432 + +persistence: + enabled: true + accessMode: ReadWriteOnce + storageClass: "nfs-client" # or your default SC + size: 8Gi