polymorphichelpers

package
v0.24.6 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 43 Imported by: 124

Documentation

Index

Constants

View Source
const (
	ChangeCauseAnnotation = "kubernetes.io/change-cause"
)

Variables

This section is empty.

Functions

func GetFirstPod

func GetFirstPod(client coreclient.PodsGetter, namespace string, selector string, timeout time.Duration, sortBy func([]*corev1.Pod) sort.Interface) (*corev1.Pod, int, error)

GetFirstPod returns a pod matching the namespace and label selector and the number of all pods that match the label selector.

func MakeLabels

func MakeLabels(labels map[string]string) string

func SelectorsForObject

func SelectorsForObject(object runtime.Object) (namespace string, selector labels.Selector, err error)

SelectorsForObject returns the pod label selector for a given object

Types

type AttachablePodForObjectFunc

type AttachablePodForObjectFunc func(restClientGetter genericclioptions.RESTClientGetter, object runtime.Object, timeout time.Duration) (*v1.Pod, error)

AttachablePodForObjectFunc is a function type that can tell you how to get the pod for which to attach a given object

var AttachablePodForObjectFn AttachablePodForObjectFunc = attachablePodForObject

AttachablePodForObjectFn gives a way to easily override the function for unit testing if needed.

type CanBeExposedFunc

type CanBeExposedFunc func(kind schema.GroupKind) error

CanBeExposedFunc is a function type that can tell you whether a given GroupKind is capable of being exposed

var CanBeExposedFn CanBeExposedFunc = canBeExposed

CanBeExposedFn gives a way to easily override the function for unit testing if needed

type DaemonSetHistoryViewer

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

func (*DaemonSetHistoryViewer) ViewHistory

func (h *DaemonSetHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error)

ViewHistory returns a revision-to-history map as the revision history of a deployment TODO: this should be a describer

type DaemonSetRollbacker

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

func (*DaemonSetRollbacker) Rollback

func (r *DaemonSetRollbacker) Rollback(obj runtime.Object, updatedAnnotations map[string]string, toRevision int64, dryRunStrategy cmdutil.DryRunStrategy) (string, error)

type DaemonSetStatusViewer

type DaemonSetStatusViewer struct{}

DaemonSetStatusViewer implements the StatusViewer interface.

func (*DaemonSetStatusViewer) Status

func (s *DaemonSetStatusViewer) Status(obj runtime.Unstructured, revision int64) (string, bool, error)

Status returns a message describing daemon set status, and a bool value indicating if the status is considered done.

type DeploymentHistoryViewer

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

func (*DeploymentHistoryViewer) ViewHistory

func (h *DeploymentHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error)

ViewHistory returns a revision-to-replicaset map as the revision history of a deployment TODO: this should be a describer

type DeploymentRollbacker

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

func (*DeploymentRollbacker) Rollback

func (r *DeploymentRollbacker) Rollback(obj runtime.Object, updatedAnnotations map[string]string, toRevision int64, dryRunStrategy cmdutil.DryRunStrategy) (string, error)

type DeploymentStatusViewer

type DeploymentStatusViewer struct{}

DeploymentStatusViewer implements the StatusViewer interface.

func (*DeploymentStatusViewer) Status

func (s *DeploymentStatusViewer) Status(obj runtime.Unstructured, revision int64) (string, bool, error)

Status returns a message describing deployment status, and a bool value indicating if the status is considered done.

type HistoryViewer

type HistoryViewer interface {
	ViewHistory(namespace, name string, revision int64) (string, error)
}

HistoryViewer provides an interface for resources have historical information.

func HistoryViewerFor

func HistoryViewerFor(kind schema.GroupKind, c kubernetes.Interface) (HistoryViewer, error)

HistoryViewerFor returns an implementation of HistoryViewer interface for the given schema kind

type HistoryViewerFunc

type HistoryViewerFunc func(restClientGetter genericclioptions.RESTClientGetter, mapping *meta.RESTMapping) (HistoryViewer, error)

HistoryViewerFunc is a function type that can tell you how to view change history

var HistoryViewerFn HistoryViewerFunc = historyViewer

