Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7296e58
feat(netpols): ship the Harbor database allow-rule
aweingarten Jul 28, 2026
50a35f2
fix(netpols): scope the harbor DB allow-rule to the ports it documents
aweingarten Aug 7, 2026
d4f9b42
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 10, 2026
20cbe23
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 10, 2026
c5ef6e9
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 11, 2026
357ae7c
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 11, 2026
3e2a1f4
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 11, 2026
c4f95da
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 12, 2026
2d4249b
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 12, 2026
eac9d98
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 12, 2026
0fa6ef0
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 12, 2026
443b5f7
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 12, 2026
3567ede
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 12, 2026
b28b32d
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 12, 2026
f99cd11
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 13, 2026
512dcc9
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 13, 2026
a253058
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 13, 2026
c1bfb65
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 13, 2026
8c97fde
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 14, 2026
aacfe4a
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 14, 2026
a1d8422
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 17, 2026
85d82f7
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 17, 2026
96c7111
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 18, 2026
0839a78
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 18, 2026
2d08223
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 18, 2026
aa97d6a
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 19, 2026
5a212a0
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 19, 2026
0ce1fc3
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 19, 2026
5790072
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 19, 2026
4eb1ce8
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 20, 2026
56e83b8
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 20, 2026
b17f091
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 20, 2026
4c00faf
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 20, 2026
8f10cc0
Merge branch 'main' into feat/harbor-db-cnpg-network-policy
svcAPLBot Aug 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{- if .Values.netpols.harborDb }}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: harbor-db-platform-policy
namespace: harbor
labels:
{{- include "apl-network-policies.labels" . | nindent 4 }}
app: harbor
spec:
# Scoped to the Harbor CloudNativePG instances rather than the whole harbor namespace: Harbor has
# a wide component surface (core, jobservice, registry, trivy, exporter, redis) and a
# namespace-wide Ingress policy would have to enumerate all of it correctly or take the registry
# down. The database is where the documented default-deny gap actually is.
podSelector:
matchLabels:
cnpg.io/cluster: harbor-otomi-db
policyTypes:
- Ingress
ingress:
# Allow the CloudNativePG operator to reach the instance manager status endpoint (8000), the
# metrics endpoint (9187) and Postgres itself (5432, for declarative role/database
# reconciliation). Without this the operator cannot read instance status, the Harbor Postgres
# replica never starts, and the stack stalls on Instance Status Extraction Error →
# ClusterIsNotReady → Degraded — with nothing in the symptom pointing at a NetworkPolicy.
- from:
- namespaceSelector:
matchLabels:
name: cnpg-system
ports:
- protocol: TCP
port: 8000
- protocol: TCP
port: 9187
- protocol: TCP
port: 5432
# Allow the Harbor components (core, jobservice, registry, exporter, trivy) to reach Postgres,
# and the instances to reach each other for replication — both on 5432.
- from:
- namespaceSelector:
matchLabels:
name: harbor
ports:
- protocol: TCP
port: 5432
# Allow monitoring access
- from:
- namespaceSelector:
matchLabels:
name: monitoring
podSelector:
matchLabels:
app.kubernetes.io/instance: po-prometheus
ports:
- protocol: TCP
port: 9187
{{- end }}
11 changes: 11 additions & 0 deletions charts/apl-network-policies/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,16 @@
# * Monitoring namespace (for metrics scraping)
# * Internal otomi namespace communication
#
# For harbor (netpols.harborDb: true):
# - Creates a NetworkPolicy in the harbor namespace, scoped to the CloudNativePG instances of
# harbor-otomi-db (not the whole namespace — Harbor's component surface is wide)
# - Allows ingress from:
# * cnpg-system on 8000/9187/5432 (operator polling instance status, metrics, and Postgres for
# declarative role and database reconciliation)
# * the harbor namespace on 5432 (components reaching Postgres; instances replicating)
# * Monitoring namespace on 9187 (for metrics scraping)
# The chart renders this policy purely on the netpols.harborDb flag; apl-core's values rendering
# is what sets it, and only when harbor is enabled.
#
# The complex network policy rules are baked into the chart templates,
# so users only need to toggle network policies on/off per application.
2 changes: 2 additions & 0 deletions helmfile.d/snippets/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ environments:
_rawValues: {}
harbor:
enabled: false
networkPolicies:
enabled: false
oidcAutoOnboard: true
oidcUserClaim: email
registry:
Expand Down
2 changes: 2 additions & 0 deletions values-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,8 @@ properties:
properties:
_rawValues:
$ref: '#/definitions/rawValues'
networkPolicies:
$ref: '#/definitions/appNetworkPolicyConfig'
enabled:
type: boolean
default: true
Expand Down
2 changes: 2 additions & 0 deletions values/apl-network-policies/apl-network-policies.gotmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{{- $v := .Values }}
{{- $a := $v.apps }}
{{- $oa := $v.apps | get "otomi-api" }}
{{- $h := $v.apps | get "harbor" }}

# Simple per-app network policy configuration
netpols:
gitServer: {{ not ($a | get "git-server.enabled") }}
gitea: {{ $a.gitea.networkPolicies.enabled}}
otomiApi: {{ $oa.networkPolicies.enabled}}
harborDb: {{ and ($h.networkPolicies.enabled) ($h.enabled) }}

ingressGatewaySelectors:
- namespaceSelector:
Expand Down