@@ -21,15 +21,56 @@ import (
21
21
"k8s.io/apimachinery/pkg/runtime"
22
22
)
23
23
24
- // Object is a Kubernetes object, allows functions to work indistinctly with any resource that
25
- // implements both Object interfaces.
24
+ // Object is a Kubernetes object, allows functions to work indistinctly with
25
+ // any resource that implements both Object interfaces.
26
+ //
27
+ // Semantically, these are objects which are both serializable (runtime.Object)
28
+ // and identifiable (metav1.Object) -- think any object which you could write
29
+ // as YAML or JSON, and then `kubectl create`.
30
+ //
31
+ // Code-wise, this means that any object which embeds both ObjectMeta (which
32
+ // provides metav1.Object) and TypeMeta (which provides half of runtime.Object)
33
+ // and has a `DeepCopyObject` implementation (the other half of runtime.Object)
34
+ // will implement this by default.
35
+ //
36
+ // For example, nearly all the built-in types are Objects, as well as all
37
+ // KubeBuilder-generated CRDs (unless you do something real funky to them).
38
+ //
39
+ // By and large, most things that implement runtime.Object also implement
40
+ // Object -- it's very rare to have *just* a runtime.Object implementation (the
41
+ // cases tend to be funky built-in types like Webhook payloads that don't have
42
+ // a `metadata` field).
43
+ //
44
+ // Notice that XYZList types are distinct: they implement ObjectList instead.
26
45
type Object interface {
27
46
metav1.Object
28
47
runtime.Object
29
48
}
30
49
31
- // ObjectList is a Kubernetes object list, allows functions to work indistinctly with any resource that
32
- // implements both runtime.Object and metav1.ListInterface interfaces.
50
+ // ObjectList is a Kubernetes object list, allows functions to work
51
+ // indistinctly with any resource that implements both runtime.Object and
52
+ // metav1.ListInterface interfaces.
53
+ //
54
+ // Semantically, this is any object which may be serialized (ObjectMeta), and
55
+ // is a kubernetes list wrapper (has items, pagination fields, etc) -- think
56
+ // the wrapper used in a response from a `kubectl list --output yaml` call.
57
+ //
58
+ // Code-wise, this means that any object which embedds both ListMeta (which
59
+ // provides metav1.ListInterface) and TypeMeta (which provides half of
60
+ // runtime.Object) and has a `DeepCopyObject` implementation (the other half of
61
+ // runtime.Object) will implement this by default.
62
+ //
63
+ // For example, nearly all the built-in XYZList types are ObjectLists, as well
64
+ // as the XYZList types for all KubeBuilder-generated CRDs (unless you do
65
+ // something real funky to them).
66
+ //
67
+ // By and large, most things that are XYZList and implement runtime.Object also
68
+ // implement ObjectList -- it's very rare to have *just* a runtime.Object
69
+ // implementation (the cases tend to be funky built-in types like Webhook
70
+ // payloads that don't have a `metadata` field).
71
+ //
72
+ // This is similar to Object, which is almost always implemented by the items
73
+ // in the list themselves.
33
74
type ObjectList interface {
34
75
metav1.ListInterface
35
76
runtime.Object
0 commit comments