Skip to content

Fix SetCurrentContext to handle in-cluster configurations#112

Closed
Copilot wants to merge 3 commits intofeat/in-cluster-supportfrom
copilot/sub-pr-109-another-one
Closed

Fix SetCurrentContext to handle in-cluster configurations#112
Copilot wants to merge 3 commits intofeat/in-cluster-supportfrom
copilot/sub-pr-109-another-one

Conversation

Copy link

Copilot AI commented Feb 1, 2026

Description

SetCurrentContext attempted to update the kubeconfig file for all contexts, including in-cluster configurations where ConfigPath is empty. This caused file read errors when switching to in-cluster contexts.

Changes

  • cluster/manager.go: Added check to skip kubeconfig file update when ConfigPath is empty

    if contextInfo.ConfigPath != "" {
        if err := cm.updateKubeconfigCurrentContext(contextName, contextInfo.ConfigPath); err != nil {
            return fmt.Errorf("failed to update kubeconfig file: %w", err)
        }
    }
  • cluster/manager_test.go: Added test testSetCurrentContextWithEmptyConfigPath to verify context switching works for in-cluster configurations

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

💡 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 AI and others added 2 commits February 1, 2026 12:32
Co-authored-by: basebandit <8973567+basebandit@users.noreply.github.com>
Co-authored-by: basebandit <8973567+basebandit@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues based on feedback for in-cluster support Fix SetCurrentContext to handle in-cluster configurations Feb 1, 2026
Copilot AI requested a review from basebandit February 1, 2026 12:35
@basebandit basebandit closed this Feb 1, 2026
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.

2 participants