diff --git a/template-app/templates/deployment.yaml b/template-app/templates/deployment.yaml index 7c4fbb0..cd36530 100644 --- a/template-app/templates/deployment.yaml +++ b/template-app/templates/deployment.yaml @@ -4,23 +4,6 @@ metadata: name: {{ .Values.app.name }} labels: app: {{ .Values.app.name }} -resources: - requests: - cpu: {{ .Values.container.resources.requests.cpu }} - memory: {{ .Values.container.resources.requests.memory }} - {{ if .Values.container.resources.limits.enabled }} - limits: - cpu: {{ .Values.container.resources.limits.cpu }} - memory: {{ .Values.container.resources.limits.memory }} - {{ end }} -spec: - replicas: {{ .Values.container.replicas }} - selector: - matchLabels: - app: {{ .Values.app.name }} - template: - metadata: - annotations: rollme: {{ randAlphaNum 5 | quote }} labels: app: {{ .Values.app.name }} @@ -30,10 +13,21 @@ spec: image: {{ .Values.container.image }} ports: - containerPort: {{ .Values.container.port }} + {{ if .Values.container.env }} env: {{- range $env := .Values.container.env }} - name: {{ $env.name }} value: {{ $env.value }} {{- end}} + {{ end }} + resources: + requests: + cpu: {{ .Values.container.resources.requests.cpu }} + memory: {{ .Values.container.resources.requests.memory }} + {{ if .Values.container.resources.limits.enabled }} + limits: + cpu: {{ .Values.container.resources.limits.cpu }} + memory: {{ .Values.container.resources.limits.memory }} + {{ end }} imagePullSecrets: - name: docker-registry-cred diff --git a/template-postgres/templates/deployment.yaml b/template-postgres/templates/deployment.yaml index bfb2480..2fdadea 100644 --- a/template-postgres/templates/deployment.yaml +++ b/template-postgres/templates/deployment.yaml @@ -14,17 +14,24 @@ spec: labels: app: {{ .Values.database.name }} spec: + volumes: + - name: {{ .Values.database.name }}-storage + persistentVolumeClaim: + claimName: {{ .Values.database.name }}-pvc containers: - name: {{ .Values.database.name }} - image: bitnami/postgresql:latest + image: postgres ports: - containerPort: 5432 + - containerPort: 5432 volumeMounts: - - mountPath: /bitnami/postgresql + - mountPath: /data + name: {{ .Values.database.name }}-storage env: - - name: POSTGRESQL_USERNAME + - name: PGDATA + value: /data + - name: POSTGRES_USER value: {{ .Values.database.auth.user }} - - name: POSTGRESQL_PASSWORD + - name: POSTGRES_PASSWORD value: {{ .Values.database.auth.password }} - name: POSTGRESQL_DATABASE value: {{ .Values.database.createdDatabase }} diff --git a/template-postgres/templates/service.yaml b/template-postgres/templates/service.yaml new file mode 100644 index 0000000..cce4993 --- /dev/null +++ b/template-postgres/templates/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.database.name }} +spec: + selector: + app: {{ .Values.database.name }} + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 \ No newline at end of file diff --git a/template-postgres/values.yaml b/template-postgres/values.yaml index 33f2703..aa567c9 100644 --- a/template-postgres/values.yaml +++ b/template-postgres/values.yaml @@ -3,9 +3,8 @@ container: database: createdDatabase: postgres name: template-postgres - mountPath: /mnt/postgres/data + mountPath: /mnt/postgres/template size: 10Gi auth: user: postgres - password: super - \ No newline at end of file + password: super \ No newline at end of file