[FEAT cloudctl] - Improved AuthInfo merging and deduplication logic
Labels
- feature
- enhancement
- kubeconfig
Priority
(Medium) I'm annoyed but I'll live
User Story
As a user with many clusters sharing the same OIDC provider, I want cloudctl to minimize the number of duplicate users in my kubeconfig, so that it remains readable and manageable.
Description
The current authInfoEqual and generateAuthInfoKey logic in cmd/sync.go handles basic deduplication by comparing core credential fields while ignoring volatile tokens. However, as the number of clusters grows, the deduplication should be more robust. It should specifically focus on:
- Preferring existing user names in the local kubeconfig if the credentials match exactly.
- Handling a wider range of
kubelogin arguments and ensuring they are consistently ordered during comparison.
- Improving the readability of the comparison logic, potentially moving it to a dedicated package or utility.
Acceptance Criteria
Reference Issues
None
[FEAT cloudctl] - Improved AuthInfo merging and deduplication logic
Labels
Priority
(Medium) I'm annoyed but I'll live
User Story
Description
The current
authInfoEqualandgenerateAuthInfoKeylogic incmd/sync.gohandles basic deduplication by comparing core credential fields while ignoring volatile tokens. However, as the number of clusters grows, the deduplication should be more robust. It should specifically focus on:kubeloginarguments and ensuring they are consistently ordered during comparison.Acceptance Criteria
authInfoEqualandgenerateAuthInfoKeyincmd/sync.gofor better readability and extensibility.mergeKubeconfigto prefer existing user names from the local config when a matchingAuthInfois found.ExecConfigfields (Env, InteractiveMode, etc.) are considered in the comparison if they affect authentication.cmd/sync_test.gocovering edge cases like identical credentials with different user names.maps.Equaland other modern Go 1.25 idioms for cleaner comparisons.Reference Issues
None