Skip to content

helm/v2-alpha: network-policy not included as optional value unlike prometheus #5471

@asergeant01

Description

@asergeant01

What broke? What's expected?

The helm/v2-alpha plugin handles prometheus and network-policy inconsistently when they are commented out in kustomization.yaml.

Expected behavior:
Both optional features (prometheus and network-policy) should generate conditional templates with enable/disable values when commented out.

Actual behavior:

  • prometheus (commented out) → generates prometheus.enable: false in values.yaml and a conditional ServiceMonitor template with {{- if .Values.prometheus.enable }}

  • network-policy (commented out) → generates nothing, no value, no conditional template

This inconsistency means users cannot enable network-policy via helm values without modifying the kustomization.yaml and regenerating.

Reproducing this issue

# Initialize project with helm/v2-alpha
kubebuilder init --plugins=helm/v2-alpha --domain example.com --repo github.com/example/test

# Verify both are commented in config/default/kustomization.yaml:
# - ../prometheus
# - ../network-policy

# Generate helm chart
kubebuilder edit --plugins=helm/v2-alpha

# Check values.yaml - prometheus exists, networkPolicy does not
grep -E "prometheus|networkPolicy|network" dist/chart/values.yaml
# Output: prometheus:
#         enable: false

# Check templates - monitoring exists, no network-policy
ls dist/chart/templates/
# No extras directory

KubeBuilder (CLI) Version

4.11.1

PROJECT version

3

Plugin versions

- go.kubebuilder.io/v4
- helm.kubebuilder.io/v2-alpha

Other versions

Go version: 1.24
controller-runtime: v0.21.0

Extra Labels

/kind regression

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.kind/featureCategorizes issue or PR as related to a new feature.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions