mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-11 20:09:47 +00:00
Stop using mergo.MergeWithOverwrite
Use the recommended replacement instead. Kubernetes-commit: 243a9b204e14dc9c92f08cd3252c31731b9532fd
This commit is contained in:
committed by
Kubernetes Publisher
parent
277eea62aa
commit
6d09f8e62e
@@ -226,7 +226,7 @@ func (rules *ClientConfigLoadingRules) Load() (*clientcmdapi.Config, error) {
|
||||
mapConfig := clientcmdapi.NewConfig()
|
||||
|
||||
for _, kubeconfig := range kubeconfigs {
|
||||
mergo.MergeWithOverwrite(mapConfig, kubeconfig)
|
||||
mergo.Merge(mapConfig, kubeconfig, mergo.WithOverride)
|
||||
}
|
||||
|
||||
// merge all of the struct values in the reverse order so that priority is given correctly
|
||||
@@ -234,14 +234,14 @@ func (rules *ClientConfigLoadingRules) Load() (*clientcmdapi.Config, error) {
|
||||
nonMapConfig := clientcmdapi.NewConfig()
|
||||
for i := len(kubeconfigs) - 1; i >= 0; i-- {
|
||||
kubeconfig := kubeconfigs[i]
|
||||
mergo.MergeWithOverwrite(nonMapConfig, kubeconfig)
|
||||
mergo.Merge(nonMapConfig, kubeconfig, mergo.WithOverride)
|
||||
}
|
||||
|
||||
// since values are overwritten, but maps values are not, we can merge the non-map config on top of the map config and
|
||||
// get the values we expect.
|
||||
config := clientcmdapi.NewConfig()
|
||||
mergo.MergeWithOverwrite(config, mapConfig)
|
||||
mergo.MergeWithOverwrite(config, nonMapConfig)
|
||||
mergo.Merge(config, mapConfig, mergo.WithOverride)
|
||||
mergo.Merge(config, nonMapConfig, mergo.WithOverride)
|
||||
|
||||
if rules.ResolvePaths() {
|
||||
if err := ResolveLocalPaths(config); err != nil {
|
||||
|
Reference in New Issue
Block a user