Skip to content

Add pod.labels support to all helm charts - #258

Open
kavindasr wants to merge 2 commits into
wso2:mainfrom
kavindasr:port-pod-labels-main
Open

Add pod.labels support to all helm charts#258
kavindasr wants to merge 2 commits into
wso2:mainfrom
kavindasr:port-pod-labels-main

Conversation

@kavindasr

Copy link
Copy Markdown
Contributor

Purpose

Port of #174 (merged to 4.6.x) so that wso2.deployment.pod.labels is available on this branch too.

Goals

Add wso2.deployment.pod.labels configuration to all WSO2 APIM helm charts, enabling users to set custom labels for pod organization, monitoring, cost allocation, and policy enforcement.

Approach

Added pod.labels: {} to values.yaml and updated the deployment templates to merge custom labels with the default labels in all 5 charts:

  • all-in-one (2 instances)
  • distributed/control-plane (2 instances)
  • distributed/gateway
  • distributed/key-manager
  • distributed/traffic-manager (2 instances)

Implementation follows the existing pod.annotations pattern for consistency.

Template changes:

labels:
  deployment: {{ template "chart.fullname" . }}
  product: apim
  {{- if .Values.wso2.deployment.pod.labels }}
  {{- toYaml .Values.wso2.deployment.pod.labels | nindent 8 }}
  {{- end }}

Usage example:

wso2:
  deployment:
    pod:
      annotations:
        prometheus.io/scrape: "true"
      labels:
        team: platform
        environment: production
        cost-center: engineering

Release note

Added support for custom pod labels via wso2.deployment.pod.labels configuration in all helm charts.

Documentation

README.md files for all 5 charts regenerated with helm-docs (v1.14.2).

Automation tests

  • Unit tests: N/A (helm charts)
  • Integration tests: helm lint passes for all 5 charts; helm template verified with both default values (output identical to before) and custom pod.labels (labels correctly merged into the pod template).

Security checks

Related PRs

Migrations (if applicable)

N/A - Backward compatible. Default value is an empty map {}, producing identical output to previous versions.

Test environment

  • Helm 3.x
  • helm-docs 1.14.2

Port of wso2#174 (merged to 4.6.x).

Adds wso2.deployment.pod.labels to all five charts, allowing custom
labels to be merged into the pod template labels alongside the default
deployment/node/product labels. Follows the existing
wso2.deployment.pod.annotations pattern.

READMEs regenerated with helm-docs.
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kavindasr, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 19135e03-ea3d-4bf1-8b6c-8da2a85ecd2a

📥 Commits

Reviewing files that changed from the base of the PR and between f42e518 and 5ff25a2.

📒 Files selected for processing (24)
  • all-in-one/README.md
  • all-in-one/values.yaml
  • distributed/control-plane/README.md
  • distributed/control-plane/values.yaml
  • distributed/gateway/README.md
  • distributed/gateway/values.yaml
  • distributed/key-manager/README.md
  • distributed/key-manager/values.yaml
  • distributed/traffic-manager/README.md
  • distributed/traffic-manager/values.yaml
  • resources/am-pattern-0-all-in-one/default_values.yaml
  • resources/am-pattern-1-all-in-one-HA/default_values.yaml
  • resources/am-pattern-2-all-in-one_GW/default_gw_values.yaml
  • resources/am-pattern-2-all-in-one_GW/default_values.yaml
  • resources/am-pattern-3-ACP_TM_GW/default_acp_values.yaml
  • resources/am-pattern-3-ACP_TM_GW/default_gw_values.yaml
  • resources/am-pattern-3-ACP_TM_GW/default_tm_values.yaml
  • resources/am-pattern-4-ACP_TM_GW_KM/default_acp_values.yaml
  • resources/am-pattern-4-ACP_TM_GW_KM/default_gw_values.yaml
  • resources/am-pattern-4-ACP_TM_GW_KM/default_km_values.yaml
  • resources/am-pattern-4-ACP_TM_GW_KM/default_tm_values.yaml
  • resources/am-pattern-5-all-in-one_GW_KM/default_gw_values.yaml
  • resources/am-pattern-5-all-in-one_GW_KM/default_km_values.yaml
  • resources/am-pattern-5-all-in-one_GW_KM/default_values.yaml
