kubernetes

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadRawResourceFromYaml

func LoadRawResourceFromYaml(data string) (runtime.Object, error)

LoadRawResourceFromYaml loads a k8s resource from a yaml definition without making assumptions on the underlying type

func LoadResourceFromYaml

func LoadResourceFromYaml(scheme *runtime.Scheme, data string) (runtime.Object, error)

LoadResourceFromYaml loads a k8s resource from a yaml definition

func ReplaceResource

func ReplaceResource(ctx context.Context, c client.Client, res runtime.Object) error

ReplaceResource allows to completely replace a resource on Kubernetes, taking care of immutable fields and resource versions

func ReplaceResources

func ReplaceResources(ctx context.Context, c client.Client, objects []runtime.Object) error

ReplaceResources allows to completely replace a list of resources on Kubernetes, taking care of immutable fields and resource versions

func RuntimeObjectFromUnstructured

func RuntimeObjectFromUnstructured(scheme *runtime.Scheme, u *unstructured.Unstructured) (runtime.Object, error)

RuntimeObjectFromUnstructured converts an unstructured to a runtime object

func SanitizeFileName

func SanitizeFileName(name string) string

func SanitizeLabel

func SanitizeLabel(name string) string

SanitizeLabel sanitizes the given name to be compatible with k8s

func SanitizeName

func SanitizeName(name string) string

SanitizeName sanitizes the given name to be compatible with k8s

func WaitCondition

func WaitCondition(ctx context.Context, c client.Client, obj runtime.Object, condition ResourceCheckFunction, maxDuration time.Duration) error

WaitCondition --

Types

type Collection

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

A Collection is a container of Kubernetes resources

func NewCollection

func NewCollection(objcts ...runtime.Object) *Collection

NewCollection creates a new empty collection

func (*Collection) Add

func (c *Collection) Add(resource runtime.Object)

Add adds a resource to the collection

func (*Collection) AddAll

func (c *Collection) AddAll(resource []runtime.Object)

AddAll adds all resources to the collection

func (*Collection) AsKubernetesList

func (c *Collection) AsKubernetesList() *corev1.List

AsKubernetesList returns all resources wrapped in a Kubernetes list

func (*Collection) GetConfigMap

func (c *Collection) GetConfigMap(filter func(*corev1.ConfigMap) bool) *corev1.ConfigMap

GetConfigMap returns a ConfigMap that matches the given function

func (*Collection) GetDeployment

func (c *Collection) GetDeployment(filter func(*appsv1.Deployment) bool) *appsv1.Deployment

GetDeployment returns a Deployment that matches the given function

func (*Collection) GetService

func (c *Collection) GetService(filter func(*corev1.Service) bool) *corev1.Service

GetService returns a Service that matches the given function

func (*Collection) HasDeployment

func (c *Collection) HasDeployment(filter func(*appsv1.Deployment) bool) bool

HasDeployment returns true if a deployment matching the given condition is present

func (*Collection) Items

func (c *Collection) Items() []runtime.Object

Items returns all resources belonging to the collection

func (*Collection) Remove

func (c *Collection) Remove(selector func(runtime.Object) bool) runtime.Object

Remove removes the given element from the collection and returns it

func (*Collection) RemoveConfigMap

func (c *Collection) RemoveConfigMap(filter func(*corev1.ConfigMap) bool) *corev1.ConfigMap

RemoveConfigMap removes and returns a ConfigMap that matches the given function

func (*Collection) RemoveDeployment

func (c *Collection) RemoveDeployment(filter func(*appsv1.Deployment) bool) *appsv1.Deployment

RemoveDeployment removes and returns a Deployment that matches the given function

func (*Collection) Size

func (c *Collection) Size() int

Size returns the number of resources belonging to the collection

func (*Collection) Visit

func (c *Collection) Visit(visitor func(runtime.Object))

Visit executes the visitor function on all resources

func (*Collection) VisitConfigMap

func (c *Collection) VisitConfigMap(visitor func(*corev1.ConfigMap))

VisitConfigMap executes the visitor function on all ConfigMap resources

func (*Collection) VisitContainer

func (c *Collection) VisitContainer(visitor func(container *corev1.Container))

VisitContainer executes the visitor function on all Containers inside deployments or other resources

func (*Collection) VisitDeployment

func (c *Collection) VisitDeployment(visitor func(*appsv1.Deployment))

VisitDeployment executes the visitor function on all Deployment resources

func (*Collection) VisitMetaObject

func (c *Collection) VisitMetaObject(visitor func(metav1.Object))

VisitMetaObject executes the visitor function on all meta.Object resources

func (*Collection) VisitService

func (c *Collection) VisitService(visitor func(*corev1.Service))

VisitService executes the visitor function on all Service resources

type ResourceCheckFunction

type ResourceCheckFunction func(interface{}) (bool, error)

ResourceCheckFunction --

type ResourceRetrieveFunction

type ResourceRetrieveFunction func() (interface{}, error)

ResourceRetrieveFunction --

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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