Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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,37 @@
{{- if .Values.netpols.externalSecrets }}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: external-secrets-platform-policy
namespace: external-secrets
labels:
{{- include "apl-network-policies.labels" . | nindent 4 }}
app: external-secrets
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: external-secrets-webhook
policyTypes:
- Ingress
ingress:
# Allow the apiserver to reach the validating / conversion webhook.
# The apiserver is off the pod network on a managed control plane (LKE / LKE-E) and has no
# address that a namespaceSelector or ipBlock can pin down, so this rule is scoped by port
# rather than by source. Without it every ClusterSecretStore/ExternalSecret create or update
# times out against the webhook.
- ports:
- protocol: TCP
port: 10250
# Allow monitoring access
- from:
- namespaceSelector:
matchLabels:
name: monitoring
podSelector:
matchLabels:
app.kubernetes.io/instance: po-prometheus
ports:
- protocol: TCP
port: 8080
{{- end }}
8 changes: 8 additions & 0 deletions charts/apl-network-policies/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,13 @@
# * Monitoring namespace (for metrics scraping)
# * Internal otomi namespace communication
#
# For external-secrets (netpols.externalSecrets: true):
# - Creates a NetworkPolicy in the external-secrets namespace, scoped to the webhook pods
# - Allows ingress from:
# * anywhere on the webhook port 10250 — the apiserver calls the validating/conversion
# webhook, and on a managed control plane it is off the pod network with no address a
# selector or ipBlock can pin down, so the rule is scoped by port instead of by source
# * Monitoring namespace on 8080 (for metrics scraping)
#
# 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 @@ -960,6 +960,8 @@ environments:
memory: 1Gi
_rawValues: {}
external-secrets:
networkPolicies:
enabled: false
resources:
operator:
requests:
Expand Down
2 changes: 2 additions & 0 deletions values-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,8 @@ properties:
properties:
_rawValues:
$ref: '#/definitions/rawValues'
networkPolicies:
$ref: '#/definitions/appNetworkPolicyConfig'
resources:
properties:
operator:
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" }}
{{- $es := $v.apps | get "external-secrets" }}

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

ingressGatewaySelectors:
- namespaceSelector:
Expand Down
Loading