Restrict coroot ingress, add pooler PDB, trim comments
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/kubeconform Pipeline failed

This commit is contained in:
2026-11-27 06:57:07 +11:00
parent fec8c45125
commit 73b274b508
12 changed files with 56 additions and 41 deletions
@@ -10,6 +10,5 @@ spec:
type: A
ttl: 600
values:
# traefik-EXTERNAL (DMZ) gateway VIP; the coroot-external Gateway serves the
# coroot.unkin.net front door (oauth2-proxy) there.
# traefik-external (DMZ) gateway VIP.
- 198.18.199.0
+5 -14
View File
@@ -1,8 +1,5 @@
---
# Ceph RGW (S3) backup target for the coroot CNPG cluster, provisioned by the
# in-estate cephrgw-operator. One dedicated bucket + owner user per cluster:
# cephrgw CRs are namespace-scoped and CNPG reads its S3 credential Secret from
# its own namespace, so backups are per-database rather than one shared bucket.
# Per-cluster Ceph RGW bucket + owner user for CNPG backups, via cephrgw-operator.
apiVersion: ceph.unkin.net/v1alpha1
kind: ObjectStoreUser
metadata:
@@ -13,11 +10,9 @@ spec:
# RGW users are global; keep the uid namespace-qualified so it never collides.
uid: cnpg-coroot-backup
maxBuckets: 5
# Operator writes AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY (+ RGW_UID,
# S3_ENDPOINT) into this Secret; the Cluster's barmanObjectStore consumes it.
# Operator writes the S3 keys here; the Cluster's barmanObjectStore consumes them.
secretName: cnpg-coroot-backup-s3
# Keep the RGW user (and thus the keys) if this CR is ever deleted, so an
# in-flight restore can still reach the archive.
# Keep the RGW user (and keys) on CR deletion so a restore can still reach the archive.
retainOnDelete: true
---
apiVersion: ceph.unkin.net/v1alpha1
@@ -28,8 +23,7 @@ metadata:
spec:
placementTarget: ec
bucketName: cnpg-coroot
# The owner user has full control of its own bucket (read + write), which is
# all the backup/restore identity needs — no extra BucketAccess grant.
# The owner user has full read/write on its bucket; no extra BucketAccess grant.
ownerRef: cnpg-coroot-backup
versioning: false
tags:
@@ -38,10 +32,7 @@ spec:
# Never drop the backups if the CR is removed; retire buckets by hand.
retainOnDelete: true
---
# Nightly base backup. Continuous WAL archiving is always-on via the Cluster's
# spec.backup.barmanObjectStore; this schedules the periodic full backup that
# WAL is layered on top of. Schedules are staggered across clusters so the 8
# base backups do not hit RGW at once (CNPG cron is 6-field, seconds first).
# Nightly base backup under always-on WAL archiving (CNPG cron is 6-field, seconds first).
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
+2 -7
View File
@@ -8,15 +8,11 @@ spec:
affinity:
podAntiAffinityType: preferred
backup:
# 30-day retention (DEFAULT — adjust per cluster if needed). Enforced by CNPG
# against the object store on each successful base backup.
retentionPolicy: 30d
barmanObjectStore:
# Dedicated per-cluster Ceph RGW bucket (cephrgw-operator provisions it).
destinationPath: s3://cnpg-coroot
endpointURL: https://s3.ceph.unkin.net
# radosgw serves a Vault-PKI cert; trust the internal CA (reflected into
# every namespace as the vault-ca-cert Secret).
# radosgw serves a Vault-PKI cert.
endpointCA:
name: vault-ca-cert
key: ca.crt
@@ -42,8 +38,7 @@ spec:
encoding: UTF8
localeCType: C
localeCollate: C
# No secret ref: CNPG mints the owner credentials in the generated
# "postgres-app" Secret, which the Coroot CR reads.
# CNPG mints the owner credentials in the postgres-app Secret.
owner: coroot
enablePDB: true
enableSuperuserAccess: false
+1 -3
View File
@@ -1,7 +1,5 @@
---
# Coroot Community Edition, reconciled by coroot-operator (coroot-system).
# Community has no OIDC: oauth2-proxy (Authentik, akP-coroot-admin) is the only
# ingress path, so the UI trusts every request that reaches it as Admin.
# Community has no OIDC: oauth2-proxy is the only ingress path, so anonymous requests are Admin.
apiVersion: coroot.com/v1
kind: Coroot
metadata:
+1 -7
View File
@@ -1,11 +1,5 @@
---
# External (DMZ) front for the Coroot UI on coroot.unkin.net via the
# external Traefik (LB VIP 198.18.199.0). TLS terminates with the real Let's
# Encrypt *.unkin.net wildcard (Certificate wildcard-unkin-net in cert-manager,
# reflected into this namespace as wildcard-unkin-net-tls by the emberstack
# reflector), so there is no cert-manager annotation here. The apex
# coroot.unkin.net A record lives in the bind-operator unkin.net zone, NOT
# external-dns, so no external-dns annotation either. oauth2-proxy fronts it.
# External (DMZ) Traefik front for coroot.unkin.net, TLS via the reflected LE *.unkin.net wildcard.
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
+1
View File
@@ -13,6 +13,7 @@ resources:
- oauth2-proxy-configmap.yaml
- oauth2-proxy-deployment.yaml
- pdb.yaml
- networkpolicy.yaml
- service.yaml
- gateway.yaml
- httproute.yaml
+30
View File
@@ -0,0 +1,30 @@
---
# authAnonymousRole is Admin, so only oauth2-proxy and the coroot agents may reach the UI/API.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: coroot-ingress
namespace: coroot
spec:
podSelector:
matchLabels:
app.kubernetes.io/part-of: coroot
app.kubernetes.io/component: coroot
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app: coroot-oauth2
- podSelector:
matchLabels:
app.kubernetes.io/part-of: coroot
app.kubernetes.io/component: coroot-node-agent
- podSelector:
matchLabels:
app.kubernetes.io/part-of: coroot
app.kubernetes.io/component: coroot-cluster-agent
ports:
- protocol: TCP
port: 8080
+1 -2
View File
@@ -16,8 +16,7 @@ data:
OAUTH2_PROXY_ALLOWED_GROUPS: "akP-coroot-admin"
OAUTH2_PROXY_PASS_USER_HEADERS: "true"
OAUTH2_PROXY_EMAIL_DOMAINS: "*"
# Authentik hardcodes email_verified=false in the id_token; authorization is
# enforced via ak_groups, so accepting the unverified email is safe.
# Authentik hardcodes email_verified=false; authorization is enforced via ak_groups.
OAUTH2_PROXY_INSECURE_OIDC_ALLOW_UNVERIFIED_EMAIL: "true"
OAUTH2_PROXY_COOKIE_SECURE: "true"
OAUTH2_PROXY_COOKIE_DOMAINS: "coroot.unkin.net"
@@ -38,8 +38,7 @@ spec:
seccompProfile:
type: RuntimeDefault
initContainers:
# identity.unkin.net serves a Vault-PKI cert; combine the system roots
# with the internal CA so oauth2-proxy's OIDC HTTP client trusts it.
# identity.unkin.net serves a Vault-PKI cert; append the internal CA to the system roots.
- name: combine-certs
image: docker.io/library/alpine:3
imagePullPolicy: IfNotPresent
+11
View File
@@ -45,3 +45,14 @@ spec:
selector:
matchLabels:
app: coroot-oauth2
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: postgres-pooler-rw
namespace: coroot
spec:
minAvailable: 1
selector:
matchLabels:
cnpg.io/poolerName: postgres-pooler-rw
+1 -2
View File
@@ -1,6 +1,5 @@
---
# Front-door entry Service: the HTTPRoute for coroot.unkin.net targets this, so
# all traffic enters via oauth2-proxy.
# HTTPRoute target: all traffic enters via oauth2-proxy.
apiVersion: v1
kind: Service
metadata:
@@ -1,5 +1,4 @@
# Single replica: the operator has no leader election, so two would fight.
# Watches all namespaces; reconciles the Coroot CR in the `coroot` namespace.
# Single replica: the operator has no leader election.
resources:
requests:
cpu: 100m