Skip to content

feat: add support for helm v4 --server-side flag#1021

Merged
yxxhero merged 3 commits into
masterfrom
feat/server-side-flag
Jun 16, 2026
Merged

feat: add support for helm v4 --server-side flag#1021
yxxhero merged 3 commits into
masterfrom
feat/server-side-flag

Conversation

@yxxhero

@yxxhero yxxhero commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add support for the Helm v4 --server-side upgrade flag, as requested in #1020.

The flag accepts "true", "false", or "auto" (default "auto"), matching helm v4 upgrade exactly.

Changes

  • cmd/upgrade.go: Added --server-side flag (StringVar, default "auto") with input validation in RunE.
  • cmd/helm.go: Forward the flag to helm when running Helm v4:
    • helm upgrade --dry-run (HELM_DIFF_USE_UPGRADE_DRY_RUN=true): forward all values including "auto".
    • helm template: forward only "true"/"false" — template registers --server-side as a bool (default true) that rejects "auto".
    • Helm v3: flag is accepted but not forwarded (does not exist).
  • README.md: Documented the flag in alphabetical order in both command sections.
  • Tests: Added TestServerSideFlagValidation and TestGetServerSideFlags.

Notes

  • The flag has no effect on manifest rendering in dry-run mode — both helm template and helm upgrade --dry-run bail out before the apply step where ServerSideApply is consulted. It is forwarded for semantic correctness and wrapper compatibility.
  • Single isHelmVersionGreaterThanEqual call (no redundant subprocess invocations).

Closes #1020

yxxhero added 2 commits June 16, 2026 11:13
Add the --server-side flag to , matching helm v4's
upgrade command. The flag accepts "true", "false", or "auto" (default
"auto") and is forwarded to helm when running Helm v4:

-  (HELM_DIFF_USE_UPGRADE_DRY_RUN=true): all
  values including "auto" are forwarded.
- : only "true"/"false" are forwarded, since template
  registers --server-side as a bool (default true) that does not accept
  "auto".

The flag is Helm v4 only — it is accepted but not forwarded when running
Helm v3 (the flag does not exist there).

Note: --server-side has no effect on manifest rendering in dry-run mode.
It is forwarded for semantic correctness and wrapper compatibility so
that helm-diff can be used with the same flags as .

Closes #1020

Signed-off-by: yxxhero <aiopsclub@163.com>
The engineerd/setup-kind@v0.6.2 tag points to a commit that lacks the
compiled dist/main/index.js entry point, causing all integration test
jobs to fail with:
  File not found: '.../setup-kind/v0.6.2/dist/main/index.js'

Switch to helm/kind-action@v1.14.0, the official Helm project kind
action, which properly commits its build artifacts.

Signed-off-by: yxxhero <aiopsclub@163.com>

@databus23 databus23 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nice PR overall, the feature is correct and well-documented. One minor suggestion on test structure:

TestGetServerSideFlags tests a standalone getServerSideFlags() helper defined in the test file that mirrors the production logic in (*diffCmd).template(). If the two ever diverge, the test still passes. It's testing a reimplementation, not the real code.

A cleaner approach: extract the inline switch block in template() into a package-level function (e.g. serverSideFlags(isHelmV4 bool, useUpgradeDryRun bool, serverSide string) []string), then call it from both template() and the test. That way the test exercises the actual production path.

Per review feedback, extract the inline switch block from template()
into a package-level serverSideFlags(isHelmV4, useUpgradeDryRun,
serverSide) function. The test now calls the production function
directly instead of a test-only mirror.

Signed-off-by: yxxhero <aiopsclub@163.com>
@yxxhero yxxhero merged commit 734c260 into master Jun 16, 2026
25 checks passed
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.

Please add support for the helm4 upgrade flag " --server-side"

2 participants