Add --only-new flag to optimize kubeconfig updates#1024
Draft
Add --only-new flag to optimize kubeconfig updates#1024
Conversation
You're out of free credits.You can fix that by putting in a card here. |
Co-authored-by: mateimicu <4560298+mateimicu@users.noreply.github.com>
Co-authored-by: mateimicu <4560298+mateimicu@users.noreply.github.com>
Co-authored-by: mateimicu <4560298+mateimicu@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add flag to optimize kubeconfig update process
Add --only-new flag to optimize kubeconfig updates
Oct 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the issue where the
updatecommand would always export all EKS clusters to kubeconfig, even if they were already present. This resulted in unnecessary updates and potential kubeconfig bloat.Changes
This PR adds a new
--only-newflag to theaws updatecommand that enables selective cluster export. When enabled, the command will:IsExported()methodUsage
When using
--only-new, the output will show:Implementation Details
The implementation leverages the existing
kubeconfig.IsExported()method which checks if a cluster with the same endpoint already exists in a context. This maintains consistency with the existing "exported locally" logic used in thelistcommand.The change is backward compatible - the default behavior remains unchanged, and the new flag is opt-in.
Testing
Test_onlyNewFlagLogicthat validates the filtering behaviorCloses #[issue_number]
Original prompt
Fixes #43
💡 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.