feat(helm): make gateway chart pod/service metadata and scheduling configurable#2181
feat(helm): make gateway chart pod/service metadata and scheduling configurable#2181renuka-fernando wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (12)
📝 WalkthroughOverviewThis PR enhances the gateway Helm chart by making pod-, service-, and resource-level metadata and scheduling/resource knobs configurable. It also fixes Helm rendering correctness issues for labels and annotations by centralizing string-map rendering and enforcing consistent merge/precedence rules across resources. Bug Fixes
New Helm Chart ConfigurationPod/Deployment scheduling & runtime knobsAdded support for:
Service tunablesExtended controller and gateway-runtime Services with configurable networking/load-balancing fields, including:
Metadata behavior applied broadly
Implementation Changes
ValidationChart rendering was validated with
Files Modified
WalkthroughThis pull request enhances the API Gateway Helm chart with a standardized metadata rendering system and expanded Kubernetes resource configuration options. Core helper templates ( Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@kubernetes/helm/gateway-helm-chart/README.md`:
- Line 129: The README incorrectly references the ConfigMap values path as
gateway.controller.configMap; update the documentation to use the actual values
key gateway.configMap so user overrides are applied (leave the reference to
gateway.controller.persistence as-is for PVCs), i.e., replace occurrences of
gateway.controller.configMap with gateway.configMap in the README content.
🪄 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
Run ID: b545aa1d-d5c1-4915-8cf4-23d120c50560
📒 Files selected for processing (17)
kubernetes/helm/gateway-helm-chart/README.mdkubernetes/helm/gateway-helm-chart/templates/_helpers.tplkubernetes/helm/gateway-helm-chart/templates/gateway/controller/certificate.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/controller/deployment.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/controller/hpa.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/controller/issuer.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/controller/pdb.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/controller/pvc.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/controller/service.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-config.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/deployment.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/hpa.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/llm-pricing-configmap.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/pdb.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/service.yamlkubernetes/helm/gateway-helm-chart/templates/serviceaccount.yamlkubernetes/helm/gateway-helm-chart/values.yaml
…nfigurable Add pod-, service-, and resource-level customization knobs to the gateway-helm-chart and fix two label/annotation rendering bugs. Bugs fixed: - Duplicate label keys when the same key appears in commonLabels and a component's deployment.labels/podLabels (rejected by strict parsers and GitOps tools). Labels are now merged with a clear precedence. - Inconsistent annotation precedence: per-resource annotations now win over commonAnnotations consistently at both resource and pod level. New configuration (controller + gateway-runtime): - topologySpreadConstraints, deployment strategy, terminationGracePeriodSeconds, hostAliases, dnsPolicy/dnsConfig, pod-level automountServiceAccountToken - optional startupProbe (controller template + documented runtime value) - service tunables: clusterIP, externalTrafficPolicy, loadBalancerClass, loadBalancerSourceRanges, ipFamilyPolicy/ipFamilies, static nodePorts (type-gated to capable Service types) - app.kubernetes.io/name added to the standard label set - PVC labels/annotations (e.g. helm.sh/resource-policy: keep) - commonLabels/commonAnnotations now applied to every rendered resource (ServiceAccount, HPAs, PDBs, PVC, Certificate, Issuer, ConfigMaps) Validated with helm lint + helm template (default, values-local, and a conflict-heavy values file): no duplicate keys, correct precedence, selector labels protected from override, type-gated service fields, value coercion.
The Configuration section referenced gateway.controller.configMap, but the values key is gateway.configMap (sibling of gateway.controller). Using the documented path would not apply user overrides.
cb0b40a to
a03137d
Compare
Purpose
The
gateway-helm-chartdid not expose several pod-, service-, and resource-level customization knobs that customer setups commonly require, and it had two correctness bugs in how labels and annotations were rendered. This PR adds the missing configuration and fixes the rendering bugs.Approach
Bugs fixed
commonLabelsand a component'sdeployment.labels/podLabelsrendered duplicate YAML map keys (rejected by strict parsers and GitOps tools like ArgoCD/kubeconform). Labels are now merged with a clear precedence instead of appended.commonAnnotationsconsistently at both resource and pod level (previouslycommonAnnotationssilently won at resource level).New configuration support (controller + gateway-runtime)
topologySpreadConstraints, deploymentstrategy,terminationGracePeriodSeconds,hostAliases,dnsPolicy/dnsConfig, and pod-levelautomountServiceAccountToken.startupProbe(controller template had no support; runtime value was undocumented).clusterIP,externalTrafficPolicy,loadBalancerClass,loadBalancerSourceRanges,ipFamilyPolicy/ipFamilies, and staticnodePorts.*(type-gated so they only render on capable Service types).app.kubernetes.io/nameadded to the standard label set.labels/annotations(e.g.helm.sh/resource-policy: keep).commonLabels/commonAnnotationsnow applied to every resource the chart renders (ServiceAccount, HPAs, PDBs, PVC, Certificate, Issuer, and the ConfigMaps were previously missed), with per-resource values winning on key conflicts.Out of scope:
extraContainers/sidecar injection on the gateway-runtime pod (tracked separately in #2180-adjacent work).Validation
All validation done with
helm lint+helm template(default values,values-local.yaml, and a conflict-heavy values file).helm lint(dev-mode + values-local)mainbaseline (default values)app.kubernetes.io/namelabel, alphabetical label ordering, SAautomountServiceAccountToken: truespec.selector+ pod-label content vs baselinehelm upgradesafe, no immutable-selector errorcommonLabels/commonAnnotations> standard, everywherepodLabels: {app.kubernetes.io/name: evil}cannot override selector labelschecksum/configpod annotationcommonAnnotationscoveragenum: 123/flag: truerender as"123"/"true"helm.sh/resource-policy: keep)nodePorts: null)Sample input (conflict-heavy values used for validation)
Sample output (rendered artifacts)
Controller Deployment — merged labels (no duplicates, specific wins, values coerced),
app.kubernetes.io/nameadded, pod checksum protected:Gateway-runtime Service (LoadBalancer) — commonLabels/commonAnnotations applied + new network tunables:
PVC — commonLabels/commonAnnotations + own labels/annotations:
ServiceAccount — commonLabels applied, commonAnnotations applied (specific wins) + automount knob:
Related Issues
Related #2179
Remarks
Behavior change for reviewers: resource-level annotation precedence flipped — per-resource annotations now win over
commonAnnotationson key conflicts (previouslycommonAnnotationssilently won). Pod-level behavior is unchanged.Checklist