-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: PostgreSQL operator, Pomerium switched to managed database (#26)
- Loading branch information
Showing
28 changed files
with
12,776 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions
39
apps/network-policies/templates/network-policy-postgresql-clusters.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: postgresql-clusters | ||
labels: | ||
{{- include "common.resource-labels" . | indent 4 }} | ||
spec: | ||
podSelector: | ||
matchExpressions: | ||
- key: cnpg.io/cluster | ||
operator: Exists | ||
- key: cnpg.io/podRole | ||
operator: In | ||
values: | ||
- instance | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
# Accept traffic from postgresql jobs in the same namespace | ||
- ports: | ||
- protocol: TCP | ||
port: 5432 | ||
from: | ||
- podSelector: | ||
matchExpressions: | ||
- key: cnpg.io/jobRole | ||
operator: Exists | ||
|
||
# Accept traffic from operator in postgresql-system namespace | ||
- ports: | ||
- protocol: TCP | ||
port: 8000 | ||
from: | ||
- namespaceSelector: | ||
matchLabels: | ||
kubernetes.io/metadata.name: postgresql-system | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: cloudnative-pg |
15 changes: 15 additions & 0 deletions
15
apps/network-policies/templates/network-policy-postgresql-jobs.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: postgresql-jobs | ||
labels: | ||
{{- include "common.resource-labels" . | indent 4 }} | ||
spec: | ||
podSelector: | ||
matchExpressions: | ||
- key: cnpg.io/jobRole | ||
operator: Exists | ||
policyTypes: | ||
- Egress | ||
egress: | ||
{{- include "common.egress-kubeapi" . | indent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
apps/pomerium/templates/custom-network-policy-postgresql-cluster.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ .Release.Name }}-postgresql | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "common.resource-labels" . | indent 4 }} | ||
spec: | ||
podSelector: | ||
matchExpressions: | ||
- key: cnpg.io/cluster | ||
operator: In | ||
values: | ||
- {{ $.Release.Name }} | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
# Accept traffic from pomerium | ||
- ports: | ||
- protocol: TCP | ||
port: 5432 | ||
from: | ||
- podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: pomerium | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: {{ $.Release.Name }} | ||
spec: | ||
instances: 2 | ||
|
||
bootstrap: | ||
initdb: | ||
database: {{ .Values.postgresql.database }} | ||
owner: {{ .Values.postgresql.username }} | ||
secret: | ||
name: {{ .Release.Name }}-postgresql-cluster | ||
|
||
storage: | ||
pvcTemplate: | ||
accessModes: {{ .Values.postgresql.accessModes }} | ||
storageClassName: {{ .Values.postgresql.storageClass }} | ||
resources: | ||
requests: | ||
storage: {{ .Values.postgresql.size }} |
13 changes: 13 additions & 0 deletions
13
apps/pomerium/templates/custom-secret-postgresql-cluster.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Release.Name }}-postgresql-cluster | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "common.resource-labels" . | indent 4 }} | ||
type: kubernetes.io/basic-auth | ||
# Password cannot be changed because PostgreSQL will not update it after the database is created | ||
immutable: true | ||
data: | ||
username: {{ .Values.postgresql.username | b64enc }} | ||
password: {{ .Values.postgresql.password | b64enc }} |
24 changes: 12 additions & 12 deletions
24
...um/templates/custom-secret-postgresql.yml → ...s/custom-secret-postgresql-connection.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Release.Name }}-postgresql-connection | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "common.resource-labels" . | indent 4 }} | ||
type: Opaque | ||
# Password cannot be changed because PostgreSQL will not update it after the database is created | ||
immutable: true | ||
stringData: | ||
connection: "postgresql:https://{{ .Values.postgresql.global.postgresql.auth.username }}:{{ .Values.postgresql.global.postgresql.auth.password }}@{{ .Release.Name }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local/{{ .Values.postgresql.global.postgresql.auth.database }}" | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Release.Name }}-postgresql-connection | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "common.resource-labels" . | indent 4 }} | ||
type: Opaque | ||
# Password cannot be changed because PostgreSQL will not update it after the database is created | ||
immutable: true | ||
stringData: | ||
connection: "postgresql:https://{{ .Values.postgresql.username }}:{{ .Values.postgresql.password }}@{{ .Release.Name }}-rw.{{ .Release.Namespace }}.svc.cluster.local/{{ .Values.postgresql.database }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.