From 51bccf39ee14a5834814e421e774f22cc43bcbf8 Mon Sep 17 00:00:00 2001 From: Guillaume LEGRAIN Date: Mon, 3 Jun 2024 10:52:46 +0200 Subject: [PATCH 1/2] Create example that can be reused --- example/pgsqlgule-classic.yaml | 59 ++++++++++++++++++++++++++++++++++ example/pgsqlgule-uri.yaml | 54 +++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 example/pgsqlgule-classic.yaml create mode 100644 example/pgsqlgule-uri.yaml diff --git a/example/pgsqlgule-classic.yaml b/example/pgsqlgule-classic.yaml new file mode 100644 index 0000000..eb40234 --- /dev/null +++ b/example/pgsqlgule-classic.yaml @@ -0,0 +1,59 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: pgsqlgule-dv + namespace: demo-secatscale +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pgsqlgule-dv-classic + namespace: demo-secatscale + labels: + app: pgsqlgule-dv +spec: + replicas: 1 + selector: + matchLabels: + app: pgsqlgule-dv + template: + metadata: + labels: + app: pgsqlgule-dv + vault-db-injector-dev: "true" + annotations: + db-creds-injector.numberly.io/pgsqlgule_dv.role: pgsqlgule-dv + db-creds-injector.numberly.io/pgsqlgule_dv.mode: classic + db-creds-injector.numberly.io/pgsqlgule_dv.env-key-dbpassword: DB_PASSWORD,PGPASSWORD + db-creds-injector.numberly.io/pgsqlgule_dv.env-key-dbuser: DB_USER,PGUSER + spec: + serviceAccountName: pgsqlgule-dv + imagePullSecrets: + - name: "registry-token" + - name: "registry-token-common" + containers: + - name: svc + image: registry.numberly.in/docker-images/postgres-curl-jq:0.1.0 + imagePullPolicy: IfNotPresent + resources: + limits: + ephemeral-storage: 2Gi + memory: 400Mi + requests: + ephemeral-storage: 512Mi + memory: 160Mi + securityContext: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 65534 + runAsGroup: 65534 + command: + - "bash" + - "-c" + - "trap 'exit 0' TERM; sleep infinity & wait" + env: + - name: PGHOST + value: pginstance + - name: PGDATABASE + value: pgsqlgule_dv diff --git a/example/pgsqlgule-uri.yaml b/example/pgsqlgule-uri.yaml new file mode 100644 index 0000000..156ac7c --- /dev/null +++ b/example/pgsqlgule-uri.yaml @@ -0,0 +1,54 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: pgsqlgule-dv + namespace: demo-secatscale +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pgsqlgule-dv-uri + namespace: demo-secatscale + labels: + app: pgsqlgule-dv +spec: + replicas: 1 + selector: + matchLabels: + app: pgsqlgule-dv + template: + metadata: + labels: + app: pgsqlgule-dv + vault-db-injector-dev: "true" + annotations: + db-creds-injector.numberly.io/pgsqlgule_dv.role: pgsqlgule-dv + db-creds-injector.numberly.io/pgsqlgule_dv.mode: uri + db-creds-injector.numberly.io/pgsqlgule_dv.template: postgres://@pginstance:5432/pgsqlgule_dv?sslmode=require + db-creds-injector.numberly.io/pgsqlgule_dv.env-key-uri: POSTGRES_URL + spec: + serviceAccountName: pgsqlgule-dv + imagePullSecrets: + - name: "registry-token" + - name: "registry-token-common" + containers: + - name: svc + image: registry.numberly.in/docker-images/postgres-curl-jq:0.1.0 + imagePullPolicy: IfNotPresent + resources: + limits: + ephemeral-storage: 2Gi + memory: 400Mi + requests: + ephemeral-storage: 512Mi + memory: 160Mi + securityContext: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + runAsNonRoot: true + runAsUser: 65534 + runAsGroup: 65534 + command: + - "bash" + - "-c" + - "trap 'exit 0' TERM; sleep infinity & wait" From ea8f894a9a10a023cd5a8bebdb23eb708fb93c6c Mon Sep 17 00:00:00 2001 From: Guillaume LEGRAIN Date: Mon, 3 Jun 2024 10:53:13 +0200 Subject: [PATCH 2/2] demo namespace is enough --- example/pgsqlgule-classic.yaml | 4 ++-- example/pgsqlgule-uri.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/pgsqlgule-classic.yaml b/example/pgsqlgule-classic.yaml index eb40234..98f84f5 100644 --- a/example/pgsqlgule-classic.yaml +++ b/example/pgsqlgule-classic.yaml @@ -2,13 +2,13 @@ apiVersion: v1 kind: ServiceAccount metadata: name: pgsqlgule-dv - namespace: demo-secatscale + namespace: demo --- apiVersion: apps/v1 kind: Deployment metadata: name: pgsqlgule-dv-classic - namespace: demo-secatscale + namespace: demo labels: app: pgsqlgule-dv spec: diff --git a/example/pgsqlgule-uri.yaml b/example/pgsqlgule-uri.yaml index 156ac7c..839b2f4 100644 --- a/example/pgsqlgule-uri.yaml +++ b/example/pgsqlgule-uri.yaml @@ -2,13 +2,13 @@ apiVersion: v1 kind: ServiceAccount metadata: name: pgsqlgule-dv - namespace: demo-secatscale + namespace: demo --- apiVersion: apps/v1 kind: Deployment metadata: name: pgsqlgule-dv-uri - namespace: demo-secatscale + namespace: demo labels: app: pgsqlgule-dv spec: