deepcopy: add interface deepcopy funcs

- add DeepCopyObject() to runtime.Object interface
- add DeepCopyObject() via deepcopy-gen
- add DeepCopyObject() manually
- add DeepCopySelector() to selector interfaces
- add custom DeepCopy func for TableRow.Cells
This commit is contained in:
Dr. Stefan Schimanski
2017-07-06 10:59:05 +02:00
parent 774560085e
commit 39d95b9b06
135 changed files with 1063 additions and 12 deletions

View File

@@ -417,6 +417,7 @@ const (
// +genclient=true
// +nonNamespaced=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PersistentVolume struct {
metav1.TypeMeta
@@ -483,6 +484,8 @@ type PersistentVolumeStatus struct {
Reason string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PersistentVolumeList struct {
metav1.TypeMeta
// +optional
@@ -491,6 +494,7 @@ type PersistentVolumeList struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
type PersistentVolumeClaim struct {
@@ -507,6 +511,8 @@ type PersistentVolumeClaim struct {
Status PersistentVolumeClaimStatus
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PersistentVolumeClaimList struct {
metav1.TypeMeta
// +optional
@@ -1839,6 +1845,8 @@ const (
RestartPolicyNever RestartPolicy = "Never"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodList is a list of Pods.
type PodList struct {
metav1.TypeMeta
@@ -2356,6 +2364,8 @@ type PodStatus struct {
ContainerStatuses []ContainerStatus
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
type PodStatusResult struct {
metav1.TypeMeta
@@ -2368,6 +2378,7 @@ type PodStatusResult struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
type Pod struct {
@@ -2397,6 +2408,7 @@ type PodTemplateSpec struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodTemplate describes a template for creating copies of a predefined pod.
type PodTemplate struct {
@@ -2409,6 +2421,8 @@ type PodTemplate struct {
Template PodTemplateSpec
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodTemplateList is a list of PodTemplates.
type PodTemplateList struct {
metav1.TypeMeta
@@ -2502,6 +2516,7 @@ type ReplicationControllerCondition struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ReplicationController represents the configuration of a replication controller.
type ReplicationController struct {
@@ -2519,6 +2534,8 @@ type ReplicationController struct {
Status ReplicationControllerStatus
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ReplicationControllerList is a collection of replication controllers.
type ReplicationControllerList struct {
metav1.TypeMeta
@@ -2534,6 +2551,8 @@ const (
ClusterIPNone = "None"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ServiceList holds a list of services.
type ServiceList struct {
metav1.TypeMeta
@@ -2732,6 +2751,7 @@ type ServicePort struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Service is a named abstraction of software service (for example, mysql) consisting of local port
// (for example 3306) that the proxy listens on, and the selector that determines which pods
@@ -2751,6 +2771,7 @@ type Service struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ServiceAccount binds together:
// * a name, understood by users, and perhaps by peripheral systems, for an identity
@@ -2776,6 +2797,8 @@ type ServiceAccount struct {
AutomountServiceAccountToken *bool
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ServiceAccountList is a list of ServiceAccount objects
type ServiceAccountList struct {
metav1.TypeMeta
@@ -2786,6 +2809,7 @@ type ServiceAccountList struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Endpoints is a collection of endpoints that implement the actual service. Example:
// Name: "mysvc",
@@ -2855,6 +2879,8 @@ type EndpointPort struct {
Protocol Protocol
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// EndpointsList is a list of endpoints.
type EndpointsList struct {
metav1.TypeMeta
@@ -3126,6 +3152,7 @@ type ResourceList map[ResourceName]resource.Quantity
// +genclient=true
// +nonNamespaced=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Node is a worker node in Kubernetes
// The name of the node according to etcd is in ObjectMeta.Name.
@@ -3143,6 +3170,8 @@ type Node struct {
Status NodeStatus
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// NodeList is a list of nodes.
type NodeList struct {
metav1.TypeMeta
@@ -3186,6 +3215,7 @@ const (
// +genclient=true
// +nonNamespaced=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// A namespace provides a scope for Names.
// Use of multiple namespaces is optional
@@ -3203,6 +3233,8 @@ type Namespace struct {
Status NamespaceStatus
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// NamespaceList is a list of Namespaces.
type NamespaceList struct {
metav1.TypeMeta
@@ -3212,6 +3244,8 @@ type NamespaceList struct {
Items []Namespace
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Binding ties one object to another; for example, a pod is bound to a node by a scheduler.
// Deprecated in 1.7, please use the bindings subresource of pods instead.
type Binding struct {
@@ -3245,6 +3279,8 @@ const (
DeletePropagationForeground DeletionPropagation = "Foreground"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// DeleteOptions may be provided when deleting an API object
// DEPRECATED: This type has been moved to meta/v1 and will be removed soon.
type DeleteOptions struct {
@@ -3276,6 +3312,8 @@ type DeleteOptions struct {
PropagationPolicy *DeletionPropagation
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ListOptions is the query options to a standard REST list call, and has future support for
// watch calls.
// DEPRECATED: This type has been moved to meta/v1 and will be removed soon.
@@ -3303,6 +3341,8 @@ type ListOptions struct {
TimeoutSeconds *int64
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodLogOptions is the query options for a Pod's logs REST call
type PodLogOptions struct {
metav1.TypeMeta
@@ -3335,6 +3375,8 @@ type PodLogOptions struct {
LimitBytes *int64
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodAttachOptions is the query options to a Pod's remote attach call
// TODO: merge w/ PodExecOptions below for stdin, stdout, etc
type PodAttachOptions struct {
@@ -3361,6 +3403,8 @@ type PodAttachOptions struct {
Container string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodExecOptions is the query options to a Pod's remote exec call
type PodExecOptions struct {
metav1.TypeMeta
@@ -3384,6 +3428,8 @@ type PodExecOptions struct {
Command []string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodPortForwardOptions is the query options to a Pod's port forward call
type PodPortForwardOptions struct {
metav1.TypeMeta
@@ -3393,6 +3439,8 @@ type PodPortForwardOptions struct {
Ports []int32
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodProxyOptions is the query options to a Pod's proxy call
type PodProxyOptions struct {
metav1.TypeMeta
@@ -3401,6 +3449,8 @@ type PodProxyOptions struct {
Path string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// NodeProxyOptions is the query options to a Node's proxy call
type NodeProxyOptions struct {
metav1.TypeMeta
@@ -3409,6 +3459,8 @@ type NodeProxyOptions struct {
Path string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ServiceProxyOptions is the query options to a Service's proxy call.
type ServiceProxyOptions struct {
metav1.TypeMeta
@@ -3422,6 +3474,7 @@ type ServiceProxyOptions struct {
}
// ObjectReference contains enough information to let you inspect or modify the referred object.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ObjectReference struct {
// +optional
Kind string
@@ -3454,6 +3507,8 @@ type LocalObjectReference struct {
Name string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type SerializedReference struct {
metav1.TypeMeta
// +optional
@@ -3478,6 +3533,7 @@ const (
)
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Event is a report of an event somewhere in the cluster.
// TODO: Decide whether to store these separately or with the object they apply to.
@@ -3523,6 +3579,8 @@ type Event struct {
Type string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// EventList is a list of events.
type EventList struct {
metav1.TypeMeta
@@ -3532,6 +3590,8 @@ type EventList struct {
Items []Event
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// List holds a list of objects, which may not be known by the server.
type List struct {
metav1.TypeMeta
@@ -3582,6 +3642,7 @@ type LimitRangeSpec struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LimitRange sets resource usage limits for each kind of resource in a Namespace
type LimitRange struct {
@@ -3594,6 +3655,8 @@ type LimitRange struct {
Spec LimitRangeSpec
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LimitRangeList is a list of LimitRange items.
type LimitRangeList struct {
metav1.TypeMeta
@@ -3672,6 +3735,7 @@ type ResourceQuotaStatus struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ResourceQuota sets aggregate quota restrictions enforced per namespace
type ResourceQuota struct {
@@ -3688,6 +3752,8 @@ type ResourceQuota struct {
Status ResourceQuotaStatus
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ResourceQuotaList is a list of ResourceQuota items
type ResourceQuotaList struct {
metav1.TypeMeta
@@ -3699,6 +3765,7 @@ type ResourceQuotaList struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Secret holds secret data of a certain type. The total bytes of the values in
// the Data field must be less than MaxSecretSize bytes.
@@ -3803,6 +3870,8 @@ const (
TLSPrivateKeyKey = "tls.key"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type SecretList struct {
metav1.TypeMeta
// +optional
@@ -3812,6 +3881,7 @@ type SecretList struct {
}
// +genclient=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ConfigMap holds configuration data for components or applications to consume.
type ConfigMap struct {
@@ -3825,6 +3895,8 @@ type ConfigMap struct {
Data map[string]string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ConfigMapList is a resource containing a list of ConfigMap objects.
type ConfigMapList struct {
metav1.TypeMeta
@@ -3895,6 +3967,7 @@ type ComponentCondition struct {
// +genclient=true
// +nonNamespaced=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
type ComponentStatus struct {
@@ -3906,6 +3979,8 @@ type ComponentStatus struct {
Conditions []ComponentCondition
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ComponentStatusList struct {
metav1.TypeMeta
// +optional
@@ -3969,6 +4044,8 @@ type SELinuxOptions struct {
Level string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// RangeAllocation is an opaque API object (not exposed to end users) that can be persisted to record
// the global allocation state of the cluster. The schema of Range and Data generic, in that Range
// should be a string representation of the inputs to a range (for instance, for IP allocation it