mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
Use ID instead of Name in v1beta1 & 2
This commit is contained in:
parent
5619fb2f45
commit
ab9346d107
@ -624,5 +624,29 @@ func init() {
|
|||||||
}
|
}
|
||||||
return s.Convert(&in.Items, &out.Items, 0)
|
return s.Convert(&in.Items, &out.Items, 0)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Object ID <-> Name
|
||||||
|
// TODO: amend the conversion package to allow overriding specific fields.
|
||||||
|
func(in *ObjectReference, out *newer.ObjectReference, s conversion.Scope) error {
|
||||||
|
out.Kind = in.Kind
|
||||||
|
out.Namespace = in.Namespace
|
||||||
|
out.Name = in.ID
|
||||||
|
out.UID = in.UID
|
||||||
|
out.APIVersion = in.APIVersion
|
||||||
|
out.ResourceVersion = in.ResourceVersion
|
||||||
|
out.FieldPath = in.FieldPath
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
func(in *newer.ObjectReference, out *ObjectReference, s conversion.Scope) error {
|
||||||
|
out.ID = in.Name
|
||||||
|
out.Kind = in.Kind
|
||||||
|
out.Namespace = in.Namespace
|
||||||
|
out.ID = in.Name
|
||||||
|
out.UID = in.UID
|
||||||
|
out.APIVersion = in.APIVersion
|
||||||
|
out.ResourceVersion = in.ResourceVersion
|
||||||
|
out.FieldPath = in.FieldPath
|
||||||
|
return nil
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -683,7 +683,7 @@ type ServerOpList struct {
|
|||||||
type ObjectReference struct {
|
type ObjectReference struct {
|
||||||
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
||||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
ID string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||||
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
|
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
|
||||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||||
ResourceVersion string `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
ResourceVersion string `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
||||||
|
@ -574,5 +574,29 @@ func init() {
|
|||||||
}
|
}
|
||||||
return s.Convert(&in.Items, &out.Items, 0)
|
return s.Convert(&in.Items, &out.Items, 0)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Object ID <-> Name
|
||||||
|
// TODO: amend the conversion package to allow overriding specific fields.
|
||||||
|
func(in *ObjectReference, out *newer.ObjectReference, s conversion.Scope) error {
|
||||||
|
out.Kind = in.Kind
|
||||||
|
out.Namespace = in.Namespace
|
||||||
|
out.Name = in.ID
|
||||||
|
out.UID = in.UID
|
||||||
|
out.APIVersion = in.APIVersion
|
||||||
|
out.ResourceVersion = in.ResourceVersion
|
||||||
|
out.FieldPath = in.FieldPath
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
func(in *newer.ObjectReference, out *ObjectReference, s conversion.Scope) error {
|
||||||
|
out.ID = in.Name
|
||||||
|
out.Kind = in.Kind
|
||||||
|
out.Namespace = in.Namespace
|
||||||
|
out.ID = in.Name
|
||||||
|
out.UID = in.UID
|
||||||
|
out.APIVersion = in.APIVersion
|
||||||
|
out.ResourceVersion = in.ResourceVersion
|
||||||
|
out.FieldPath = in.FieldPath
|
||||||
|
return nil
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ type ServerOpList struct {
|
|||||||
type ObjectReference struct {
|
type ObjectReference struct {
|
||||||
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
||||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
ID string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||||
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
|
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
|
||||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||||
ResourceVersion string `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
ResourceVersion string `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user