diff --git a/tools/clientcmd/api/helpers_test.go b/tools/clientcmd/api/helpers_test.go index f823ef0f..1ae48cf2 100644 --- a/tools/clientcmd/api/helpers_test.go +++ b/tools/clientcmd/api/helpers_test.go @@ -225,7 +225,6 @@ func Example_minifyAndShorten() { // cluster: cow-cluster // user: red-user // current-context: federal-context - // preferences: {} // users: // red-user: // client-certificate-data: DATA+OMITTED diff --git a/tools/clientcmd/api/types.go b/tools/clientcmd/api/types.go index ae8b8c70..95b0b16d 100644 --- a/tools/clientcmd/api/types.go +++ b/tools/clientcmd/api/types.go @@ -40,7 +40,8 @@ type Config struct { // +optional APIVersion string `json:"apiVersion,omitempty"` // Preferences holds general information to be use for cli interactions - Preferences Preferences `json:"preferences"` + // Deprecated: this field is deprecated in v1.34. It is not used by any of the Kubernetes components. + Preferences Preferences `json:"preferences,omitzero"` // Clusters is a map of referencable names to cluster configs Clusters map[string]*Cluster `json:"clusters"` // AuthInfos is a map of referencable names to user configs @@ -55,6 +56,7 @@ type Config struct { } // IMPORTANT if you add fields to this struct, please update IsConfigEmpty() +// Deprecated: this structure is deprecated in v1.34. It is not used by any of the Kubernetes components. type Preferences struct { // +optional Colors bool `json:"colors,omitempty"` @@ -339,11 +341,10 @@ const ( // NewConfig is a convenience function that returns a new Config object with non-nil maps func NewConfig() *Config { return &Config{ - Preferences: *NewPreferences(), - Clusters: make(map[string]*Cluster), - AuthInfos: make(map[string]*AuthInfo), - Contexts: make(map[string]*Context), - Extensions: make(map[string]runtime.Object), + Clusters: make(map[string]*Cluster), + AuthInfos: make(map[string]*AuthInfo), + Contexts: make(map[string]*Context), + Extensions: make(map[string]runtime.Object), } } @@ -370,6 +371,7 @@ func NewAuthInfo() *AuthInfo { // NewPreferences is a convenience function that returns a new // Preferences object with non-nil maps +// Deprecated: this method is deprecated in v1.34. It is not used by any of the Kubernetes components. func NewPreferences() *Preferences { return &Preferences{Extensions: make(map[string]runtime.Object)} } diff --git a/tools/clientcmd/api/types_test.go b/tools/clientcmd/api/types_test.go index 21bb4c82..94742d3b 100644 --- a/tools/clientcmd/api/types_test.go +++ b/tools/clientcmd/api/types_test.go @@ -35,7 +35,6 @@ func Example_emptyConfig() { // clusters: {} // contexts: {} // current-context: "" - // preferences: {} // users: {} } diff --git a/tools/clientcmd/api/v1/types.go b/tools/clientcmd/api/v1/types.go index 5018a72b..f144e16e 100644 --- a/tools/clientcmd/api/v1/types.go +++ b/tools/clientcmd/api/v1/types.go @@ -37,7 +37,8 @@ type Config struct { // +optional APIVersion string `json:"apiVersion,omitempty"` // Preferences holds general information to be use for cli interactions - Preferences Preferences `json:"preferences"` + // Deprecated: this field is deprecated in v1.34. It is not used by any of the Kubernetes components. + Preferences Preferences `json:"preferences,omitzero"` // Clusters is a map of referencable names to cluster configs Clusters []NamedCluster `json:"clusters"` // AuthInfos is a map of referencable names to user configs @@ -51,6 +52,7 @@ type Config struct { Extensions []NamedExtension `json:"extensions,omitempty"` } +// Deprecated: this structure is deprecated in v1.34. It is not used by any of the Kubernetes components. type Preferences struct { // +optional Colors bool `json:"colors,omitempty"` diff --git a/tools/clientcmd/loader_test.go b/tools/clientcmd/loader_test.go index 778ef03c..e9d78bbe 100644 --- a/tools/clientcmd/loader_test.go +++ b/tools/clientcmd/loader_test.go @@ -309,7 +309,6 @@ contexts: name: "433e40" current-context: any-context-value kind: Config -preferences: {} users: null `) if !bytes.Equal(expected, data) { @@ -757,7 +756,6 @@ func Example_noMergingOnExplicitPaths() { // name: federal-context // current-context: "" // kind: Config - // preferences: {} // users: // - name: red-user // user: @@ -809,7 +807,6 @@ func Example_mergingSomeWithConflict() { // name: federal-context // current-context: federal-context // kind: Config - // preferences: {} // users: // - name: red-user // user: @@ -887,7 +884,6 @@ func Example_mergingEverythingNoConflicts() { // name: shaker-context // current-context: "" // kind: Config - // preferences: {} // users: // - name: black-user // user: