polymorphichelpers

package
v0.0.0-...-2e514ea Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 49 Imported by: 0

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 AdvancedStatefulSetHistoryViewer

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

func (*AdvancedStatefulSetHistoryViewer) ViewHistory

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

type AdvancedStatefulSetRollbacker

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

func (*AdvancedStatefulSetRollbacker) Rollback

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

type AdvancedStatefulSetViewer

type AdvancedStatefulSetViewer struct{}

AdvancedStatefulSetViewer implements the StatusViewer interface

func (*AdvancedStatefulSetViewer) Status

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

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

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 CloneSetHistoryViewer

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

func (*CloneSetHistoryViewer) ViewHistory

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

TODO impl ViewHistory func for CloneSet

type CloneSetRollbacker

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

func (*CloneSetRollbacker) Rollback

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

type CloneSetStatusViewer

type CloneSetStatusViewer struct{}

CloneSetViewer implements the StatusViewer interface

func (*CloneSetStatusViewer) Status

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

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

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

func (v *HistoryVisitor) VisitAdvancedStatefulSet(kind internalapps.GroupKindElement)

func (*HistoryVisitor) VisitCloneSet

func (v *HistoryVisitor) VisitCloneSet(kind internalapps.GroupKindElement)

func (*HistoryVisitor) VisitCronJob

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

func (*HistoryVisitor) VisitDaemonSet

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

func (*HistoryVisitor) VisitDeployment

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

func (*HistoryVisitor) VisitJob

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

func (*HistoryVisitor) VisitPod

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

func (*HistoryVisitor) VisitReplicaSet

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

func (*HistoryVisitor) VisitReplicationController

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

func (*HistoryVisitor) VisitStatefulSet

func (v *HistoryVisitor) VisitStatefulSet(kind internalapps.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) VisitAdvancedStatefulSet

func (v *RollbackVisitor) VisitAdvancedStatefulSet(kind internalapps.GroupKindElement)

func (*RollbackVisitor) VisitCloneSet

func (v *RollbackVisitor) VisitCloneSet(kind internalapps.GroupKindElement)

func (*RollbackVisitor) VisitCronJob

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

func (*RollbackVisitor) VisitDaemonSet

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

func (*RollbackVisitor) VisitDeployment

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

func (*RollbackVisitor) VisitJob

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

func (*RollbackVisitor) VisitPod

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

func (*RollbackVisitor) VisitReplicaSet

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

func (*RollbackVisitor) VisitReplicationController

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

func (*RollbackVisitor) VisitStatefulSet

func (v *RollbackVisitor) VisitStatefulSet(kind internalapps.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