v1alpha1

package
v0.7.0-RC2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clientset

func Clientset() *clientset

Clientset returns a pointer to clientset struct

func ConfigMap

func ConfigMap(namespace, name string) *configmap

ConfigMap returns a new instance of configmap

func Dynamic

func Dynamic() *dynamic

Dynamic returns a new instance of dynamic

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 Namespace

func Namespace() *namespace

Namespace returns a pointer to the namespace struct

func Node

func Node() *node

func NumberOfNodes

func NumberOfNodes() (int, error)

NumberOfNodes returns the number of nodes registered in a Kubernetes cluster

func Resource

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

Resource returns a new resource instance

Types

type ClientsetGetter

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

ClientsetGetter abstracts fetching 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 Delete

type Delete struct {
	// 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) Create

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

Create creates a new resource in kubernetes cluster

func (*Delete) Delete

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

Delete deletes a resource from a kubernetes cluster

func (Delete) Get

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

Get returns a specific resource from kubernetes cluster

func (Delete) List

func (r Delete) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)

List returns a list of specific resource at kubernetes cluster

func (Delete) String

func (r Delete) String() string

String implements Stringer interface

func (Delete) Update

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

Update updates the resource at kubernetes cluster

type DynamicProvider

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

DynamicProvider abstracts providing kubernetes dynamic client interface

type Get

type Get struct {
	// 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) Create

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

Create creates a new resource in kubernetes cluster

func (Get) Delete

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

Delete deletes a existing resource in kubernetes cluster

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

func (Get) List

func (r Get) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)

List returns a list of specific resource at kubernetes cluster

func (Get) String

func (r Get) String() string

String implements Stringer interface

func (Get) Update

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

Update updates the resource at kubernetes cluster

type List

type List struct {
	// 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) Create

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

Create creates a new resource in kubernetes cluster

func (List) Delete

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

Delete deletes a existing resource in kubernetes cluster

func (List) Get

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

Get returns a specific resource from kubernetes cluster

func (*List) List

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

List lists a resource from a kubernetes cluster

func (List) String

func (r List) String() string

String implements Stringer interface

func (List) Update

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

Update updates the resource at 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 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 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 {

	// 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
	// contains filtered or unexported fields
}

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) Create

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

Create creates a new resource in kubernetes cluster

func (ResourceCreateOrUpdater) Delete

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

Delete deletes a existing resource in kubernetes cluster

func (ResourceCreateOrUpdater) Get

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

Get returns a specific resource from kubernetes cluster

func (ResourceCreateOrUpdater) List

func (r ResourceCreateOrUpdater) List(opts metav1.ListOptions) (u *unstructured.UnstructuredList, err error)

List returns a list of specific resource at kubernetes cluster

func (*ResourceCreateOrUpdater) String

func (r *ResourceCreateOrUpdater) String() string

String implements Stringer interface

func (ResourceCreateOrUpdater) Update

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

Update updates the resource at kubernetes cluster

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 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