# services/cassandra/postgres-statefulset.yaml apiVersion: apps/v1 kind: StatefulSet metadata: name: cassandra-postgres namespace: cassandra labels: app: cassandra-postgres spec: serviceName: cassandra-postgres replicas: 1 selector: matchLabels: app: cassandra-postgres persistentVolumeClaimRetentionPolicy: whenDeleted: Retain whenScaled: Retain updateStrategy: type: RollingUpdate template: metadata: labels: app: cassandra-postgres annotations: vault.hashicorp.com/agent-inject: "true" vault.hashicorp.com/agent-pre-populate-only: "true" vault.hashicorp.com/role: "cassandra" vault.hashicorp.com/agent-inject-secret-postgres-password: "kv/data/atlas/cassandra/cassandra-db" vault.hashicorp.com/agent-inject-template-postgres-password: | {{- with secret "kv/data/atlas/cassandra/cassandra-db" -}} {{ .Data.data.POSTGRES_PASSWORD }} {{- end -}} spec: serviceAccountName: cassandra-postgres priorityClassName: cassandra-core nodeSelector: cassandra.bstein.dev/node-pool: oceanus tolerations: - key: veles.bstein.dev/simulation operator: Equal value: "true" effect: NoSchedule securityContext: fsGroup: 999 seccompProfile: type: RuntimeDefault containers: - name: postgres image: postgres:15 ports: - name: postgres containerPort: 5432 protocol: TCP env: - name: PGDATA value: /var/lib/postgresql/data/pgdata - name: POSTGRES_USER value: cassandra - name: POSTGRES_PASSWORD_FILE value: /vault/secrets/postgres-password - name: POSTGRES_DB value: cassandra resources: requests: cpu: "2" memory: 8Gi limits: cpu: "4" memory: 16Gi securityContext: allowPrivilegeEscalation: false volumeMounts: - name: postgres-data mountPath: /var/lib/postgresql/data volumeClaimTemplates: - metadata: name: postgres-data labels: app: cassandra-postgres cassandra.bstein.dev/backup: longhorn spec: accessModes: ["ReadWriteOnce"] storageClassName: cassandra-db resources: requests: storage: 100Gi