Deprecate kubeconfig's preference field in favor of kuberc

Signed-off-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: 8cf5e8db78deb186ef362f64ab779c09e9520156
This commit is contained in:
Maciej Szulik 2025-05-13 13:39:13 +02:00 committed by Kubernetes Publisher
parent 025e06660a
commit 5334fcaa9c
5 changed files with 11 additions and 13 deletions

View File

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

View File

@ -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,7 +341,6 @@ 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),
@ -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)}
}

View File

@ -35,7 +35,6 @@ func Example_emptyConfig() {
// clusters: {}
// contexts: {}
// current-context: ""
// preferences: {}
// users: {}
}

View File

@ -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"`

View File

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