pipe-cd / pipe-cd/pipecd

Add config validation for KubernetesApplicationSpec in pipedv1

Open
#7,142 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement
Dominant language
Go
Stars
1.4k
Forks
364
Avg merge
1d 4h
Merged PRs (30d)
84

Description

What would you like to be added:

Implement proper validation for KubernetesApplicationSpec in the pipedv1 Kubernetes plugin (pkg/app/pipedv1/plugin/kubernetes/config), replacing the current // TODO: Validate KubernetesApplicationSpec fields. stub.

Validation should cover at least:

  1. Mutually exclusive input options

    • Reject configs that set both input.helmChart and input.kustomizeOptions.
  2. Traffic routing method

    • When trafficRouting is set, allow only supported methods ("", podselector, istio) and fail clearly on unknown values.
  3. Variant labels

    • Require non-empty variantLabel.key, primaryValue, canaryValue, and baselineValue.
    • Require primaryValue, canaryValue, and baselineValue to be unique.

Add unit tests for valid configs, each failure case, and that JSON unmarshaling applies defaults so a minimal {} spec remains valid after defaults are set.

Why is this needed:

Invalid Kubernetes application configs are currently accepted and only fail later during plan/sync (or produce confusing progressive-delivery behavior). Early validation:

  • Surfaces configuration mistakes immediately with actionable error messages.
  • Prevents impossible combinations (e.g. Helm chart + Kustomize options).
  • Protects progressive delivery by ensuring variant labels and traffic-routing method are usable before a deployment starts.
  • Aligns the single-cluster Kubernetes plugin with existing validation patterns used by other plugins (e.g. multicluster Kubernetes, analysis, terraform).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pkg/app/pipedv1/plugin/kubernetes/config at the TODO for KubernetesApplicationSpec validation, and compare validation patterns in the multicluster Kubernetes, analysis, and terraform plugins. Add tests for valid defaults, mutually exclusive Helm and Kustomize inputs, supported traffic-routing methods, and variant-label requirements; run the package tests and confirm minimal JSON defaults remain valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
devops, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.