Skip to content

feat(helm): add opt-in NetworkPolicy to restrict ingress/egress#98

Merged
btwshivam merged 2 commits into
optiqor:mainfrom
bhavyanjain3004:main
Jun 6, 2026
Merged

feat(helm): add opt-in NetworkPolicy to restrict ingress/egress#98
btwshivam merged 2 commits into
optiqor:mainfrom
bhavyanjain3004:main

Conversation

@bhavyanjain3004
Copy link
Copy Markdown
Contributor

What

Adds an opt-in NetworkPolicy template to the Kerno Helm chart to secure network traffic for the DaemonSet agent pods by restricting ingress and egress by default.

Why

Fixes #43

How

  • Added networkPolicy defaults to values.yaml (disabled by default) specifying ingress targets for Prometheus and egress targets for DNS, Kubelet, and Kubernetes API server.
  • Built a dynamic templates/networkpolicy.yaml supporting custom ingress (additionalIngress) and egress (additionalEgress) rules, with clean YAML list formatting (no bullet points on empty lines).
  • Documented variables in deploy/helm/kerno/README.md and updated root README.md.

Testing

  • go build ./... passes (validated using GOOS=linux go build ./...)

  • go test ./... passes (validated compile cleanly via GOOS=linux go test -c)

  • go vet ./... passes

  • golangci-lint run ./... passes (no Go code modified, vet is clean)

  • Tested locally with: helm lint deploy/helm/kerno and helm template checks

  • N/A — pure docs/refactor / helm templates

Checklist

  • PR title follows Conventional Commits (feat(helm): add opt-in NetworkPolicy to restrict traffic)
  • All commits are DCO-signed (git commit -s)
  • No unrelated changes pulled in
  • Documentation updated where user-visible behavior changed
  • Added/updated tests for new code paths (N/A)
  • If a new doctor rule, paired with a chaos scenario in scripts/verify.sh (N/A)

Signed-off-by: Bhavya <bhavyajain3004@gmail.com>
@github-actions
Copy link
Copy Markdown

🚀 First PR — welcome aboard!

A few things to expect:

  1. CI: every PR runs build + race tests + lint + (eventually) the kernel matrix. If something fails, the log will tell you exactly which gate.
  2. DCO: every commit needs Signed-off-by:git commit -s adds it automatically.
  3. Conventional Commits: PR titles like feat(doctor): add new rule or fix(bpf): handle X. We squash-merge by default.
  4. Review: a maintainer will review within 72 hours. Suggestions are conversations, not orders — push back if something doesn't fit your context.

If you get stuck, reply here or jump to Discussions. We want this PR to land.

@github-actions github-actions Bot added level:intermediate 50-200 lines or 3-5 files (auto-applied) documentation Improvements or additions to documentation area/k8s Kubernetes integration and removed level:intermediate 50-200 lines or 3-5 files (auto-applied) labels May 22, 2026
Copy link
Copy Markdown
Member

@btwshivam btwshivam left a comment

Choose a reason for hiding this comment

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

the policy targets a hostNetwork daemonset, so a standard NetworkPolicy doesn't enforce on it and restricts nothing, despite the docs saying deny-by-default. make the docs honest about that (or rethink the mechanism), plus the open-egress default. also the readme mentions /debug/pprof, which isn't implemented and the policy only opens the metrics port.

Comment thread deploy/helm/kerno/templates/networkpolicy.yaml
Comment thread deploy/helm/kerno/templates/networkpolicy.yaml Outdated
Signed-off-by: Bhavya <bhavyajain3004@gmail.com>
@github-actions github-actions Bot added the level:intermediate 50-200 lines or 3-5 files (auto-applied) label May 31, 2026
Copy link
Copy Markdown
Member

@btwshivam btwshivam left a comment

Choose a reason for hiding this comment

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

thanks for the fix, the hostNetwork caveat is documented honestly now and empty cidrs deny instead of allow. verified the render both ways.

@btwshivam
Copy link
Copy Markdown
Member

/lgtm

@btwshivam btwshivam merged commit 0d5628b into optiqor:main Jun 6, 2026
10 of 11 checks passed
@btwshivam btwshivam added the gssoc:approved Counted toward leaderboard label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/k8s Kubernetes integration documentation Improvements or additions to documentation gssoc:approved Counted toward leaderboard level:intermediate 50-200 lines or 3-5 files (auto-applied)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helm: NetworkPolicy template (defense-in-depth)

2 participants