Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromKubeConfig ¶
Types ¶
type Client ¶
type Client interface { Kubernetes() kubernetes.Interface Config() *rest.Config }
func NewKubernetesClient ¶
func NewKubernetesClient(config *rest.Config, client *kubernetes.Clientset) Client
NewKubernetesClient creates a KubernetesClient
type ListOption ¶
type ListOption interface { // ApplyToList applies this configuration to the given list options. ApplyToList(*ListOptions) }
ListOption is some configuration that modifies options for a list request.
type ListOptions ¶
type ListOptions struct { // LabelSelector filters results by label. Use SetLabelSelector to // set from raw string form. LabelSelector labels.Selector // FieldSelector filters results by a particular field. In order // to use this with cache-based implementations, restrict usage to // a single field-value pair that's been added to the indexers. FieldSelector fields.Selector // Namespace represents the namespace to list for, or empty for // non-namespaced objects, or to list across all namespaces. Namespace string // Limit specifies the maximum number of results to return from the server. The server may // not support this field on all resource types, but if it does and more results remain it // will set the continue field on the returned list object. This field is not supported if watch // is true in the Raw ListOptions. Limit int64 // Continue is a token returned by the server that lets a client retrieve chunks of results // from the server by specifying limit. The server may reject requests for continuation tokens // it does not recognize and will return a 410 error if the token can no longer be used because // it has expired. This field is not supported if watch is true in the Raw ListOptions. Continue string // Raw represents raw ListOptions, as passed to the API server. Note // that these may not be respected by all implementations of interface, // and the LabelSelector, FieldSelector, Limit and Continue fields are ignored. Raw *metav1.ListOptions }
ListOptions contains options for limiting or filtering results. It's generally a subset of metav1.ListOptions, with support for pre-parsed selectors (since generally, selectors will be executed against the cache).
type Object ¶
Object is a Kubernetes object, allows functions to work indistinctly with any resource that implements both Object interfaces.
Semantically, these are objects which are both serializable (runtime.Object) and identifiable (metav1.Object) -- think any object which you could write as YAML or JSON, and then `kubectl create`.
Code-wise, this means that any object which embeds both ObjectMeta (which provides metav1.Object) and TypeMeta (which provides half of runtime.Object) and has a `DeepCopyObject` implementation (the other half of runtime.Object) will implement this by default.
For example, nearly all the built-in types are Objects, as well as all KubeBuilder-generated CRDs (unless you do something real funky to them).
By and large, most things that implement runtime.Object also implement Object -- it's very rare to have *just* a runtime.Object implementation (the cases tend to be funky built-in types like Webhook payloads that don't have a `metadata` field).
Notice that XYZList types are distinct: they implement ObjectList instead.
type ObjectList ¶
type ObjectList interface { metav1.ListInterface runtime.Object }
ObjectList is a Kubernetes object list, allows functions to work indistinctly with any resource that implements both runtime.Object and metav1.ListInterface interfaces.
Semantically, this is any object which may be serialized (ObjectMeta), and is a kubernetes list wrapper (has items, pagination fields, etc) -- think the wrapper used in a response from a `kubectl list --output yaml` call.
Code-wise, this means that any object which embedds both ListMeta (which provides metav1.ListInterface) and TypeMeta (which provides half of runtime.Object) and has a `DeepCopyObject` implementation (the other half of runtime.Object) will implement this by default.
For example, nearly all the built-in XYZList types are ObjectLists, as well as the XYZList types for all KubeBuilder-generated CRDs (unless you do something real funky to them).
By and large, most things that are XYZList and implement runtime.Object also implement ObjectList -- it's very rare to have *just* a runtime.Object implementation (the cases tend to be funky built-in types like Webhook payloads that don't have a `metadata` field).
This is similar to Object, which is almost always implemented by the items in the list themselves.
type Reader ¶
type Reader interface { // Get retrieves an obj for the given object key from the Kubernetes Cluster. // obj must be a struct pointer so that obj can be updated with the response // returned by the Server. Get(ctx context.Context, key ObjectKey, obj Object) error // List retrieves list of objects for a given namespace and list options. On a // successful call, Items field in the list will be populated with the // result returned from the server. List(ctx context.Context, list ObjectList, opts ...ListOption) error }
Reader knows how to read and list Kubernetes objects.