#1721

feat(helm): add podLabels support to the agent and gateway charts

Openananhagyahyawants to merge intofrom

What

Add a podLabels value (default {}) to every pod template in the agent and gateway charts, merged in alongside the hardcoded app: selector label. This mirrors the existing podAnnotations pattern.

Why

Both charts hardcode only app: hoop* in their pod templates and expose no way to add pod labels, so labels applied out-of-band with kubectl label pod … are silently reverted on the next helm upgrade when pods cycle. Today the only workaround is forking the chart.

Common use-cases for pod labels:

  • Team/ownership labels for observability and cost attribution
  • Prometheus podMonitor / serviceMonitor selectors
  • Kubernetes NetworkPolicy pod selectors

Implementation

The selector label is deliberately protected. spec.selector.matchLabels is immutable and fixed to app: hoop*, so allowing a caller to set podLabels.app would emit a duplicate app key that shadows it and make Kubernetes reject the Deployment. omit drops that one reserved key:

labels:
  app: hoopagent
{{- with omit .Values.podLabels "app" }}
  {{- toYaml . | nindent 8 }}
{{- end }}

Changes

FileValuePod
chart/agent/values.yaml + templates/deployment.yamlpodLabelshoopagent
chart/gateway/values.yaml + templates/deployment.yamlpodLabelshoopgateway
chart/gateway/templates/deployment-postgres.yamlpostgres.podLabelshoopgateway-pg
chart/gateway/templates/presidio-deployment.yamldataMasking.analyzer.podLabelspresidio-analyzer
chart/gateway/templates/presidio-deployment.yamldataMasking.anonymizer.podLabelspresidio-anonymizer

The per-component values are namespaced to match where each pod's other settings already live (postgres.*, dataMasking.analyzer.*), rather than having one global key leak into subcomponent pods.

Example

# gateway values.yaml
podLabels:
  team: platform
dataMasking:
  analyzer:
    podLabels:
      team: platform

Compatibility

Non-breaking: every podLabels key defaults to {}, so rendered output is byte-identical for existing installs. Diff is +30/-0 across 6 files, with no existing lines modified.

Activity

9
github-actions[bot]2mo ago

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

qodo-code-review[bot]2mo ago

PR Summary by Qodo

Add configurable pod labels to agent and gateway Helm charts

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

AI Description

• Exposes optional pod labels across agent, gateway, PostgreSQL, and Presidio workloads.
• Preserves fixed app selector labels by filtering conflicting user-provided app values.
• Defaults label maps to empty for backward-compatible Helm rendering.
Diagram

graph TD
  AV["Agent values"] --> AT["Agent template"] --> AP["Agent pod"]
  GV["Gateway values"] --> GT["Gateway templates"] --> GW["Gateway pod"]
  GT --> PG["Postgres pod"]
  GT --> PR["Presidio pods"]
High-Level Assessment

The current approach is appropriate: it mirrors the established podAnnotations configuration pattern, scopes labels to their owning components, and uses omit to prevent callers from overriding the immutable app selector relationship. A single global label map was considered but would undesirably leak labels into optional subcomponent pods.

Files changed (6) +30 / -0

Enhancement (4) +15 / -0
deployment.yamlRender configurable labels on agent pods +3/-0

Render configurable labels on agent pods

• Merges values from podLabels into the agent pod template metadata. The reserved app key is omitted so the pod label continues matching the Deployment selector.

deploy/helm-chart/chart/agent/templates/deployment.yaml

deployment-postgres.yamlRender component-scoped labels on PostgreSQL pods +3/-0

Render component-scoped labels on PostgreSQL pods

• Applies postgres.podLabels to the bundled PostgreSQL pod template while filtering the protected app label.

deploy/helm-chart/chart/gateway/templates/deployment-postgres.yaml

deployment.yamlRender configurable labels on gateway pods +3/-0

Render configurable labels on gateway pods

• Merges top-level podLabels into gateway pod metadata without allowing the fixed app selector label to be overridden.

deploy/helm-chart/chart/gateway/templates/deployment.yaml

presidio-deployment.yamlRender separate labels on Presidio pods +6/-0

Render separate labels on Presidio pods

• Adds independently configurable labels to the Presidio analyzer and anonymizer pod templates. Both paths omit app to preserve their Deployment selector labels.

deploy/helm-chart/chart/gateway/templates/presidio-deployment.yaml

Other (2) +15 / -0
values.yamlDefine the agent podLabels value +4/-0

Define the agent podLabels value

• Adds an empty podLabels map beside the existing pod annotation settings, preserving existing rendered output by default.

deploy/helm-chart/chart/agent/values.yaml

values.yamlDefine gateway and subcomponent pod label values +11/-0

Define gateway and subcomponent pod label values

• Adds empty podLabels maps for the gateway, bundled PostgreSQL, Presidio analyzer, and Presidio anonymizer workloads. Component-specific namespaces prevent labels from leaking across workloads.

deploy/helm-chart/chart/gateway/values.yaml

qodo-code-review[bot]2mo ago

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


1. Envoy pods lack label support ✓ Resolved 🐞 Bug ≡ Correctness
Description
The new component-specific values cover the Presidio analyzer and anonymizer but omit
dataMasking.envoyProxy.podLabels, so labels cannot be applied to the presidio-envoy-proxy pods.
Data-masking installations therefore cannot consistently use custom pod labels for selectors,
ownership, or observability across all gateway-chart pods.
Code

deploy/helm-chart/chart/gateway/values.yaml[R75-76]

+    # -- Additional labels to add to the presidio-analyzer pod
+    podLabels: {}
Relevance

●●● Strong

PR explicitly promises labels on every pod; Envoy is omitted, making this a direct completeness bug.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The chart defines Envoy proxy settings under dataMasking.envoyProxy, but unlike the newly updated
analyzer and anonymizer sections, that component has no podLabels value. Its Deployment pod
template still contains only the fixed app: presidio-envoy-proxy label and does not merge any
configurable labels.

deploy/helm-chart/chart/gateway/values.yaml[75-76] deploy/helm-chart/chart/gateway/values.yaml[95-96] deploy/helm-chart/chart/gateway/values.yaml[106-118] deploy/helm-chart/chart/gateway/templates/presidio-envoy-proxy.yaml[13-18]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The gateway chart adds component-specific pod labels for the Presidio analyzer and anonymizer but leaves the Presidio Envoy proxy Deployment without configurable pod labels.

## Issue Context
The Envoy proxy is another pod-producing component under `dataMasking.envoyProxy`. Add a `podLabels: {}` default there and merge it into the proxy pod template while omitting the reserved `app` selector label.

## Fix Focus Areas
- deploy/helm-chart/chart/gateway/values.yaml[106-118]
- deploy/helm-chart/chart/gateway/templates/presidio-envoy-proxy.yaml[13-18]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Context
✅ Compliance rules (platform): 39 rules
✅ Cross-repo context — repo relationships
  Explored: repo: hoophq/infra (sha: 673728f8)
  Explored: repo: hoophq/documentation (sha: 5ce11675)
Tip of the day
💡 Did you know, you can keep summaries lean with Finding overflow, which tucks the rest behind 'View more'

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

qodo-code-review[bot]reviewed2mo ago
ananhagyahya2mo ago

I have read the CLA Document and I hereby sign the CLA

ananhagyahyareviewed2mo ago