Skip to content

feat(chart): add podLabels for pod templates#158

Merged
krider2010 merged 1 commit into
mainfrom
codex/pod-labels-merged
Jun 17, 2026
Merged

feat(chart): add podLabels for pod templates#158
krider2010 merged 1 commit into
mainfrom
codex/pod-labels-merged

Conversation

@krider2010

Copy link
Copy Markdown
Collaborator

Summary

Adds top-level podLabels support 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 commonLabels support on main. Pod template labels are now rendered from one merged map, so overlapping commonLabels and podLabels keys do not produce duplicate YAML labels. For non-reserved user labels, podLabels wins on pod templates only.

Details

  • Adds podLabels: {} to values and schema with string-only label values.
  • Adds a pod label helper that preserves chart-managed selector and identity labels.
  • Rejects podLabels attempts to override chart-managed labels.
  • Documents that podLabels overrides commonLabels only on pod templates.

Validation

  • helm lint charts/n8n
  • Rendered the existing CI example matrix with helm template --dry-run=client.
  • Verified podLabels render on main, worker, and webhook-processor pod templates.
  • Verified overlapping commonLabels / podLabels emits one pod label with the podLabels value.
  • Verified reserved chart labels and non-string podLabels fail validation.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Re-trigger cubic

@krider2010 krider2010 merged commit f8c056c into main Jun 17, 2026
12 checks passed
@krider2010 krider2010 deleted the codex/pod-labels-merged branch June 17, 2026 16:25
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