File tree Expand file tree Collapse file tree 12 files changed +255
-2
lines changed Expand file tree Collapse file tree 12 files changed +255
-2
lines changed Original file line number Diff line number Diff line change
1
+ .idea /
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ pgoControllerLeaseName: cpk-leader-election-lease
49
49
50
50
# replicas sets the number of PGO instances.
51
51
# Warning: This should only be greater than 1 if pgoControllerLeaseName is set!
52
- replicas : 1
52
+ replicas : 2
53
53
54
54
# imagePullSecretNames is a list of secret names to use for pulling controller images.
55
55
# More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
@@ -88,4 +88,4 @@ resources:
88
88
# Override environment variables entirely !!DANGEROUS!!
89
89
# envOverride:
90
90
# - name: PG_DEBUG
91
- # value: "true"
91
+ # value: "true"
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ kind : ConfigMap
3
+ metadata :
4
+ name : safety-advisor-pg-init-script-config
5
+ data :
6
+ init.sql : |
7
+ -- Grant read-only access to existing and future tables
8
+ GRANT CONNECT ON DATABASE safety_advisor TO appsmith;
9
+ GRANT USAGE ON SCHEMA public TO appsmith;
10
+ GRANT SELECT ON ALL TABLES IN SCHEMA public TO appsmith;
11
+
12
+ -- Optional: write access to selected tables
13
+ -- GRANT INSERT, UPDATE ON important_table TO appsmith;
14
+
15
+ -- Ensure all future tables are readable
16
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public
17
+ GRANT SELECT ON TABLES TO appsmith;
Original file line number Diff line number Diff line change
1
+ apiVersion : batch/v1
2
+ kind : Job
3
+ metadata :
4
+ name : safety-advisor-pg-init-script-job
5
+ spec :
6
+ template :
7
+ spec :
8
+ restartPolicy : Never
9
+ containers :
10
+ - name : psql
11
+ image : postgres:16
12
+ command : ["sh", "-c"]
13
+ args :
14
+ - |
15
+ echo "Waiting for DB...";
16
+ until pg_isready -h $PGHOST -p $PGPORT -U $PGUSER -d safety_advisor; do sleep 2; done;
17
+ echo "Running init.sql...";
18
+ psql -h $PGHOST -p $PGPORT -U $PGUSER -d safety_advisor -f /sql/init.sql
19
+ env :
20
+ - name : PGHOST
21
+ valueFrom :
22
+ secretKeyRef :
23
+ name : safety-advisor-pg-pguser-postgres
24
+ key : host
25
+ - name : PGPORT
26
+ valueFrom :
27
+ secretKeyRef :
28
+ name : safety-advisor-pg-pguser-postgres
29
+ key : port
30
+ - name : PGUSER
31
+ valueFrom :
32
+ secretKeyRef :
33
+ name : safety-advisor-pg-pguser-postgres
34
+ key : user
35
+ - name : PGPASSWORD
36
+ valueFrom :
37
+ secretKeyRef :
38
+ name : safety-advisor-pg-pguser-postgres
39
+ key : password
40
+ volumeMounts :
41
+ - name : sql-script
42
+ mountPath : /sql
43
+ volumes :
44
+ - name : sql-script
45
+ configMap :
46
+ name : safety-advisor-pg-init-script-config
47
+
Original file line number Diff line number Diff line change
1
+ apiVersion : kustomize.config.k8s.io/v1beta1
2
+ kind : Kustomization
3
+
4
+ resources :
5
+ - postgrescluster.yaml
6
+ - configmap.yaml
7
+ - job.yaml
Original file line number Diff line number Diff line change
1
+ apiVersion : postgres-operator.crunchydata.com/v1beta1
2
+ kind : PostgresCluster
3
+ metadata :
4
+ name : safety-advisor-pg
5
+ spec :
6
+ postgresVersion : 16
7
+
8
+ instances :
9
+ - name : primary
10
+ replicas : 1
11
+ dataVolumeClaimSpec :
12
+ accessModes : ["ReadWriteOnce"]
13
+ storageClassName : microk8s-hostpath
14
+ resources :
15
+ requests :
16
+ storage : 8Gi
17
+ resources :
18
+ requests :
19
+ cpu : " 250m"
20
+ memory : " 512Mi"
21
+ limits :
22
+ cpu : " 500m"
23
+ memory : " 1Gi"
24
+ users :
25
+ - name : postgres
26
+ - name : safety-advisor
27
+ databases : ["safety_advisor"]
28
+ - name : appsmith
29
+ databases : ["safety_advisor"]
30
+
31
+ patroni :
32
+ dynamicConfiguration :
33
+ postgresql :
34
+ parameters :
35
+ max_connections : " 300"
Original file line number Diff line number Diff line change
1
+ apiVersion : kustomize.config.k8s.io/v1beta1
2
+ kind : Kustomization
3
+ namespace : safety-advisor-ccps
4
+
5
+ resources :
6
+ - ../../base
7
+
8
+ patches :
9
+ - path : postgrescluster-patch.yaml
10
+ target :
11
+ group : postgres-operator.crunchydata.com
12
+ version : v1beta1
13
+ kind : PostgresCluster
14
+ name : safety-advisor-pg
Original file line number Diff line number Diff line change
1
+ apiVersion : postgres-operator.crunchydata.com/v1beta1
2
+ kind : PostgresCluster
3
+ metadata :
4
+ name : safety-advisor-pg
5
+ spec :
6
+ instances :
7
+ - name : primary
8
+ replicas : 1
9
+ dataVolumeClaimSpec :
10
+ accessModes : ["ReadWriteOnce"]
11
+ storageClassName : microk8s-hostpath
12
+ resources :
13
+ requests :
14
+ storage : 32Gi
15
+ resources :
16
+ requests :
17
+ cpu : " 500m"
18
+ memory : " 1Gi"
19
+ limits :
20
+ cpu : " 1"
21
+ memory : " 2Gi"
22
+
23
+ patroni :
24
+ dynamicConfiguration :
25
+ postgresql :
26
+ parameters :
27
+ max_connections : " 500"
28
+ wal_level : replica
29
+ archive_mode : " on"
30
+ archive_timeout : " 60s"
31
+
32
+ backups :
33
+ pgbackrest :
34
+ configuration :
35
+ - secret :
36
+ name : pgo-s3-creds
37
+ global :
38
+ repo1-path : /pgbackrest/crunchy-pg-operator/safety-advisor/safety-advisor-ccps
39
+ repo1-retention-full : " 14"
40
+ repo1-retention-full-type : time
41
+ repos :
42
+ - name : repo1
43
+ schedules :
44
+ full : " 0 1 * * 0"
45
+ differential : " 0 1 * * 1-6"
46
+ s3 :
47
+ bucket : uc2civo
48
+ endpoint : s3.amazonaws.com
49
+ region : us-east-2
50
+
Original file line number Diff line number Diff line change
1
+ apiVersion : kustomize.config.k8s.io/v1beta1
2
+ kind : Kustomization
3
+ namespace : safety-advisor
4
+
5
+ resources :
6
+ - ../../base
7
+
8
+ patches :
9
+ - path : postgrescluster-patch.yaml
10
+ target :
11
+ group : postgres-operator.crunchydata.com
12
+ version : v1beta1
13
+ kind : PostgresCluster
14
+ name : safety-advisor-pg
Original file line number Diff line number Diff line change
1
+ apiVersion : postgres-operator.crunchydata.com/v1beta1
2
+ kind : PostgresCluster
3
+ metadata :
4
+ name : safety-advisor-pg
5
+ spec :
6
+ instances :
7
+ - name : primary
8
+ replicas : 1
9
+ dataVolumeClaimSpec :
10
+ accessModes : ["ReadWriteOnce"]
11
+ storageClassName : microk8s-hostpath
12
+ resources :
13
+ requests :
14
+ storage : 32Gi
15
+ resources :
16
+ requests :
17
+ cpu : " 500m"
18
+ memory : " 1Gi"
19
+ limits :
20
+ cpu : " 1"
21
+ memory : " 2Gi"
22
+
23
+ patroni :
24
+ dynamicConfiguration :
25
+ postgresql :
26
+ parameters :
27
+ max_connections : " 500"
28
+ wal_level : replica
29
+ archive_mode : " on"
30
+ archive_timeout : " 60s"
31
+
32
+ backups :
33
+ pgbackrest :
34
+ configuration :
35
+ - secret :
36
+ name : pgo-s3-creds
37
+ global :
38
+ repo1-path : /pgbackrest/crunchy-pg-operator/safety-advisor/safety-advisor-staging
39
+ repo1-retention-full : " 14"
40
+ repo1-retention-full-type : time
41
+ repos :
42
+ - name : repo1
43
+ schedules :
44
+ full : " 0 1 * * 0"
45
+ differential : " 0 1 * * 1-6"
46
+ s3 :
47
+ bucket : uc2civo
48
+ endpoint : s3.amazonaws.com
49
+ region : us-east-2
50
+
You can’t perform that action at this time.
0 commit comments