mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-12-01 07:26:05 +07:00
Merge pull request #1243 from BenTheElder/merge-other-fields
use kind's other kubeconfig fields if none are set in the existing co…
This commit is contained in:
@@ -98,5 +98,14 @@ func merge(existing, kind *Config) error {
|
||||
// set the current context
|
||||
existing.CurrentContext = kind.CurrentContext
|
||||
|
||||
// TODO: We should not need this, but it allows broken clients that depend
|
||||
// on apiVersion and kind to work. Notably the upstream javascript client.
|
||||
// See: https://github.com/kubernetes-sigs/kind/issues/1242
|
||||
if len(existing.OtherFields) == 0 {
|
||||
// TODO: Should we be deep-copying? for now we don't need to
|
||||
// and doing so would be a pain (re and de-serialize maybe?) :shrug:
|
||||
existing.OtherFields = kind.OtherFields
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -423,7 +423,8 @@ func testWriteMergedNoExistingFile(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to read merged kubeconfig: %v", err)
|
||||
}
|
||||
expected := `clusters:
|
||||
expected := `apiVersion: v1
|
||||
clusters:
|
||||
- cluster:
|
||||
certificate-authority-data: definitelyacert
|
||||
server: https://127.0.0.1:6443
|
||||
@@ -434,6 +435,8 @@ contexts:
|
||||
user: kind-kind
|
||||
name: kind-kind
|
||||
current-context: kind-kind
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-kind
|
||||
user:
|
||||
|
||||
Reference in New Issue
Block a user