Skip to content

Add optional NetworkPolicy templates for namespace isolation#5

Merged
minmzzhang merged 4 commits into
validatedpatterns:mainfrom
p-rog:network-policy-support
Jun 15, 2026
Merged

Add optional NetworkPolicy templates for namespace isolation#5
minmzzhang merged 4 commits into
validatedpatterns:mainfrom
p-rog:network-policy-support

Conversation

@p-rog

@p-rog p-rog commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Adds a default-deny NetworkPolicy and per-pod allow rule templates for spire-server, OIDC discovery provider, SPIFFE CSI driver, and ZTWIM operator. All disabled by default — patterns opt in via values.

Note: spire-agent uses hostNetwork and is not affected by NetworkPolicies.

Adds a default-deny NetworkPolicy and per-pod allow rule templates for
spire-server, OIDC discovery provider, SPIFFE CSI driver, and ZTWIM
operator. All disabled by default — patterns opt in via values.

Note: spire-agent uses hostNetwork and is not affected by NetworkPolicies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@minmzzhang minmzzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we update the conditions before submission?

@@ -0,0 +1,18 @@
{{- if and (eq (.Values.defaultDenyNetworkPolicy.enabled | toString) "true") .Values.networkPolicy.csiDriver.enabled }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add the toSring here?

{{- if and (eq (.Values.defaultDenyNetworkPolicy.enabled | toString) "true") (eq (.Values.networkPolicy.csiDriver.enabled | toString) "true") }}

@@ -0,0 +1,22 @@
{{- if and (eq (.Values.defaultDenyNetworkPolicy.enabled | toString) "true") .Values.networkPolicy.oidcDiscoveryProvider.enabled }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here toString for the 2nd half

Comment thread templates/operator-network-policy.yaml Outdated
@@ -0,0 +1,22 @@
{{- if and (eq (.Values.defaultDenyNetworkPolicy.enabled | toString) "true") .Values.networkPolicy.operator.enabled }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here toString for the 2nd half

@@ -0,0 +1,22 @@
{{- if and (eq (.Values.defaultDenyNetworkPolicy.enabled | toString) "true") .Values.networkPolicy.spireServer.enabled }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here toString for the 2nd half

@p-rog

p-rog commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

shall we update the conditions before submission?

Great catch, I'm fixing it right away.

Use toString + eq for both halves of the condition to handle values
passed as strings via Helm overrides (common in Validated Patterns).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@minmzzhang minmzzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also bump up the version, and run "make helm-docs" before submission. Otherwise, all LGTM! very well documented!

@minmzzhang

minmzzhang commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

If the superlinter fails, probably should add the prettier reformatting as updated in the rhbk chart: Makefile

podman run $(PODMAN_ARGS) -v $(PWD):/work:rw -w /work $(PRETTIER_IMAGE) --write README.md

@sabre1041 sabre1041 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully as part of validatedpatterns/layered-zero-trust#145

Agree with @minmzzhang that we should bump the chart version and regen the docs

@p-rog p-rog requested review from minmzzhang and sabre1041 June 15, 2026 12:29
@p-rog

p-rog commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@minmzzhang / @sabre1041 I bumped the chart version and regen the helm docs. Please merge it and create new release. Then we can go ahead and merge validatedpatterns/layered-zero-trust#145.

@minmzzhang

minmzzhang commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Hi @p-rog , as expected the superlinter failed at markdown prettier checking, would you mind to add the prettier reformat in the Makefile, under the helm-docs target as the same as RHBK chart?

podman run $(PODMAN_ARGS) -v $(PWD):/work:rw -w /work $(PRETTIER_IMAGE) --write README.md

@minmzzhang minmzzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@minmzzhang minmzzhang merged commit 5373af0 into validatedpatterns:main Jun 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants