v1alpha1

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNode

func GetNode(name string) (*corev1.Node, error)

GetNode returns a node instance from kubernetes cluster

func GetOSAndKernelVersion

func GetOSAndKernelVersion() (string, error)

GetOSAndKernelVersion gets us the OS,Kernel version

func GetServerVersion

func GetServerVersion() (*version.Info, error)

GetServerVersion uses the client-go Discovery client to get the kubernetes version struct

func ListNodes

func ListNodes(options metav1.ListOptions) (*corev1.NodeList, error)

ListNodes returns list of node instance from kubernetes cluster

func NumberOfNodes

func NumberOfNodes() (int, error)

NumberOfNodes returns the number of nodes registered in a Kubernetes cluster

Types

type ClientsetGetter

type ClientsetGetter interface {
	Get() (*kubernetes.Clientset, error)
}

ClientsetGetter abstracts fetching of kubernetes clientset

type ClientsetStruct added in v0.9.0

type ClientsetStruct struct{}

ClientsetStruct is used to export a kuberneter Clientset

func Clientset

func Clientset() *ClientsetStruct

Clientset returns a pointer to clientset struct

func (*ClientsetStruct) Get added in v0.9.0

Get returns a new instance of kubernetes clientset

type ConfigGetter

type ConfigGetter interface {
	Get() (*rest.Config, error)
	Name() string
}

ConfigGetter abstracts fetching of kubernetes client config

func Config

func Config() ConfigGetter

Config provides appropriate config getter instances that help in fetching kubernetes client config to invoke kubernetes API calls

type ConfigGetters

type ConfigGetters []ConfigGetter

ConfigGetters holds a list of ConfigGetter instances

NOTE:

This is an implementation of ConfigGetter

func (ConfigGetters) Get

func (c ConfigGetters) Get() (config *rest.Config, err error)

Get fetches the kubernetes client config that is used to make kubernetes API calls. It makes use of its list of getter instances to fetch kubernetes config.

func (ConfigGetters) Name

func (c ConfigGetters) Name() string

Name returns the name of this config getter instance

type ConfigMapGetter

type ConfigMapGetter interface {
	Get(options metav1.GetOptions) (*corev1.ConfigMap, error)
}

ConfigMapGetter abstracts fetching of ConfigMap instance from kubernetes cluster

type Configmap added in v0.9.0

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

Configmap is used to initialise a kubernetes Configmap struct

func ConfigMap

func ConfigMap(namespace, name string) *Configmap

ConfigMap returns a new instance of configmap

func (*Configmap) Get added in v0.9.0

func (c *Configmap) Get(options metav1.GetOptions) (cm *corev1.ConfigMap, err error)

Get returns configmap instance from kubernetes cluster

type Delete

type Delete struct {
	*ResourceStruct
	// contains filtered or unexported fields
}

Delete is a resource that is suitable to be executed as a Delete operation

func DeleteResource

func DeleteResource(gvr schema.GroupVersionResource, namespace string) *Delete

DeleteResource returns a new instance of delete resource

func (*Delete) Delete

func (d *Delete) Delete(obj *unstructured.Unstructured, subresources ...string) error

Delete deletes a resource from a kubernetes cluster

type DynamicProvider

type DynamicProvider interface {
	Provide() (k8sdynamic.Interface, error)
}

DynamicProvider abstracts providing kubernetes dynamic client interface

type DynamicStruct added in v0.9.0

type DynamicStruct struct{}

DynamicStruct is used to initialise a kuberenets dynamic interface

func Dynamic

func Dynamic() *DynamicStruct

Dynamic returns a new instance of dynamic

func (*DynamicStruct) Provide added in v0.9.0

func (d *DynamicStruct) Provide() (k8sdynamic.Interface, error)

Provide provides a kubernetes dynamic client capable of invoking operations against kubernetes resources

type Get

type Get struct {
	*ResourceStruct
	// contains filtered or unexported fields
}

