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:
Kubernetes Prow Robot
2020-01-10 11:56:35 -08:00
committed by GitHub
2 changed files with 13 additions and 1 deletions

View File

@@ -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
}

View File

@@ -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: