Documentation ¶
Index ¶
- Constants
- func CalculatePartitionReplicas(partition *intstrutil.IntOrString, replicasPointer *int32) (int, error)
- func GetFirstPod(client coreclient.PodsGetter, namespace string, selector string, ...) (*corev1.Pod, int, error)
- func MakeLabels(labels map[string]string) string
- func SelectorsForObject(object runtime.Object) (namespace string, selector labels.Selector, err error)
- func UpdateResourceEnv(object runtime.Object)
- type AdvancedDaemonSetHistoryViewer
- type AdvancedDaemonSetRollbacker
- type AdvancedStatefulSetHistoryViewer
- type AdvancedStatefulSetRollbacker
- type AdvancedStatefulSetStatusViewer
- type AttachablePodForObjectFunc
- type CanBeExposedFunc
- type CloneSetHistoryViewer
- type CloneSetRollbacker
- type CloneSetStatusViewer
- type DaemonSetHistoryViewer
- type DaemonSetRollbacker
- type DaemonSetStatusViewer
- type DeploymentHistoryViewer
- type DeploymentRollbacker
- type DeploymentStatusViewer
- type HistoryViewer
- type HistoryViewerFunc
- type HistoryVisitor
- func (v *HistoryVisitor) VisitAdvancedDaemonSet(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitAdvancedStatefulSet(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitCloneSet(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitCronJob(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitDaemonSet(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitDeployment(elem internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitJob(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitPod(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitReplicaSet(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitReplicationController(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitRollout(kind internalapps.GroupKindElement)
- func (v *HistoryVisitor) VisitStatefulSet(kind internalapps.GroupKindElement)
- type LogsForObjectFunc
- type MapBasedSelectorForObjectFunc
- type ObjectApproverFunc
- type ObjectPauserFunc
- type ObjectRestarterFunc
- type ObjectResumerFunc
- type PortsForObjectFunc
- type ProtocolsForObjectFunc
- type RollbackVisitor
- func (v *RollbackVisitor) VisitAdvancedDaemonSet(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitAdvancedStatefulSet(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitCloneSet(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitCronJob(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitDaemonSet(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitDeployment(elem internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitJob(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitPod(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitReplicaSet(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitReplicationController(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitRollout(kind internalapps.GroupKindElement)
- func (v *RollbackVisitor) VisitStatefulSet(kind internalapps.GroupKindElement)
- type Rollbacker
- type RollbackerFunc
- type RolloutRollbacker
- type StatefulSetHistoryViewer
- type StatefulSetRollbacker
- type StatefulSetStatusViewer
- type StatusViewer
- type StatusViewerFunc
- type UpdatePodSpecForObjectFunc
Constants ¶
const (
ChangeCauseAnnotation = "kubernetes.io/change-cause"
)
const (
RestartedEnv = "RESTARTED_AT"
)
Variables ¶
This section is empty.
Functions ¶
func CalculatePartitionReplicas ¶ added in v1.0.5
func CalculatePartitionReplicas(partition *intstrutil.IntOrString, replicasPointer *int32) (int, error)
CalculatePartitionReplicas returns absolute value of partition for workload. This func can solve some corner cases about percentage-type partition, such as: - if partition > "0%" and replicas > 0, we will ensure at least 1 old pod is reserved. - if partition < "100%" and replicas > 1, we will ensure at least 1 pod is upgraded.
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 SelectorsForObject ¶
func SelectorsForObject(object runtime.Object) (namespace string, selector labels.Selector, err error)
SelectorsForObject returns the pod label selector for a given object
func UpdateResourceEnv ¶
Types ¶
type AdvancedDaemonSetHistoryViewer ¶ added in v1.0.2
type AdvancedDaemonSetHistoryViewer struct {
// contains filtered or unexported fields
}
func (*AdvancedDaemonSetHistoryViewer) ViewHistory ¶ added in v1.0.2
func (h *AdvancedDaemonSetHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error)
type AdvancedDaemonSetRollbacker ¶ added in v1.0.2
type AdvancedDaemonSetRollbacker struct {
// contains filtered or unexported fields
}
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
}
type AdvancedStatefulSetStatusViewer ¶
type AdvancedStatefulSetStatusViewer struct{}
AdvancedStatefulSetStatusViewer implements the StatusViewer interface
func (*AdvancedStatefulSetStatusViewer) DetailStatus ¶ added in v1.0.4
func (s *AdvancedStatefulSetStatusViewer) DetailStatus(c kubernetes.Interface, obj runtime.Unstructured, detail bool, revision int64) (string, bool, error)
DetailStatus returns a message describing advanced statefulset status, and a bool value indicating if the status is considered done.
func (*AdvancedStatefulSetStatusViewer) Status ¶
func (s *AdvancedStatefulSetStatusViewer) Status(c kubernetes.Interface, 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 ¶
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
}
type CloneSetStatusViewer ¶
type CloneSetStatusViewer struct{}
CloneSetViewer implements the StatusViewer interface
func (*CloneSetStatusViewer) DetailStatus ¶ added in v1.0.4
func (s *CloneSetStatusViewer) DetailStatus(c kubernetes.Interface, obj runtime.Unstructured, detail bool, revision int64) (string, bool, error)
DetailStatus returns a message describing cloneset detail status, and a bool value indicating if the status is considered done.
func (*CloneSetStatusViewer) Status ¶
func (s *CloneSetStatusViewer) Status(c kubernetes.Interface, 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
}
type DaemonSetStatusViewer ¶
type DaemonSetStatusViewer struct{}
DaemonSetStatusViewer implements the StatusViewer interface.
func (*DaemonSetStatusViewer) DetailStatus ¶ added in v1.0.4
func (s *DaemonSetStatusViewer) DetailStatus(c kubernetes.Interface, obj runtime.Unstructured, detail bool, revision int64) (string, bool, error)
DetailStatus returns a message describing daemon set status, and a bool value indicating if the status is considered done.
func (*DaemonSetStatusViewer) Status ¶
func (s *DaemonSetStatusViewer) Status(c kubernetes.Interface, 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
}
type DeploymentStatusViewer ¶
type DeploymentStatusViewer struct{}
DeploymentStatusViewer implements the StatusViewer interface.
func (*DeploymentStatusViewer) DetailStatus ¶ added in v1.0.4
func (s *DeploymentStatusViewer) DetailStatus(c kubernetes.Interface, obj runtime.Unstructured, detail bool, revision int64) (string, bool, error)
DetailStatus returns a message describing deployment detail status, and a bool value indicating if the status is considered done.
func (*DeploymentStatusViewer) Status ¶
func (s *DeploymentStatusViewer) Status(c kubernetes.Interface, 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, kc kruiseclientsets.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) VisitAdvancedDaemonSet ¶ added in v1.0.2
func (v *HistoryVisitor) VisitAdvancedDaemonSet(kind internalapps.GroupKindElement)
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) VisitRollout ¶ added in v1.1.0
func (v *HistoryVisitor) VisitRollout(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 ¶
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 ObjectApproverFunc ¶ added in v1.0.2
ObjectApproverFunc is a function type that marks the object in a given info as approved.
var ObjectApproverFn ObjectApproverFunc = defaultObjectApprover
ObjectApproverFn 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 approved.
type ObjectPauserFunc ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) VisitAdvancedDaemonSet ¶ added in v1.0.2
func (v *RollbackVisitor) VisitAdvancedDaemonSet(kind internalapps.GroupKindElement)
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) VisitRollout ¶ added in v1.1.0
func (v *RollbackVisitor) VisitRollout(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, kc kruiseclientsets.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 RolloutRollbacker ¶ added in v1.1.0
type RolloutRollbacker struct {
// contains filtered or unexported fields
}
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) DetailStatus ¶ added in v1.0.4
func (s *StatefulSetStatusViewer) DetailStatus(c kubernetes.Interface, obj runtime.Unstructured, detail bool, revision int64) (string, bool, error)
func (*StatefulSetStatusViewer) Status ¶
func (s *StatefulSetStatusViewer) Status(c kubernetes.Interface, 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(c kubernetes.Interface, obj runtime.Unstructured, revision int64) (string, bool, error) DetailStatus(c kubernetes.Interface, obj runtime.Unstructured, detail bool, 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 ¶
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
Source Files ¶
- attachablepodforobject.go
- canbeexposed.go
- helpers.go
- history.go
- historyviewer.go
- interface.go
- logsforobject.go
- mapbasedselectorforobject.go
- objectapprover.go
- objectpauser.go
- objectrestarter.go
- objectresumer.go
- portsforobject.go
- protocolsforobject.go
- rollback.go
- rollbacker.go
- rollout_status.go
- rollout_utils.go
- statusviewer.go
- updatepodspec.go