Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 8, 2025

This PR implements support for the --kube-context flag across all helm-diff commands (upgrade, release, revision, rollback), providing a clean alternative to the existing HELM_KUBECONTEXT environment variable workaround.

Changes Made

Command Support:

  • Added --kube-context string flag to all four helm-diff commands
  • The flag accepts a kubeconfig context name and passes it to underlying helm commands

Implementation Details:

  • Added kubeContext field to all command structs (diffCmd, release, revision, rollback)
  • Updated all helm command execution functions to accept and pass the kube-context parameter:
    • getRelease(), getHooks(), getRevision(), getChart(), template(), writeExistingValues()
  • Follows the same implementation pattern as the existing --namespace flag

Usage Examples:

# Use specific kubeconfig context for upgrade
helm diff upgrade my-release stable/postgresql --kube-context production

# Works with all commands
helm diff release prod-release stage-release --kube-context staging
helm diff revision my-release 1 2 --kube-context development
helm diff rollback my-release 5 --kube-context production

Testing:

  • Added comprehensive unit tests to verify flag functionality
  • Integration tested to confirm kube-context is properly passed to helm subcommands
  • All existing tests continue to pass

Documentation:

  • Updated README.md with flag documentation and usage example
  • Added flag to the alphabetically ordered flags list

This enhancement improves discoverability and provides a consistent interface that matches standard helm command behavior, while maintaining backward compatibility with the existing HELM_KUBECONTEXT environment variable.

Fixes #603.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] [feature request] support for --kube-context Add --kube-context flag support to all helm-diff commands Sep 8, 2025
@Copilot Copilot AI requested a review from yxxhero September 8, 2025 01:29
Copilot finished work on behalf of yxxhero September 8, 2025 01:29
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.

[feature request] support for --kube-context
2 participants