diff --git a/helm/postgresql/templates/deployment.yaml b/helm/postgresql/templates/deployment.yaml index 8e9b19f..1523c13 100644 --- a/helm/postgresql/templates/deployment.yaml +++ b/helm/postgresql/templates/deployment.yaml @@ -2,6 +2,8 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ .Release.Name }}-postgresql + labels: + app: {{ .Release.Name }}-postgresql spec: replicas: 1 selector: @@ -17,8 +19,18 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" env: - name: POSTGRES_USER - value: {{ .Values.postgresql.username }} + value: "{{ .Values.postgresql.username }}" - name: POSTGRES_PASSWORD - value: {{ .Values.postgresql.password }} + value: "{{ .Values.postgresql.password }}" - name: POSTGRES_DB - value: {{ .Values.postgresql.database }} + value: "{{ .Values.postgresql.database }}" + ports: + - containerPort: 5432 + name: postgresql + volumeMounts: + - name: postgresql-data + mountPath: /var/lib/postgresql/data + volumes: + - name: postgresql-data + persistentVolumeClaim: + claimName: {{ .Release.Name }}-postgresql-pvc diff --git a/helm/postgresql/templates/pvc.yaml b/helm/postgresql/templates/pvc.yaml new file mode 100644 index 0000000..e63c0e7 --- /dev/null +++ b/helm/postgresql/templates/pvc.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-postgresql + labels: + app.kubernetes.io/name: postgresql + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + accessModes: {{ toYaml .Values.persistence.accessModes | indent 2 }} + resources: + requests: + storage: {{ .Values.persistence.size }} + storageClassName: "" diff --git a/helm/postgresql/templates/service.yaml b/helm/postgresql/templates/service.yaml index 0b7e613..f8f3283 100644 --- a/helm/postgresql/templates/service.yaml +++ b/helm/postgresql/templates/service.yaml @@ -1,12 +1,11 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }}-postgresql-hl + name: {{ .Release.Name }}-postgresql labels: app.kubernetes.io/name: postgresql app.kubernetes.io/instance: {{ .Release.Name }} spec: - clusterIP: None ports: - name: postgresql port: 5432 diff --git a/helm/postgresql/templates/statefulset.yaml b/helm/postgresql/templates/statefulset.yaml deleted file mode 100644 index ee62418..0000000 --- a/helm/postgresql/templates/statefulset.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: {{ .Release.Name }}-postgresql - labels: - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: {{ .Release.Name }} -spec: - serviceName: {{ .Release.Name }}-postgresql-hl - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: {{ .Release.Name }} - template: - metadata: - labels: - app.kubernetes.io/name: postgresql - app.kubernetes.io/instance: {{ .Release.Name }} - spec: - containers: - - name: postgresql - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - containerPort: 5432 - name: postgresql - env: - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: {{ .Release.Name }}-postgresql - key: postgres-password - volumeMounts: - - name: data - mountPath: /var/lib/postgresql/data - securityContext: - fsGroup: 1001 - volumeClaimTemplates: - - metadata: - name: data - spec: - accessModes: {{ .Values.persistence.accessModes }} - resources: - requests: - storage: {{ .Values.persistence.size }} diff --git a/helm/postgresql/values.yaml b/helm/postgresql/values.yaml index 4a62552..31c0a9a 100644 --- a/helm/postgresql/values.yaml +++ b/helm/postgresql/values.yaml @@ -19,7 +19,3 @@ persistence: accessModes: - ReadWriteOnce -service: - type: ClusterIP - port: 5432 - headless: true