client

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyOpts

type ApplyOpts struct {
	// force allows to ignore checks and force the operation
	Force bool

	// autoApprove allows to skip the interactive approval
	AutoApprove bool
}

ApplyOpts allow to specify additional parameter for apply operations

type Client

type Client interface {
	// Get the specified object(s) from the cluster
	Get(namespace, kind, name string) (manifest.Manifest, error)
	GetByLabels(namespace string, labels map[string]interface{}) (manifest.List, error)

	// Apply the configuration to the cluster. `data` must contain a plaintext
	// format that is `kubectl-apply(1)` compatible
	Apply(data manifest.List, opts ApplyOpts) error

	// DiffServerSide runs the diff operation on the server and returns the
	// result in `diff(1)` format
	DiffServerSide(data manifest.List) (*string, error)

	// Delete the specified object(s) from the cluster
	Delete(namespace, kind, name string, opts DeleteOpts) error
	DeleteByLabels(namespace string, labels map[string]interface{}, opts DeleteOpts) error

	// Namespaces the cluster currently has
	Namespaces() (map[string]bool, error)

	// Info returns known informational data about the client. Best effort based,
	// fields of `Info` that cannot be stocked with valuable data, e.g.
	// due to an error, shall be left nil.
	Info() (*Info, error)
}

Client for working with Kubernetes

type DeleteOpts

type DeleteOpts ApplyOpts

DeleteOpts allow to specify additional parameters for delete operations Currently not different from ApplyOpts, but may be required in the future

type ErrorNotFound

type ErrorNotFound struct {
	// contains filtered or unexported fields
}

ErrorNotFound means that the requested object is not found on the server

func (ErrorNotFound) Error

func (e ErrorNotFound) Error() string

type ErrorUnknownResource

type ErrorUnknownResource struct {
	// contains filtered or unexported fields
}

ErrorUnknownResource means that the requested resource type is unknown to the server

func (ErrorUnknownResource) Error

func (e ErrorUnknownResource) Error() string

type FilterWriter

type FilterWriter []*regexp.Regexp

FilterWriter is an io.Writer that discards every message that matches at least one of the regular expressions.

func (FilterWriter) Write

func (r FilterWriter) Write(p []byte) (n int, err error)

type Info

type Info struct {
	// version of `kubectl`
	ClientVersion *semver.Version

	// version of the API server
	ServerVersion *semver.Version

	// used context and cluster from KUBECONFIG
	Context, Cluster objx.Map
}

Info contains metadata about the client and its environment

type Kubectl

type Kubectl struct {
	APIServer string
	// contains filtered or unexported fields
}

Kubectl uses the `kubectl` command to operate on a Kubernetes cluster

func New

func New(endpoint string) (*Kubectl, error)

New returns a instance of Kubectl with a correct context already discovered.

func (Kubectl) Apply

func (k Kubectl) Apply(data manifest.List, opts ApplyOpts) error

Apply applies the given yaml to the cluster

func (Kubectl) Delete

func (k Kubectl) Delete(namespace, kind, name string, opts DeleteOpts) error

Delete removes the specified object from the cluster

func (Kubectl) DeleteByLabels

func (k Kubectl) DeleteByLabels(namespace string, labels map[string]interface{}, opts DeleteOpts) error

DeleteByLabels removes all objects matched by the given labels from the cluster

func (Kubectl) DiffServerSide

func (k Kubectl) DiffServerSide(data manifest.List) (*string, error)

DiffServerSide takes the desired state and computes the differences on the server, returning them in `diff(1)` format

func (Kubectl) Get

func (k Kubectl) Get(namespace, kind, name string) (manifest.Manifest, error)

Get retrieves a single Kubernetes object from the cluster

func (Kubectl) GetByLabels

func (k Kubectl) GetByLabels(namespace string, labels map[string]interface{}) (manifest.List, error)

GetByLabels retrieves all objects matched by the given labels from the cluster

func (Kubectl) Info

func (k Kubectl) Info() (*Info, error)

Info returns known informational data about the client and its environment

func (Kubectl) Namespaces

func (k Kubectl) Namespaces() (map[string]bool, error)

Namespaces of the cluster

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL