No way to ignore duplicate cluster when loading config
Describe the bug
When loading the kubernetes configuration, there is no way to ignore duplicate cluster entries. I think this is a bug or a missing feature, since kubectl seems to work fine when there are duplicate cluster entries.
** Client Version **
0.19.0
** Server Version **
1.26.6
To Reproduce
Have multiple config files configured using KUBECONFIG. Have an identical cluster in both config files.
Then, invoke new KubeConfig().loadFromDefault().
Expected behavior
new KubeConfig().loadFromDefault() should filter duplicate entries, or provide an option in the parameters to filter out duplicate entries.
** Example Code**
new KubeConfig().loadFromDefault()
Environment (please complete the following information):
- OS: Linux
- NodeJS Version: 18
- Cloud runtime: ??? I have an OpenShift cluster
Additional context none
This client doesn't support multiple config files in general (see the code here: https://github.com/kubernetes-client/javascript/blob/master/src/config.ts#L129)
The logic for loading from multiple files is complicated and not specified anywhere except for in the Golang client. It probably should never have been a feature of kubectl but it's too late for that now.
If you write a PR with comprehensive unit tests that mimics the behavior of the golang code, we can consider accepting it into this client library, but it is unlikely to be implemented otherwise.
Okay, thanks for the response. I'll work within this limitation for my use case.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Reopen this issue with
/reopen - Mark this issue as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.