Get is resource that is suitable to be executed as Get operation

func GetResource

func GetResource(gvr schema.GroupVersionResource, namespace string) *Get

GetResource returns a new instance of get resource

func (*Get) Get

func (g *Get) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)

Get gets a resource from a kubernetes cluster

type List

type List struct {
	*ResourceStruct
	// contains filtered or unexported fields
}

List is a resource resource that is suitable to be executed as a List operation

func ListResource

func ListResource(gvr schema.GroupVersionResource, namespace string) *List

ListResource returns a new instance of list resource

func (*List) List

func (l *List) List(options metav1.ListOptions) (u *unstructured.UnstructuredList, err error)

List lists a resource from a kubernetes cluster

type NamespaceGetter

type NamespaceGetter interface {
	Get(name string, options metav1.GetOptions) (*corev1.Namespace, error)
}

NamespaceGetter abstracts fetching of Namespace from kubernetes cluster

type NamespaceLister

type NamespaceLister interface {
	List(options metav1.ListOptions) (*corev1.NamespaceList, error)
}

NamespaceLister abstracts fetching of a list of namespaces from kubernetes cluster

type NamespaceStruct added in v0.9.0

type NamespaceStruct struct{}

NamespaceStruct is used to initialise kubernetes namespace instnaces

func Namespace

func Namespace() *NamespaceStruct

Namespace returns a pointer to the namespace struct

func (*NamespaceStruct) Get added in v0.9.0

func (ns *NamespaceStruct) Get(name string, options metav1.GetOptions) (*corev1.Namespace, error)

Get returns a namespace instance from kubernetes cluster

func (*NamespaceStruct) List added in v0.9.0

List returns a slice of namespaces defined in a Kubernetes cluster

type NodeGetter

type NodeGetter interface {
	Get(name string, options metav1.GetOptions) (*corev1.Node, error)
}

NodeGetter abstracts fetching of Node details from kubernetes cluster

type NodeLister

type NodeLister interface {
	List(options metav1.ListOptions) (*corev1.NodeList, error)
}

NodeLister abstracts fetching of Nodes from kubernetes cluster

type NodeStruct added in v0.9.0

type NodeStruct struct{}

NodeStruct returns a struct used to instantiate a kubernetes Node

func Node

func Node() *NodeStruct

Node returnd a pointer to the node struct

func (*NodeStruct) Get added in v0.9.0

func (n *NodeStruct) Get(name string, options metav1.GetOptions) (*corev1.Node, error)

Get returns a node instance from kubernetes cluster

func (*NodeStruct) List added in v0.9.0

func (n *NodeStruct) List(options metav1.ListOptions) (*corev1.NodeList, error)

List returns a slice of Nodes registered in a Kubernetes cluster

type ResourceApplier

type ResourceApplier interface {
	Apply(obj *unstructured.Unstructured, subresources ...string) (*unstructured.Unstructured, error)
}

ResourceApplier abstracts applying an unstructured instance that may or may not be available in kubernetes cluster

type ResourceCreateOrUpdater

type ResourceCreateOrUpdater struct {
	*ResourceStruct

	// Various executors required to perform Apply
	// This is how this instance decouples its dependencies
	Getter  ResourceGetter
	Creator ResourceCreator
	Updater ResourceUpdater

	// IsSkipUpdate will not update this resource if set to true.
	// In other words, enabling this flag can only create the
	// resource in the cluster if not created previously
	IsSkipUpdate bool
}

ResourceCreateOrUpdater as the name suggests manages to either create or update a given resource. It does so by implementing ResourceApplier interface

func NewResourceCreateOrUpdater

func NewResourceCreateOrUpdater(
	gvr schema.GroupVersionResource,
	namespace string,
	options ...ResourceCreateOrUpdaterOption,
) *ResourceCreateOrUpdater

NewResourceCreateOrUpdater returns a new instance of ResourceCreateOrUpdater

func (*ResourceCreateOrUpdater) Apply