HistoryViewerFn gives a way to easily override the function for unit testing if needed

type HistoryVisitor

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

func (*HistoryVisitor) VisitCronJob

func (v *HistoryVisitor) VisitCronJob(kind apps.GroupKindElement)

func (*HistoryVisitor) VisitDaemonSet

func (v *HistoryVisitor) VisitDaemonSet(kind apps.GroupKindElement)

func (*HistoryVisitor) VisitDeployment

func (v *HistoryVisitor) VisitDeployment(elem apps.GroupKindElement)

func (*HistoryVisitor) VisitJob

func (v *HistoryVisitor) VisitJob(kind apps.GroupKindElement)

func (*HistoryVisitor) VisitPod

func (v *HistoryVisitor) VisitPod(kind apps.GroupKindElement)

func (*HistoryVisitor) VisitReplicaSet

func (v *HistoryVisitor) VisitReplicaSet(kind apps.GroupKindElement)

func (*HistoryVisitor) VisitReplicationController

func (v *HistoryVisitor) VisitReplicationController(kind apps.GroupKindElement)

func (*HistoryVisitor) VisitStatefulSet

func (v *HistoryVisitor) VisitStatefulSet(kind apps.GroupKindElement)

type LogsForObjectFunc

type LogsForObjectFunc func(restClientGetter genericclioptions.RESTClientGetter, object, options runtime.Object, timeout time.Duration, allContainers bool) (map[v1.ObjectReference]rest.ResponseWrapper, error)

LogsForObjectFunc is a function type that can tell you how to get logs for a runtime.object

var LogsForObjectFn LogsForObjectFunc = logsForObject

LogsForObjectFn gives a way to easily override the function for unit testing if needed.

type MapBasedSelectorForObjectFunc

type MapBasedSelectorForObjectFunc func(object runtime.Object) (string, error)

MapBasedSelectorForObjectFunc will call the provided function on mapping the baesd selector for object, return "" if object is not supported, or return an error.

var MapBasedSelectorForObjectFn MapBasedSelectorForObjectFunc = mapBasedSelectorForObject

MapBasedSelectorForObjectFn gives a way to easily override the function for unit testing if needed

type ObjectPauserFunc

type ObjectPauserFunc func(runtime.Object) ([]byte, error)

ObjectPauserFunc is a function type that marks the object in a given info as paused.

var ObjectPauserFn ObjectPauserFunc = defaultObjectPauser

ObjectPauserFn gives a way to easily override the function for unit testing if needed. Returns the patched object in bytes and any error that occurred during the encoding or in case the object is already paused.

type ObjectRestarterFunc

type ObjectRestarterFunc func(runtime.Object) ([]byte, error)

ObjectRestarterFunc is a function type that updates an annotation in a deployment to restart it..

var ObjectRestarterFn ObjectRestarterFunc = defaultObjectRestarter

ObjectRestarterFn gives a way to easily override the function for unit testing if needed. Returns the patched object in bytes and any error that occurred during the encoding.

type ObjectResumerFunc

type ObjectResumerFunc func(runtime.Object) ([]byte, error)

ObjectResumerFunc is a function type that marks the object in a given info as resumed.

var ObjectResumerFn ObjectResumerFunc = defaultObjectResumer

ObjectResumerFn gives a way to easily override the function for unit testing if needed. Returns the patched object in bytes and any error that occurred during the encoding or in case the object is already resumed.

type PortsForObjectFunc

type PortsForObjectFunc func(object runtime.Object) ([]string, error)

PortsForObjectFunc returns the ports associated with the provided object

var PortsForObjectFn PortsForObjectFunc = portsForObject

PortsForObjectFn gives a way to easily override the function for unit testing if needed

type ProtocolsForObjectFunc

type ProtocolsForObjectFunc func(object runtime.Object) (map[string]string, error)

ProtocolsForObjectFunc will call the provided function on the protocols for the object, return nil-map if no protocols for the object, or return an error.

var ProtocolsForObjectFn ProtocolsForObjectFunc = protocolsForObject

ProtocolsForObjectFn gives a way to easily override the function for unit testing if needed

type RollbackVisitor

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

func (*RollbackVisitor) VisitCronJob

