Documentation ¶
Index ¶
- Constants
- Variables
- func GetConfig(kubeconfig, context, namespace string) *genericclioptions.ConfigFlags
- func IsPodReady(pod *v1.Pod) bool
- func IsServiceIPSet(service *v1.Service) bool
- type Client
- func (c *Client) Build(namespace string, reader io.Reader) (Result, error)
- func (c *Client) BuildUnstructured(namespace string, reader io.Reader) (Result, error)
- func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shouldWait bool) error
- func (c *Client) Delete(namespace string, reader io.Reader) error
- func (c *Client) Get(namespace string, reader io.Reader) (string, error)
- func (c *Client) KubernetesClientSet() (*kubernetes.Clientset, error)
- func (c *Client) Update(namespace string, originalReader, targetReader io.Reader, force, recreate bool, ...) error
- func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error)
- func (c *Client) WatchUntilReady(namespace string, reader io.Reader, timeout int64, shouldWait bool) error
- type Factory
- type ResourceActorFunc
- type Result
- func (r *Result) Append(val *resource.Info)
- func (r Result) Contains(info *resource.Info) bool
- func (r Result) Difference(rs Result) Result
- func (r Result) Filter(fn func(*resource.Info) bool) Result
- func (r Result) Get(info *resource.Info) *resource.Info
- func (r Result) Intersect(rs Result) Result
- func (r Result) Visit(fn resource.VisitorFunc) error
Constants ¶
const MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n"
MissingGetHeader is added to Get's output when a resource is not found.
Variables ¶
var ErrNoObjectsVisited = goerrors.New("no objects visited")
ErrNoObjectsVisited indicates that during a visit operation, no matching objects were found.
Functions ¶
func GetConfig ¶
func GetConfig(kubeconfig, context, namespace string) *genericclioptions.ConfigFlags
GetConfig returns a Kubernetes client config.
func IsPodReady ¶
IsPodReady returns true if a pod is ready; false otherwise.
func IsServiceIPSet ¶
IsServiceIPSet aims to check if the service's ClusterIP is set or not the objective is not to perform validation here
Types ¶
type Client ¶
Client represents a client capable of communicating with the Kubernetes API.
func (*Client) Build ¶
Build validates for Kubernetes objects and returns resource Infos from a io.Reader.
func (*Client) BuildUnstructured ¶
BuildUnstructured validates for Kubernetes objects and returns unstructured infos.
func (*Client) Create ¶
Create creates Kubernetes resources from an io.reader.
Namespace will set the namespace.
func (*Client) Delete ¶
Delete deletes Kubernetes resources from an io.reader.
Namespace will set the namespace.
func (*Client) Get ¶
Get gets Kubernetes resources as pretty-printed string.
Namespace will set the namespace.
func (*Client) KubernetesClientSet ¶
func (c *Client) KubernetesClientSet() (*kubernetes.Clientset, error)
KubernetesClientSet returns a client set from the client factory.
func (*Client) Update ¶
func (c *Client) Update(namespace string, originalReader, targetReader io.Reader, force, recreate bool, timeout int64, shouldWait bool) error
Update reads in the current configuration and a target configuration from io.reader and creates resources that don't already exists, updates resources that have been modified in the target configuration and deletes resources from the current configuration that are not present in the target configuration.
Namespace will set the namespaces.
func (*Client) WaitAndGetCompletedPodPhase ¶
func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error)
WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase and returns said phase (PodSucceeded or PodFailed qualify).
func (*Client) WatchUntilReady ¶
func (c *Client) WatchUntilReady(namespace string, reader io.Reader, timeout int64, shouldWait bool) error
WatchUntilReady watches the resource given in the reader, and waits until it is ready.
This function is mainly for hook implementations. It watches for a resource to hit a particular milestone. The milestone depends on the Kind.
For most kinds, it checks to see if the resource is marked as Added or Modified by the Kubernetes event stream. For some kinds, it does more:
- Jobs: A job is marked "Ready" when it has successfully completed. This is ascertained by watching the Status fields in a job's output.
Handling for other kinds will be added as necessary.
type Factory ¶
type Factory interface { // ToRawKubeConfigLoader return kubeconfig loader as-is ToRawKubeConfigLoader() clientcmd.ClientConfig // KubernetesClientSet gives you back an external clientset KubernetesClientSet() (*kubernetes.Clientset, error) // NewBuilder returns an object that assists in loading objects from both disk and the server // and which implements the common patterns for CLI interactions with generic resources. NewBuilder() *resource.Builder // Returns a schema that can validate objects stored on disk. Validator(validate bool) (validation.Schema, error) }
Factory provides abstractions that allow the Kubectl command to be extended across multiple types of resources and different API sets.
type ResourceActorFunc ¶
ResourceActorFunc performs an action on a single resource.
type Result ¶
Result provides convenience methods for comparing collections of Infos.
func (Result) Difference ¶
Difference will return a new Result with objects not contained in rs.