Documentation
¶
Index ¶
- func NewRuntimeClientFromFileName(kubeConfigFilename string) (client.Client, error)
- func ObjectsToRuntimeObjects[T runtime.Object](objs []T) []runtime.Object
- type Client
- type ClientFactory
- type DeleteAllOfOption
- type DeleteAllOfOptions
- type KubeconfigClient
- func (c *KubeconfigClient) Create(ctx context.Context, obj Object) error
- func (c *KubeconfigClient) Delete(ctx context.Context, obj Object) error
- func (c *KubeconfigClient) DeleteAllOf(ctx context.Context, obj Object, opts ...DeleteAllOfOption) error
- func (c *KubeconfigClient) Get(ctx context.Context, name, namespace string, obj Object) error
- func (c *KubeconfigClient) List(ctx context.Context, list ObjectList) error
- func (c *KubeconfigClient) Update(ctx context.Context, obj Object) error
- type Kubectl
- type KubectlDeleteOption
- type KubectlDeleteOptions
- type KubectlGetOption
- type KubectlGetOptions
- type Object
- type ObjectList
- type Reader
- type UnAuthClient
- func (c *UnAuthClient) Apply(ctx context.Context, kubeconfig string, obj runtime.Object) error
- func (c *UnAuthClient) BuildClientFromKubeconfig(kubeconfig string) (Client, error)
- func (c *UnAuthClient) Create(ctx context.Context, kubeconfig string, obj Object) error
- func (c *UnAuthClient) Delete(ctx context.Context, kubeconfig string, obj Object) error
- func (c *UnAuthClient) DeleteAllOf(ctx context.Context, kubeconfig string, obj Object, opts ...DeleteAllOfOption) error
- func (c *UnAuthClient) Get(ctx context.Context, name, namespace, kubeconfig string, obj runtime.Object) error
- func (c *UnAuthClient) Init() error
- func (c *UnAuthClient) KubeconfigClient(kubeconfig string) Client
- func (c *UnAuthClient) List(ctx context.Context, kubeconfig string, list ObjectList) error
- func (c *UnAuthClient) Update(ctx context.Context, kubeconfig string, obj Object) error
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRuntimeClientFromFileName ¶ added in v0.14.0
NewRuntimeClientFromFileName creates a new controller runtime client given a kubeconfig filename.
Types ¶
type ClientFactory ¶ added in v0.15.0
type ClientFactory struct{}
ClientFactory builds clients from a kubeconfig file by wrapping around NewRuntimeClientFromFileName to facilitate mocking.
func (ClientFactory) BuildClientFromKubeconfig ¶ added in v0.15.0
func (f ClientFactory) BuildClientFromKubeconfig(kubeconfigPath string) (client.Client, error)
BuildClientFromKubeconfig builds a K8s client from a kubeconfig file.
type DeleteAllOfOption ¶ added in v0.15.2
type DeleteAllOfOption interface { // ApplyToDeleteAllOf applies this configuration to the given deletecollection options. ApplyToDeleteAllOf(*DeleteAllOfOptions) }
DeleteAllOfOption is some configuration that modifies options for a delete request.
type DeleteAllOfOptions ¶ added in v0.15.2
type DeleteAllOfOptions struct { // HasLabels filters results by label and value. The requirement is an AND match // for all labels. HasLabels map[string]string // Namespace represents the namespace to list for, or empty for // non-namespaced objects, or to list across all namespaces. Namespace string }
DeleteAllOfOptions contains options for deletecollection (deleteallof) requests.
func (*DeleteAllOfOptions) ApplyToDeleteAllOf ¶ added in v0.15.2
func (o *DeleteAllOfOptions) ApplyToDeleteAllOf(do *DeleteAllOfOptions)
ApplyToDeleteAllOf implements DeleteAllOfOption.
type KubeconfigClient ¶
type KubeconfigClient struct {
// contains filtered or unexported fields
}
KubeconfigClient is an authenticated kubernetes API client it authenticates using the credentials of a kubeconfig file.
func NewKubeconfigClient ¶
func NewKubeconfigClient(client *UnAuthClient, kubeconfig string) *KubeconfigClient
func (*KubeconfigClient) Create ¶ added in v0.15.2
func (c *KubeconfigClient) Create(ctx context.Context, obj Object) error
Create saves the object obj in the Kubernetes cluster.
func (*KubeconfigClient) Delete ¶ added in v0.15.2
func (c *KubeconfigClient) Delete(ctx context.Context, obj Object) error
Delete deletes the given obj from Kubernetes cluster.
func (*KubeconfigClient) DeleteAllOf ¶ added in v0.15.2
func (c *KubeconfigClient) DeleteAllOf(ctx context.Context, obj Object, opts ...DeleteAllOfOption) error
DeleteAllOf deletes all objects of the given type matching the given options.
func (*KubeconfigClient) Get ¶
Get performs a GET call to the kube API server and unmarshalls the response into the provided Object.
func (*KubeconfigClient) List ¶ added in v0.15.2
func (c *KubeconfigClient) List(ctx context.Context, list ObjectList) error
List retrieves list of objects. On a successful call, Items field in the list will be populated with the result returned from the server.
type Kubectl ¶ added in v0.15.2
type Kubectl interface { Get(ctx context.Context, resourceType, kubeconfig string, obj runtime.Object, opts ...KubectlGetOption) error Create(ctx context.Context, kubeconfig string, obj runtime.Object) error Replace(ctx context.Context, kubeconfig string, obj runtime.Object) error Apply(ctx context.Context, kubeconfig string, obj runtime.Object) error Delete(ctx context.Context, resourceType, kubeconfig string, opts ...KubectlDeleteOption) error }
Kubectl is a client implemented with the kubectl binary.
type KubectlDeleteOption ¶ added in v0.15.2
type KubectlDeleteOption interface { // ApplyToDelete applies this configuration to the given delete options. ApplyToDelete(*KubectlDeleteOptions) }
KubectlDeleteOption is some configuration that modifies options for a get request.
type KubectlDeleteOptions ¶ added in v0.15.2
type KubectlDeleteOptions struct { // Name specifies the name of a resource. Use to delete a single resource. // If set, Namespace is required. Name string // Namespace specifies the namespace to delete objects from. If not set, // all namespaces will be used. Namespace string // HasLabels applies a filter using labels to the objects to be deleted. // When multiple label-value pairs are specified, the condition is an AND // for all of them. If specified, Name should be empty. HasLabels map[string]string }
KubectlDeleteOptions contains options for delete commands.
func (*KubectlDeleteOptions) ApplyToDelete ¶ added in v0.15.2
func (o *KubectlDeleteOptions) ApplyToDelete(kdo *KubectlDeleteOptions)
ApplyToDelete applies this configuration to the given delete options.
type KubectlGetOption ¶ added in v0.15.2
type KubectlGetOption interface { // ApplyToGet applies this configuration to the given get options. ApplyToGet(*KubectlGetOptions) }
KubectlGetOption is some configuration that modifies options for a get request.
type KubectlGetOptions ¶ added in v0.15.2
type KubectlGetOptions struct { // Name specifies the name of a resource. If set, only one single resource // will be returned (at most). If set, Namespace is required. Name string // Namespace specifies the namespace to retrieve objects from. If not set, // all namespaces will be used. Namespace string // ClusterScoped identifies the resourced as no namespaced. This is mutually exclusive with // Namespace and requires to also specify a Name. ClusterScoped *bool }
KubectlGetOptions contains options for get commands.
func (*KubectlGetOptions) ApplyToGet ¶ added in v0.15.2
func (o *KubectlGetOptions) ApplyToGet(kgo *KubectlGetOptions)
ApplyToGet applies this configuration to the given get options.
type ObjectList ¶ added in v0.12.0
type ObjectList client.ObjectList
ObjectList is a Kubernetes object list.
type Reader ¶ added in v0.15.2
type Reader interface { // Get retrieves an obj for the given name and namespace from the Kubernetes Cluster. Get(ctx context.Context, name, namespace string, obj Object) error // List retrieves list of objects. 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) error }
Reader knows how to read and list Kubernetes objects.
type UnAuthClient ¶
type UnAuthClient struct {
// contains filtered or unexported fields
}
UnAuthClient is a generic kubernetes API client that takes a kubeconfig file on every call in order to authenticate.
func NewUnAuthClient ¶
func NewUnAuthClient(kubectl Kubectl) *UnAuthClient
NewUnAuthClient builds a new UnAuthClient.
func (*UnAuthClient) Apply ¶ added in v0.12.0
Apply performs an upsert in the form of a client-side apply.
func (*UnAuthClient) BuildClientFromKubeconfig ¶ added in v0.15.2
func (c *UnAuthClient) BuildClientFromKubeconfig(kubeconfig string) (Client, error)
BuildClientFromKubeconfig returns an equivalent authenticated client. It will never return an error but this helps satisfy a generic factory interface where errors are possible. It's basically an alias to KubeconfigClient.
func (*UnAuthClient) Create ¶ added in v0.15.2
Create saves the object obj in the Kubernetes cluster.
func (*UnAuthClient) DeleteAllOf ¶ added in v0.15.2
func (c *UnAuthClient) DeleteAllOf(ctx context.Context, kubeconfig string, obj Object, opts ...DeleteAllOfOption) error
DeleteAllOf deletes all objects of the given type matching the given options.
func (*UnAuthClient) Get ¶
func (c *UnAuthClient) Get(ctx context.Context, name, namespace, kubeconfig string, obj runtime.Object) error
Get performs a GET call to the kube API server authenticating with a kubeconfig file and unmarshalls the response into the provdied Object.
func (*UnAuthClient) Init ¶
func (c *UnAuthClient) Init() error
Init initializes the client internal API scheme It has always be invoked at least once before making any API call It is not thread safe.
func (*UnAuthClient) KubeconfigClient ¶
func (c *UnAuthClient) KubeconfigClient(kubeconfig string) Client
KubeconfigClient returns an equivalent authenticated client.
func (*UnAuthClient) List ¶ added in v0.15.2
func (c *UnAuthClient) List(ctx context.Context, kubeconfig string, list ObjectList) error
List retrieves list of objects. On a successful call, Items field in the list will be populated with the result returned from the server.
type Writer ¶ added in v0.15.2
type Writer interface { // Create saves the object obj in the Kubernetes cluster. Create(ctx context.Context, obj Object) error // Update updates the given obj in the Kubernetes cluster. Update(ctx context.Context, obj Object) error // Delete deletes the given obj from Kubernetes cluster. Delete(ctx context.Context, obj Object) error // DeleteAllOf deletes all objects of the given type matching the given options. DeleteAllOf(ctx context.Context, obj Object, opts ...DeleteAllOfOption) error }
Writer knows how to create, delete, and update Kubernetes objects.