Documentation ¶
Index ¶
- func ClusterRefsMatch(ref1, ref2 ClusterResourceId) bool
- func MakeClientObjectKey(ref ResourceId) client.ObjectKey
- func MakeClusterObjectRef(resource ClusterResourceId) *v1.ClusterObjectRef
- func MakeObjectRef(resource ResourceId) *v1.ObjectRef
- func NewEnsurer(restClient RestClient) *ensurer
- func NewRestClient(mgr manager.Manager) *restClient
- func RefsMatch(ref1, ref2 ResourceId) bool
- func UpdateResourceVersion(c RestClient, ctx context.Context, obj Object) error
- type ClusterResourceId
- type Ctl
- type Ensurer
- type List
- type ManagerGetter
- type Object
- type ReconcileFunc
- type ResourceId
- type RestClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterRefsMatch ¶ added in v0.7.17
func ClusterRefsMatch(ref1, ref2 ClusterResourceId) bool
func MakeClientObjectKey ¶ added in v0.7.17
func MakeClientObjectKey(ref ResourceId) client.ObjectKey
func MakeClusterObjectRef ¶
func MakeClusterObjectRef(resource ClusterResourceId) *v1.ClusterObjectRef
func MakeObjectRef ¶
func MakeObjectRef(resource ResourceId) *v1.ObjectRef
func NewEnsurer ¶
func NewEnsurer(restClient RestClient) *ensurer
Instantiate an Ensurer from a RestClient
func NewRestClient ¶
NewRestClient creates the root REST client used to interact with Kubernetes. Wraps the controller-runtime client.Client. TODO: option to skip cache reads
func RefsMatch ¶ added in v0.7.17
func RefsMatch(ref1, ref2 ResourceId) bool
func UpdateResourceVersion ¶
func UpdateResourceVersion(c RestClient, ctx context.Context, obj Object) error
Uses the provided client to update the resource of the object by retrieving it from the server
Types ¶
type ClusterResourceId ¶
ResourceId represents a global identifier for a k8s resource.
type Ctl ¶
type Ctl interface { Ensurer }
Ctl is a Control object for interacting with the Kubernetes API. Its meant as a generic, high-level abstraction over kubernetes client-go, similar to an in-process kubectl
type Ensurer ¶
type Ensurer interface { RestClient // optional reconcile funcs can be passed which determine how // a child object should be reconciled with the existing object // when it already exists in the cluster Ensure(ctx context.Context, parent Object, child Object, reconcileFuncs ...ReconcileFunc) error }
an Ensurer "ensures" that the given object will be created/applied to the cluster the object is applied after a resource version conflict. Warning: this can lead to race conditions if it is called asynchronously for the same resource. The ensured resource will have its controller reference set to the parent resource
type List ¶
type List interface { runtime.Object v1.ListInterface }
the EzKube Object is a wrapper for a kubernetes List object
type ManagerGetter ¶
Our manager returns a manager.Manager
type Object ¶
the EzKube Object is a wrapper for a kubernetes runtime.Object which contains Kubernetes metadata
type ReconcileFunc ¶
ReconcileFuncs are used to dynamically update existing objects on calls to Update and Ensure. ReconcileFuncs perform a comparison of the the existing object with the desired object prior to writing to kube storage.
The returned object will be applied to the cluster If a nil, nil is returned, the write will be skipped
type ResourceId ¶
ResourceId represents a global identifier for a k8s resource.
type RestClient ¶
type RestClient interface { ManagerGetter // the Object passed will be updated to match the server version. // only key (namespace/name) is required Get(ctx context.Context, obj Object) error // Object passed will be updated to match the server version. // Object should be a List object // example: // // Client.List(ctx, // client.InNamespace("my-namespace", // client.MatchingLabels{"app": "petstore"}) List(ctx context.Context, obj List, options ...client.ListOption) error // create the object passed Create(ctx context.Context, obj Object) error // update the object passed. does not update object subresources such as status. // // optional reconcile funcs can be passed which determine how // a child object should be reconciled with the existing object // when it already exists in the cluster Update(ctx context.Context, obj Object, reconcileFuncs ...ReconcileFunc) error // update the status of the object passed. UpdateStatus(ctx context.Context, obj Object) error // delete the object. only key (namespace/name) is required Delete(ctx context.Context, obj Object) error }
RestClient is a wrapper for the dynamic controller-runtime client.Client