mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Use ID instead of Name in v1beta1 & 2
This commit is contained in:
		@@ -624,5 +624,29 @@ func init() {
 | 
			
		||||
			}
 | 
			
		||||
			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 {
 | 
			
		||||
	Kind            string `json:"kind,omitempty" yaml:"kind,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"`
 | 
			
		||||
	APIVersion      string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
 | 
			
		||||
	ResourceVersion string `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
 | 
			
		||||
 
 | 
			
		||||
@@ -574,5 +574,29 @@ func init() {
 | 
			
		||||
			}
 | 
			
		||||
			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 {
 | 
			
		||||
	Kind            string `json:"kind,omitempty" yaml:"kind,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"`
 | 
			
		||||
	APIVersion      string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
 | 
			
		||||
	ResourceVersion string `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user