feat(chart): add podLabels for pod templates#158
Merged
Conversation
3 tasks
Contributor
There was a problem hiding this comment.
No issues found across 7 files
Architecture diagram
sequenceDiagram
participant User as Helm User
participant Helm as Helm CLI
participant Chart as n8n Chart
participant Helper as _helpers.tpl
participant Schema as values.schema.json
participant Values as values.yaml
participant MainDep as main Deployment
participant WorkerDep as worker Deployment
participant WebhookDep as webhook-processor Deployment
Note over User,WebhookDep: NEW: PodLabels Flow
User->>Helm: helm install/upgrade with podLabels values
Helm->>Chart: Process chart templates with values
alt podLabels defined in user values
Chart->>Schema: Validate podLabels structure
Schema-->>Chart: All values are strings (or fails)
Chart->>Helper: Call n8n.podLabels (root, component)
Helper->>Helper: Merge label sources
Note over Helper: Priority order: commonLabels base → chart managed → podLabels (wins)
alt podLabels contains reserved keys
Helper->>Helper: Validation fails with error
Helper-->>Chart: Fail chart rendering
Chart-->>Helm: Error: cannot override managed label
else podLabels has non-string values
Helper->>Helper: Validation fails with error
Helper-->>Chart: Fail chart rendering
Chart-->>Helm: Error: must be string type
else podLabels valid
Helper-->>Chart: Return merged label map
end
end
Chart->>MainDep: Render pod template labels (component: main)
MainDep->>Helper: Include n8n.podLabels with merged labels
Helper-->>MainDep: Final label set
MainDep-->>Chart: Pod template with labels
Chart->>WorkerDep: Render pod template labels (component: worker)
WorkerDep->>Helper: Include n8n.podLabels with merged labels
Helper-->>WorkerDep: Final label set
WorkerDep-->>Chart: Pod template with labels
Chart->>WebhookDep: Render pod template labels (component: webhook-processor)
WebhookDep->>Helper: Include n8n.podLabels with merged labels
Helper-->>WebhookDep: Final label set
WebhookDep-->>Chart: Pod template with labels
Chart-->>Helm: Rendered YAML manifests
Helm-->>User: Deployed with pod labels
Note over User,WebhookDep: Key behavior: podLabels overrides commonLabels on pods only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds top-level
podLabelssupport for the n8n Helm chart pod templates, covering main, worker, and webhook-processor Deployments.This supersedes #119 with a merged implementation that works with the current
commonLabelssupport onmain. Pod template labels are now rendered from one merged map, so overlappingcommonLabelsandpodLabelskeys do not produce duplicate YAML labels. For non-reserved user labels,podLabelswins on pod templates only.Details
podLabels: {}to values and schema with string-only label values.podLabelsattempts to override chart-managed labels.podLabelsoverridescommonLabelsonly on pod templates.Validation
helm lint charts/n8nhelm template --dry-run=client.podLabelsrender on main, worker, and webhook-processor pod templates.commonLabels/podLabelsemits one pod label with thepodLabelsvalue.podLabelsfail validation.