observers

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultObserver

func NewDefaultObserver(reader observer.ClusterReader, mapper meta.RESTMapper) observer.ResourceObserver

func NewDeploymentObserver

func NewDeploymentObserver(reader observer.ClusterReader, mapper meta.RESTMapper, rsObserver observer.ResourceObserver) observer.ResourceObserver

func NewReplicaSetObserver

func NewReplicaSetObserver(reader observer.ClusterReader, mapper meta.RESTMapper, podObserver observer.ResourceObserver) observer.ResourceObserver

func NewStatefulSetObserver

func NewStatefulSetObserver(reader observer.ClusterReader, mapper meta.RESTMapper, podObserver observer.ResourceObserver) observer.ResourceObserver

Types

type BaseObserver

type BaseObserver struct {
	Reader observer.ClusterReader

	Mapper meta.RESTMapper
	// contains filtered or unexported fields
}

BaseObserver provides some basic functionality needed by the observers.

func (*BaseObserver) GVK

GVK looks up the GVK from a GroupKind using the rest mapper.

func (*BaseObserver) LookupResource

func (b *BaseObserver) LookupResource(ctx context.Context, identifier wait.ResourceIdentifier) (*unstructured.Unstructured, error)

LookupResource looks up a resource with the given identifier. It will use the rest mapper to resolve the version of the GroupKind given in the identifier. If the resource is found, it will be returned and the observedResource will be nil. If there is an error or the resource is not found, the observedResource will be returned containing information about the resource and the problem.

func (*BaseObserver) ObserveGeneratedResources

func (b *BaseObserver) ObserveGeneratedResources(ctx context.Context, observer observer.ResourceObserver, object *unstructured.Unstructured,
	gk schema.GroupKind, selectorPath ...string) (event.ObservedResources, error)

ObservedGeneratedResources provides a way to fetch the statuses for all resources of a given GroupKind that match the selector in the provided resource. Typically, this is used to fetch the status of generated resources.

func (*BaseObserver) SetComputeStatusFunc

func (b *BaseObserver) SetComputeStatusFunc(statusFunc observer.ComputeStatusFunc)

SetComputeStatusFunc allows for setting the function used by the observer for computing status. The default value here is to use the status package. This is provided for testing purposes.

type DefaultObserver

type DefaultObserver struct {
	BaseObserver
}

DefaultObserver is an observer that will be used for any resource that doesn't have a specific observer. It will just delegate computation of status to the status library. This should work pretty well for resources that doesn't have any generated resources and where status can be computed only based on the resource itself.

func (*DefaultObserver) Observe

func (*DefaultObserver) ObserveObject

type DeploymentObserver

type DeploymentObserver struct {
	BaseObserver

	RsObserver observer.ResourceObserver
}

DeploymentObserver is an observer that can fetch Deployment resources from the cluster, knows how to find any ReplicaSets belonging to the Deployment, and compute status for the deployment.

func (*DeploymentObserver) Observe

func (*DeploymentObserver) ObserveObject

type StatefulSetObserver

type StatefulSetObserver struct {
	BaseObserver

	PodObserver observer.ResourceObserver
}

StatefulObserver is an observer that can fetch StatefulSet resources from the cluster, knows how to find any Pods belonging to the StatefulSet, and compute status for the StatefulSet.

func (*StatefulSetObserver) Observe

func (*StatefulSetObserver) ObserveObject

func (s *StatefulSetObserver) ObserveObject(ctx context.Context, statefulSet *unstructured.Unstructured) *event.ObservedResource

Jump to

Keyboard shortcuts

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