📝 Walkthrough

Walkthrough

The Helm charts add optional pod label maps, defaulting to {}, alongside existing pod annotations. Deployment templates conditionally render configured labels into pod template metadata using toYaml with appropriate indentation. The all-in-one and distributed chart README values tables document the new configuration.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: adding pod.labels support across Helm charts.
Description check ✅ Passed The description covers the required Purpose, Goals, Approach, Release note, docs, tests, security, related PRs, migrations, and test environment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@all-in-one/templates/am/instance-1/wso2am-deployment.yaml`:
- Around line 45-47: Protect the built-in selector labels from being overridden
by custom labels in all three deployment templates:
all-in-one/templates/am/instance-1/wso2am-deployment.yaml lines 45-47,
all-in-one/templates/am/instance-2/wso2am-deployment.yaml lines 46-48, and
distributed/control-plane/templates/control-plane/instance-1/wso2am-cp-deployment.yaml
lines 48-50. Update the custom-label rendering in each template so required
instance or control-plane selector keys retain their built-in values while
non-reserved custom labels are applied.

In
`@distributed/control-plane/templates/control-plane/instance-2/wso2am-cp-deployment.yaml`:
- Around line 49-51: Protect chart-owned selector labels from user overrides in
the label blocks of
distributed/control-plane/templates/control-plane/instance-2/wso2am-cp-deployment.yaml
(49-51), distributed/gateway/templates/gateway/wso2am-gateway-deployment.yaml
(49-51), distributed/key-manager/templates/key-manager/wso2am-km-deployment.yaml
(53-55),
distributed/traffic-manager/templates/traffic-manager/instance-1/wso2am-tm-deployment.yaml
(51-53), and
distributed/traffic-manager/templates/traffic-manager/instance-2/wso2am-tm-deployment.yaml
(52-54). Update the `toYaml .Values.wso2.deployment.pod.labels` merging or
validation so custom labels cannot override `deployment` and `product`, and also
`node` in the control-plane and both traffic-manager templates, while preserving
all other user labels.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e046f06-4105-45c8-b27d-d348e6fce272

📥 Commits

Reviewing files that changed from the base of the PR and between 041cc61 and f42e518.

📒 Files selected for processing (18)
  • all-in-one/README.md
  • all-in-one/templates/am/instance-1/wso2am-deployment.yaml
  • all-in-one/templates/am/instance-2/wso2am-deployment.yaml
  • all-in-one/values.yaml
  • distributed/control-plane/README.md
  • distributed/control-plane/templates/control-plane/instance-1/wso2am-cp-deployment.yaml
  • distributed/control-plane/templates/control-plane/instance-2/wso2am-cp-deployment.yaml
  • distributed/control-plane/values.yaml
  • distributed/gateway/README.md
  • distributed/gateway/templates/gateway/wso2am-gateway-deployment.yaml
  • distributed/gateway/values.yaml
  • distributed/key-manager/README.md
  • distributed/key-manager/templates/key-manager/wso2am-km-deployment.yaml
  • distributed/key-manager/values.yaml
  • distributed/traffic-manager/README.md
  • distributed/traffic-manager/templates/traffic-manager/instance-1/wso2am-tm-deployment.yaml
  • distributed/traffic-manager/templates/traffic-manager/instance-2/wso2am-tm-deployment.yaml
  • distributed/traffic-manager/values.yaml

Comment thread all-in-one/templates/am/instance-1/wso2am-deployment.yaml
- Note in each chart's values.yaml that the Deployment selector keys
  (`deployment`, plus `node` where the chart uses it) must not be
  overridden via wso2.deployment.pod.labels. READMEs regenerated with
  helm-docs.
- Add the wso2.deployment.pod block (annotations + labels) to all 14
  pattern values files under resources/, which had been out of sync
  with the charts since the pod.annotations refactor.
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.

1 participant