func (v *RollbackVisitor) VisitCronJob(kind apps.GroupKindElement)

func (*RollbackVisitor) VisitDaemonSet

func (v *RollbackVisitor) VisitDaemonSet(kind apps.GroupKindElement)

func (*RollbackVisitor) VisitDeployment

func (v *RollbackVisitor) VisitDeployment(elem apps.GroupKindElement)

func (*RollbackVisitor) VisitJob

func (v *RollbackVisitor) VisitJob(kind apps.GroupKindElement)

func (*RollbackVisitor) VisitPod

func (v *RollbackVisitor) VisitPod(kind apps.GroupKindElement)

func (*RollbackVisitor) VisitReplicaSet

func (v *RollbackVisitor) VisitReplicaSet(kind apps.GroupKindElement)

func (*RollbackVisitor) VisitReplicationController

func (v *RollbackVisitor) VisitReplicationController(kind apps.GroupKindElement)

func (*RollbackVisitor) VisitStatefulSet

func (v *RollbackVisitor) VisitStatefulSet(kind apps.GroupKindElement)

type Rollbacker

type Rollbacker interface {
	Rollback(obj runtime.Object, updatedAnnotations map[string]string, toRevision int64, dryRunStrategy cmdutil.DryRunStrategy) (string, error)
}

Rollbacker provides an interface for resources that can be rolled back.

func RollbackerFor

func RollbackerFor(kind schema.GroupKind, c kubernetes.Interface) (Rollbacker, error)

RollbackerFor returns an implementation of Rollbacker interface for the given schema kind

type RollbackerFunc

type RollbackerFunc func(restClientGetter genericclioptions.RESTClientGetter, mapping *meta.RESTMapping) (Rollbacker, error)

RollbackerFunc gives a way to change the rollback version of the specified RESTMapping type

var RollbackerFn RollbackerFunc = rollbacker

RollbackerFn gives a way to easily override the function for unit testing if needed

type StatefulSetHistoryViewer

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

func (*StatefulSetHistoryViewer) ViewHistory

func (h *StatefulSetHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error)

ViewHistory returns a list of the revision history of a statefulset TODO: this should be a describer

type StatefulSetRollbacker

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

func (*StatefulSetRollbacker) Rollback

func (r *StatefulSetRollbacker) Rollback(obj runtime.Object, updatedAnnotations map[string]string, toRevision int64, dryRunStrategy cmdutil.DryRunStrategy) (string, error)

toRevision is a non-negative integer, with 0 being reserved to indicate rolling back to previous configuration

type StatefulSetStatusViewer

type StatefulSetStatusViewer struct{}

StatefulSetStatusViewer implements the StatusViewer interface.

func (*StatefulSetStatusViewer) Status

func (s *StatefulSetStatusViewer) Status(obj runtime.Unstructured, revision int64) (string, bool, error)

Status returns a message describing statefulset status, and a bool value indicating if the status is considered done.

type StatusViewer

type StatusViewer interface {
	Status(obj runtime.Unstructured, revision int64) (string, bool, error)
}

StatusViewer provides an interface for resources that have rollout status.

func StatusViewerFor

func StatusViewerFor(kind schema.GroupKind) (StatusViewer, error)

StatusViewerFor returns a StatusViewer for the resource specified by kind.

type StatusViewerFunc

type StatusViewerFunc func(mapping *meta.RESTMapping) (StatusViewer, error)

StatusViewerFunc is a function type that can tell you how to print rollout status

var StatusViewerFn StatusViewerFunc = statusViewer

StatusViewerFn gives a way to easily override the function for unit testing if needed

type UpdatePodSpecForObjectFunc

type UpdatePodSpecForObjectFunc func(obj runtime.Object, fn func(*v1.PodSpec) error) (bool, error)

UpdatePodSpecForObjectFunc will call the provided function on the pod spec this object supports, return false if no pod spec is supported, or return an error.

var UpdatePodSpecForObjectFn UpdatePodSpecForObjectFunc = updatePodSpecForObject

UpdatePodSpecForObjectFn gives a way to easily override the function for unit testing if needed

Jump to

Keyboard shortcuts

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