func (r *ResourceCreateOrUpdater) Apply(
	obj *unstructured.Unstructured,
	subresources ...string,
) (resource *unstructured.Unstructured, err error)

Apply applies a resource to the kubernetes cluster. In other words, it creates a new resource if it does not exist or updates the existing resource.

func (*ResourceCreateOrUpdater) String

func (r *ResourceCreateOrUpdater) String() string

String implements Stringer interface

type ResourceCreateOrUpdaterOption

type ResourceCreateOrUpdaterOption func(*ResourceCreateOrUpdater)

ResourceCreateOrUpdaterOption is a typed function used to build an instance of ResourceCreateOrUpdater

NOTE:

This follows the pattern known as "functional options". It

is a function that operates on a given structure as a value to build (initialise, configure, sensible defaults, etc) this same structure.

func ResourceCreateOrUpdaterSkipUpdate

func ResourceCreateOrUpdaterSkipUpdate(skip bool) ResourceCreateOrUpdaterOption

ResourceCreateOrUpdaterSkipUpdate sets IsSkipUpdate based on the provided flag

type ResourceCreator

type ResourceCreator interface {
	Create(obj *unstructured.Unstructured, subresources ...string) (*unstructured.Unstructured, error)
}

ResourceCreator abstracts creating an unstructured instance in kubernetes cluster

type ResourceDeleteOptions

type ResourceDeleteOptions struct {
	Deleter ResourceDeleter
}

ResourceDeleteOptions is a utility instance used during the resource's delete operations

type ResourceDeleter

type ResourceDeleter interface {
	Delete(obj *unstructured.Unstructured, subresources ...string) error
}

ResourceDeleter abstracts deletes an unstructured instance that is available in kubernetes cluster

type ResourceGetOptions

type ResourceGetOptions struct {
	Getter ResourceGetter
}

ResourceGetOptions is a utility instance used during the resource's get operations

type ResourceGetter

type ResourceGetter interface {
	Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)
}

ResourceGetter abstracts fetching an unstructured instance from kubernetes cluster

type ResourceListOptions

type ResourceListOptions struct {
	Lister ResourceLister
}

ResourceListOptions is a utility instance used during the resource's list operations

type ResourceLister

type ResourceLister interface {
	List(options metav1.ListOptions) (*unstructured.UnstructuredList, error)
}

ResourceLister abstracts fetching an unstructured list of instance from kubernetes cluster

type ResourceStruct added in v0.9.0

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

ResourceStruct is used to abstract a kubernetes struct

func Resource

func Resource(gvr schema.GroupVersionResource, namespace string) *ResourceStruct

Resource returns a new resource instance

func (*ResourceStruct) Create added in v0.9.0

func (r *ResourceStruct) Create(obj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)

Create creates a new resource in kubernetes cluster

func (*ResourceStruct) Delete added in v0.9.0

func (r *ResourceStruct) Delete(obj *unstructured.Unstructured, subresources ...string) error

Delete deletes a existing resource in kubernetes cluster

func (*ResourceStruct) Get added in v0.9.0

func (r *ResourceStruct) Get(name string, opts metav1.GetOptions, subresources ...string) (u *unstructured.Unstructured, err error)

Get returns a specific resource from kubernetes cluster

func (*ResourceStruct) List added in v0.9.0

List returns a list of specific resource at kubernetes cluster

func (*ResourceStruct) String added in v0.9.0

func (r *ResourceStruct) String() string

String implements Stringer interface

func (*ResourceStruct) Update added in v0.9.0

func (r *ResourceStruct) Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)

Update updates the resource at kubernetes cluster

type ResourceUpdater

type ResourceUpdater interface {
	Update(oldobj, newobj *unstructured.Unstructured, subresources ...string) (u *unstructured.Unstructured, err error)
}

ResourceUpdater abstracts updating an unstructured instance found in kubernetes cluster

Jump to

Keyboard shortcuts

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