diff --git a/apps/postgres/config/example.env b/apps/postgres/config/example.env deleted file mode 100644 index ab16d07..0000000 --- a/apps/postgres/config/example.env +++ /dev/null @@ -1,5 +0,0 @@ -POSTGRES_DB=postgres -POSTGRES_USER=postgres -POSTGRES_PASSWORD=OhPostgres! -POSTGRES_STORAGE=10Gi -POSTGRES_IMAGE=pgvector/pgvector:pg15 \ No newline at end of file diff --git a/apps/postgres/config/kustomization.yaml b/apps/postgres/config/kustomization.yaml deleted file mode 100644 index 7ffea94..0000000 --- a/apps/postgres/config/kustomization.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: postgres -labels: - - includeSelectors: true - pairs: - app: postgres - managedBy: kustomize - partOf: wild-cloud - -configMapGenerator: - - name: config - envs: - - config.env -secretGenerator: - - name: secrets - envs: - - secrets.env diff --git a/apps/postgres/deployment.yaml b/apps/postgres/deployment.yaml index ea530f9..96693e1 100644 --- a/apps/postgres/deployment.yaml +++ b/apps/postgres/deployment.yaml @@ -15,29 +15,36 @@ spec: spec: containers: - name: postgres - image: pgvector/pgvector:pg15 - args: [ - "-c", "tcp_keepalives_idle=600", - "-c", "tcp_keepalives_interval=30", - "-c", "tcp_keepalives_count=3", - "-c", "statement_timeout=300000", - "-c", "idle_in_transaction_session_timeout=600000" - ] + image: "{{ .config.apps.postgres.image }}" + args: + [ + "-c", + "tcp_keepalives_idle=600", + "-c", + "tcp_keepalives_interval=30", + "-c", + "tcp_keepalives_count=3", + "-c", + "statement_timeout=300000", + "-c", + "idle_in_transaction_session_timeout=600000", + ] ports: - containerPort: 5432 - envFrom: - - secretRef: - name: secrets - - configMapRef: - name: config env: - name: PGDATA value: /var/lib/postgresql/data/pgdata - name: TZ + value: "{{ .config.apps.postgres.timezone }}" + - name: POSTGRES_DB + value: "{{ .config.apps.postgres.database }}" + - name: POSTGRES_USER + value: "{{ .config.apps.postgres.user }}" + - name: POSTGRES_PASSWORD valueFrom: - configMapKeyRef: - name: config - key: TZ + secretKeyRef: + name: postgres-secrets + key: password volumeMounts: - name: postgres-data mountPath: /var/lib/postgresql/data diff --git a/apps/postgres/kustomization.yaml b/apps/postgres/kustomization.yaml index 51ce7d5..3a855a1 100644 --- a/apps/postgres/kustomization.yaml +++ b/apps/postgres/kustomization.yaml @@ -8,30 +8,7 @@ labels: managedBy: kustomize partOf: wild-cloud resources: - - config - deployment.yaml - namespace.yaml - service.yaml - pvc.yaml - -replacements: - - source: - kind: ConfigMap - name: config - fieldPath: data.POSTGRES_STORAGE - targets: - - fieldPaths: - - spec.resources.requests.storage - select: - kind: PersistentVolumeClaim - name: postgresql-pvc - - source: - kind: ConfigMap - name: config - fieldPath: data.POSTGRES_IMAGE - targets: - - fieldPaths: - - spec.template.spec.containers.0.image - select: - kind: Deployment - name: postgres-deployment diff --git a/apps/postgres/manifest.yaml b/apps/postgres/manifest.yaml index 43a340b..53d7113 100644 --- a/apps/postgres/manifest.yaml +++ b/apps/postgres/manifest.yaml @@ -3,3 +3,11 @@ install: true description: PostgreSQL is a powerful, open source object-relational database system. version: 1.0.0 icon: https://www.postgresql.org/media/img/about/press/elephant.png +defaultConfig: + database: postgres + user: postgres + storage: 10Gi + image: pgvector/pgvector:pg15 + timezone: UTC +requiredSecrets: + - apps.postgres.password diff --git a/apps/postgres/pvc.yaml b/apps/postgres/pvc.yaml index 8751928..b0051d4 100644 --- a/apps/postgres/pvc.yaml +++ b/apps/postgres/pvc.yaml @@ -9,4 +9,4 @@ spec: storageClassName: longhorn resources: requests: - storage: 2Gi + storage: {{ (ds "config").apps.postgres.storage | default "10Gi" }}