From 4dcf624d6ab58ab847d2e1b7e57e88324bb7c59b Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期五, 02 六月 2023 16:25:45 +0800 Subject: [PATCH] fix --- client-go-release-1.20/tools/clientcmd/loader.go | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client-go-release-1.20/tools/clientcmd/loader.go b/client-go-release-1.20/tools/clientcmd/loader.go index 901ed50..393be12 100644 --- a/client-go-release-1.20/tools/clientcmd/loader.go +++ b/client-go-release-1.20/tools/clientcmd/loader.go @@ -120,7 +120,7 @@ // If the source file is present, then it is copied to the destination file BEFORE any further loading happens. MigrationRules map[string]string - // DoNotResolvePaths indicates whether or not to resolve paths with respect to the originating files. This is phrased as a negative so + // DoNotResolvePaths indicates whether to resolve paths with respect to the originating files. This is phrased as a negative so // that a default object that doesn't set this will usually get the behavior it wants. DoNotResolvePaths bool @@ -162,8 +162,10 @@ // Load starts by running the MigrationRules and then // takes the loading rules and returns a Config object based on following rules. -// if the ExplicitPath, return the unmerged explicit file -// Otherwise, return a merged config based on the Precedence slice +// +// if the ExplicitPath, return the unmerged explicit file +// Otherwise, return a merged config based on the Precedence slice +// // A missing ExplicitPath file produces an error. Empty filenames or other missing files are ignored. // Read errors or files with non-deserializable content produce errors. // The first file to set a particular map key wins and map key's value is never changed. @@ -171,7 +173,7 @@ // This results in some odd looking logic to merge in one direction, merge in the other, and then merge the two. // It also means that if two files specify a "red-user", only values from the first file's red-user are used. Even // non-conflicting entries from the second file's "red-user" are discarded. -// Relative paths inside of the .kubeconfig files are resolved against the .kubeconfig file's parent folder +// Relative paths inside the .kubeconfig files are resolved against the .kubeconfig file's parent folder // and only absolute file paths are returned. func (rules *ClientConfigLoadingRules) Load() (*clientcmdapi.Config, error) { if err := rules.Migrate(); err != nil { @@ -230,7 +232,7 @@ mergo.MergeWithOverwrite(mapConfig, kubeconfig) } - // merge all of the struct values in the reverse order so that priority is given correctly + // merge all the struct values in the reverse order so that priority is given correctly // errors are not added to the list the second time nonMapConfig := clientcmdapi.NewConfig() for i := len(kubeconfigs) - 1; i >= 0; i-- { @@ -273,7 +275,7 @@ if sourceInfo, err := os.Stat(source); err != nil { if os.IsNotExist(err) || os.IsPermission(err) { - // if the source file doesn't exist or we can't access it, there's no work to do. + // if the source file doesn't exist, or we can't access it, there's no work to do. continue } @@ -376,7 +378,7 @@ if err != nil { return nil, err } - klog.V(6).Infoln("Config loaded from file: ", filename) + //klog.V(6).Infoln("Config loaded from file: ", filename) // set LocationOfOrigin on every Cluster, User, and Context for key, obj := range config.AuthInfos { @@ -478,7 +480,7 @@ } // ResolveLocalPaths resolves all relative paths in the config object with respect to the stanza's LocationOfOrigin -// this cannot be done directly inside of LoadFromFile because doing so there would make it impossible to load a file without +// this cannot be done directly inside LoadFromFile because doing so there would make it impossible to load a file without // modification of its contents. func ResolveLocalPaths(config *clientcmdapi.Config) error { for _, cluster := range config.Clusters { -- Gitblit v1.8.0