GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — registry-stack/deploy/postgres/postgres.yaml at main · registrystack/registry-stack

Expand file tree

/

postgres.yaml

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
169 lines (169 loc) · 5.81 KB
/

postgres.yaml

Copy path

File metadata and controls

169 lines (169 loc) · 5.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
apiVersion: v1
kind: ConfigMap
metadata:
name: registry-postgres
data:
# The bootstrap role postgres is the only superuser. The provisioning SQL
# creates NOSUPERUSER roles only, so rejecting postgres over the network
# covers every superuser role. A role later granted SUPERUSER by hand is
# not covered and needs its own reject line.
#
# No role opens a network session on the maintenance or template databases.
# Product databases are separated by the CONNECT privilege, not by these
# rules. BReg's provisioning revokes it from PUBLIC and grants it to the BReg
# roles only. Other products follow deploy/README.md, so adding a product
# needs no change here.
pg_hba.conf: |
local all postgres peer
local all all reject
hostssl all postgres 0.0.0.0/0 reject
hostssl all postgres ::/0 reject
hostssl postgres,template0,template1 all 0.0.0.0/0 reject
hostssl postgres,template0,template1 all ::/0 reject
hostssl all all 0.0.0.0/0 scram-sha-256
hostssl all all ::/0 scram-sha-256
host all all 0.0.0.0/0 reject
host all all ::/0 reject
---
apiVersion: v1
kind: Service
metadata:
name: registry-postgres
spec:
selector:
app.kubernetes.io/name: registry-postgres
ports:
- name: postgres
port: 5432
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: registry-postgres
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: registry-postgres
policyTypes: [Ingress]
ingress:
# Only Pods the chart labels as database clients may connect.
- from:
- podSelector:
matchLabels:
registrystack.org/database-client: "true"
ports:
- {protocol: TCP, port: 5432}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: registry-postgres
spec:
serviceName: registry-postgres
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: registry-postgres
template:
metadata:
labels:
app.kubernetes.io/name: registry-postgres
spec:
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 60
initContainers:
- name: tls
image: docker.io/library/busybox@sha256:a7dbc319b1438115a207e11930dc4bb3e643dcb3ec0bdd694bb36cd8fad289ec
command: [sh, -ec]
args:
- |
umask 077
mkdir -p /output/tls
cat /input/tls.crt > /output/tls/server.crt
cat /input/tls.key > /output/tls/server.key
resources:
requests: {cpu: 10m, memory: 8Mi}
limits: {memory: 32Mi}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
volumeMounts:
- name: tls-source
mountPath: /input
readOnly: true
- name: tls
mountPath: /output
containers:
- name: postgres
image: docker.io/library/postgres@sha256:ff87138949ad9a46f32ff23bd6852b52ce024a13dffe9b4087be98292cdd3b4f
args:
- postgres
- -c
- ssl=on
- -c
- ssl_cert_file=/run/registry-tls/server.crt
- -c
- ssl_key_file=/run/registry-tls/server.key
- -c
- hba_file=/etc/registry-postgres/pg_hba.conf
- -c
- password_encryption=scram-sha-256
env:
- {name: PGDATA, value: /data/pgdata}
- {name: POSTGRES_PASSWORD_FILE, value: /run/postgres-init/password}
- {name: POSTGRES_INITDB_ARGS, value: "--auth-local=peer --auth-host=scram-sha-256"}
ports:
- {name: postgres, containerPort: 5432}
startupProbe:
exec:
command: [pg_isready, -q, -h, /var/run/postgresql, -U, postgres]
periodSeconds: 2
failureThreshold: 60
readinessProbe:
exec:
command: [pg_isready, -q, -h, /var/run/postgresql, -U, postgres]
periodSeconds: 5
resources:
requests: {cpu: 100m, memory: 256Mi}
limits: {memory: 1Gi}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
volumeMounts:
- {name: data, mountPath: /data}
- {name: tmp, mountPath: /tmp}
- {name: socket, mountPath: /var/run/postgresql}
- {name: tls, mountPath: /run/registry-tls, subPath: tls, readOnly: true}
- {name: bootstrap, mountPath: /run/postgres-init, readOnly: true}
- {name: config, mountPath: /etc/registry-postgres, readOnly: true}
volumes:
- name: data
persistentVolumeClaim:
claimName: registry-postgres-data
- name: tmp
emptyDir: {sizeLimit: 128Mi}
- name: socket
emptyDir: {sizeLimit: 8Mi}
- name: tls
emptyDir: {medium: Memory, sizeLimit: 4Mi}
- name: tls-source
secret:
secretName: registry-postgres-tls
defaultMode: 0444
- name: bootstrap
secret:
secretName: registry-postgres-bootstrap
defaultMode: 0444
- name: config
configMap:
name: registry-postgres
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.