k8s

package
v0.0.0-...-c5ab296 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBuffer

NewBuffer returns a ResourceEventHandler which buffers and serialises ResourceEventHandler events.

func WatchCronJobs

func WatchCronJobs(g *workgroup.Group, client *kubernetes.Clientset, log logrus.FieldLogger, rs ...cache.ResourceEventHandler)

WatchCronJobs creates a SharedInformer for v1beta1.CronJob and registers it with g.

func WatchDaemonSets

func WatchDaemonSets(g *workgroup.Group, client *kubernetes.Clientset, log logrus.FieldLogger, rs ...cache.ResourceEventHandler)

WatchDaemonSets creates a SharedInformer for apps/v1.DaemonSet and registers it with g.

func WatchDeployments

func WatchDeployments(g *workgroup.Group, client *kubernetes.Clientset, log logrus.FieldLogger, rs ...cache.ResourceEventHandler)

WatchDeployments creates a SharedInformer for apps/v1.Deployments and registers it with g.

func WatchStatefulSets

func WatchStatefulSets(g *workgroup.Group, client *kubernetes.Clientset, log logrus.FieldLogger, rs ...cache.ResourceEventHandler)

WatchStatefulSets creates a SharedInformer for apps/v1.StatefulSet and registers it with g.

Types

type Cond

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

Cond implements a condition variable, a rendezvous point for goroutines waiting for or announcing the occurence of an event.

func (*Cond) Notify

func (c *Cond) Notify()

Notify notifies all registered waiters that an event has occured.

func (*Cond) Register

func (c *Cond) Register(ch chan int, last int)

Register registers ch to receive a value when Notify is called.

type GenericResource

type GenericResource struct {
	Identifier string
	Namespace  string
	Name       string
	// contains filtered or unexported fields
}

GenericResource - generic resource, used to work with multiple kinds of k8s resources

func NewGenericResource

func NewGenericResource(obj interface{}) (*GenericResource, error)

NewGenericResource - create new generic k8s resource

func (*GenericResource) Containers

func (r *GenericResource) Containers() (containers []core_v1.Container)

Containers - returns containers managed by this resource

func (*GenericResource) DeepCopy

func (r *GenericResource) DeepCopy() *GenericResource

DeepCopy uses an autogenerated deepcopy functions, copying the receiver, creating a new GenericResource

func (*GenericResource) GetAnnotations

func (r *GenericResource) GetAnnotations() (annotations map[string]string)

GetAnnotations - get resource annotations

func (*GenericResource) GetIdentifier

func (r *GenericResource) GetIdentifier() string

GetIdentifier returns resource identifier

func (*GenericResource) GetImagePullSecrets

func (r *GenericResource) GetImagePullSecrets() (secrets []string)

GetImagePullSecrets - returns secrets from pod spec

func (*GenericResource) GetImages

func (r *GenericResource) GetImages() (images []string)

GetImages - returns images used by this resource

func (*GenericResource) GetLabels

func (r *GenericResource) GetLabels() (labels map[string]string)

GetLabels - get resource labels

func (*GenericResource) GetName

func (r *GenericResource) GetName() string

GetName returns resource name

func (*GenericResource) GetNamespace

func (r *GenericResource) GetNamespace() string

GetNamespace returns resource namespace

func (*GenericResource) GetResource

func (r *GenericResource) GetResource() interface{}

GetResource - get resource

func (*GenericResource) GetSpecAnnotations

func (r *GenericResource) GetSpecAnnotations() (annotations map[string]string)

GetSpecAnnotations - get resource spec template annotations

func (*GenericResource) GetStatus

func (r *GenericResource) GetStatus() Status

func (*GenericResource) Kind

func (r *GenericResource) Kind() string

Kind returns a type of resource that this structure represents

func (*GenericResource) SetAnnotations

func (r *GenericResource) SetAnnotations(annotations map[string]string)

SetAnnotations - set resource annotations

func (*GenericResource) SetLabels

func (r *GenericResource) SetLabels(labels map[string]string)

SetLabels - set resource labels

func (*GenericResource) SetSpecAnnotations

func (r *GenericResource) SetSpecAnnotations(annotations map[string]string)

SetSpecAnnotations - set resource spec template annotations

func (*GenericResource) String

func (r *GenericResource) String() string

func (*GenericResource) UpdateContainer

func (r *GenericResource) UpdateContainer(index int, image string)

UpdateContainer - updates container image

type GenericResourceCache

type GenericResourceCache struct {
	Cond
	// contains filtered or unexported fields
}

GenericResourceCache - storage for generic resources with a rendezvous point for goroutines waiting for or announcing the occurence of a cache events.

func (*GenericResourceCache) Add

func (cc *GenericResourceCache) Add(grs ...*GenericResource)

Add adds an entry to the cache. If a GenericResource with the same name exists, it is replaced.

func (*GenericResourceCache) Remove

func (cc *GenericResourceCache) Remove(identifiers ...string)

Remove removes the named entry from the cache. If the entry is not present in the cache, the operation is a no-op.

func (*GenericResourceCache) Values

func (cc *GenericResourceCache) Values() []*GenericResource

Values returns a copy of the contents of the cache.

type Status

type Status struct {
	// Total number of non-terminated pods targeted by this deployment (their labels match the selector).
	// +optional
	Replicas int32 `json:"replicas"`

	// Total number of non-terminated pods targeted by this deployment that have the desired template spec.
	// +optional
	UpdatedReplicas int32 `json:"updatedReplicas"`

	// Total number of ready pods targeted by this deployment.
	// +optional
	ReadyReplicas int32 `json:"readyReplicas"`

	// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
	// +optional
	AvailableReplicas int32 `json:"availableReplicas"`

	// Total number of unavailable pods targeted by this deployment. This is the total number of
	// pods that are still required for the deployment to have 100% available capacity. They may
	// either be pods that are running but not yet available or pods that still have not been created.
	// +optional
	UnavailableReplicas int32 `json:"unavailableReplica"`
}

type Translator

type Translator struct {
	logrus.FieldLogger

	GenericResourceCache
	// contains filtered or unexported fields
}

func (*Translator) Add

func (cc *Translator) Add(grs ...*GenericResource)

Add adds an entry to the cache. If a GenericResource with the same name exists, it is replaced.

func (*Translator) OnAdd

func (t *Translator) OnAdd(obj interface{})

func (*Translator) OnDelete

func (t *Translator) OnDelete(obj interface{})

func (*Translator) OnUpdate

func (t *Translator) OnUpdate(oldObj, newObj interface{})

func (*Translator) Remove

func (cc *Translator) Remove(identifiers ...string)

Remove removes the named entry from the cache. If the entry is not present in the cache, the operation is a no-op.

func (*Translator) Values

func (cc *Translator) Values() []*GenericResource

Values returns a copy of the contents of the cache.

Jump to

Keyboard shortcuts

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