Documentation ¶
Index ¶
- Constants
- Variables
- func BlueF(format string, a ...interface{}) string
- func BoldF(format string, a ...interface{}) string
- func DeploymentProgressing(deployment *appsv1.Deployment, newStatus *appsv1.DeploymentStatus) bool
- func DeploymentTimedOut(deployment *appsv1.Deployment, newStatus *appsv1.DeploymentStatus) bool
- func DescribeEvents(el *corev1.EventList)
- func DirExists(path string) (bool, error)
- func EqualIgnoreHash(template1, template2 corev1.PodTemplateSpec) bool
- func EventFieldSelectorFromResource(obj interface{}) string
- func EventFieldSelectorFromUnstructured(obj *unstructured.Unstructured) (field fields.Set, eventNs string)
- func FileExists(path string) (bool, error)
- func FindNewReplicaSet(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)
- func FindOldReplicaSets(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet) ([]*appsv1.ReplicaSet, []*appsv1.ReplicaSet, error)
- func FormatEventSource(es corev1.EventSource) string
- func GetAllReplicaSets(ctx context.Context, deployment *appsv1.Deployment, c kubernetes.Interface) ([]*appsv1.ReplicaSet, []*appsv1.ReplicaSet, *appsv1.ReplicaSet, error)
- func GetControllerOf(controllee metav1.Object) *metav1.OwnerReference
- func GetDeploymentCondition(status appsv1.DeploymentStatus, condType appsv1.DeploymentConditionType) *appsv1.DeploymentCondition
- func GetNewReplicaSetTemplate(deployment *appsv1.Deployment) corev1.PodTemplateSpec
- func GetPodReplicaSetName(pod *corev1.Pod) string
- func GetReference(obj runtime.Object) (*corev1.ObjectReference, error)
- func GreenF(format string, a ...interface{}) string
- func IsReplicaSetNew(deployment *appsv1.Deployment, rsMap map[string]*appsv1.ReplicaSet, ...) (bool, error)
- func JSONPath(tmpl string, input interface{}) (result string, found bool, err error)
- func ListEventsForObject(ctx context.Context, client kubernetes.Interface, obj interface{}) (*corev1.EventList, error)
- func ListEventsForUnstructured(ctx context.Context, client kubernetes.Interface, ...) (*corev1.EventList, error)
- func ListPods(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet, ...) (*corev1.PodList, error)
- func ListReplicaSets(deployment *appsv1.Deployment, getRSList rsListFunc) ([]*appsv1.ReplicaSet, error)
- func RedF(format string, a ...interface{}) string
- func Revision(obj runtime.Object) (int64, error)
- func TranslateTimestampSince(timestamp metav1.Time) string
- func YellowF(format string, a ...interface{}) string
- type ControllerMetadata
- type PodListFunc
- type ReplicaSetControllerWrapper
- func (w *ReplicaSetControllerWrapper) LabelSelector() *metav1.LabelSelector
- func (w *ReplicaSetControllerWrapper) Name() string
- func (w *ReplicaSetControllerWrapper) Namespace() string
- func (w *ReplicaSetControllerWrapper) NewReplicaSetTemplate() corev1.PodTemplateSpec
- func (w *ReplicaSetControllerWrapper) UID() types.UID
- type ReplicaSetsByCreationTimestamp
- type SortableEvents
- type Table
- func (t *Table) Commit(extraColumns ...interface{})
- func (t *Table) Header(columns ...interface{})
- func (t *Table) Render() string
- func (t *Table) Row(columns ...interface{})
- func (t *Table) Rows(rows ...[]interface{})
- func (t *Table) SetWidth(width int)
- func (t *Table) SubTable(columnsRatio ...float64) Table
Constants ¶
const ( // RevisionAnnotation is the revision annotation of a deployment's replica sets which records its rollout sequence RevisionAnnotation = "deployment.kubernetes.io/revision" // TimedOutReason is added in a deployment when its newest replica set fails to show any progress // within the given deadline (progressDeadlineSeconds). TimedOutReason = "ProgressDeadlineExceeded" )
Variables ¶
var ( ErrNilObject = errors.New("can't reference a nil object") ErrNoSelfLink = errors.New("selfLink was empty, can't make reference") )
Errors that could be returned by GetReference.
Functions ¶
func DeploymentProgressing ¶
func DeploymentProgressing(deployment *appsv1.Deployment, newStatus *appsv1.DeploymentStatus) bool
DeploymentProgressing reports progress for a deployment. Progress is estimated by comparing the current with the new status of the deployment that the controller is observing. More specifically, when new pods are scaled up or become available, or old pods are scaled down, then we consider the deployment is progressing.
func DeploymentTimedOut ¶
func DeploymentTimedOut(deployment *appsv1.Deployment, newStatus *appsv1.DeploymentStatus) bool
DeploymentTimedOut considers a deployment to have timed out once its condition that reports progress is older than progressDeadlineSeconds or a Progressing condition with a TimedOutReason reason already exists.
func DescribeEvents ¶
func EqualIgnoreHash ¶
func EqualIgnoreHash(template1, template2 corev1.PodTemplateSpec) bool
EqualIgnoreHash returns true if two given podTemplateSpec are equal, ignoring the diff in value of Labels[pod-template-hash] We ignore pod-template-hash because the hash result would be different upon podTemplateSpec API changes (e.g. the addition of a new field will cause the hash code to change) Note that we assume input podTemplateSpecs contain non-empty labels
func EventFieldSelectorFromResource ¶
func EventFieldSelectorFromResource(obj interface{}) string
func EventFieldSelectorFromUnstructured ¶ added in v0.7.0
func EventFieldSelectorFromUnstructured(obj *unstructured.Unstructured) (field fields.Set, eventNs string)
func FindNewReplicaSet ¶
func FindNewReplicaSet(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)
FindNewReplicaSet returns the new RS this given deployment targets (the one with the same pod template).
func FindOldReplicaSets ¶
func FindOldReplicaSets(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet) ([]*appsv1.ReplicaSet, []*appsv1.ReplicaSet, error)
FindOldReplicaSets returns the old replica sets targeted by the given Deployment, with the given slice of RSes. Note that the first set of old replica sets doesn't include the ones with no pods, and the second set of old replica sets include all old replica sets.
func FormatEventSource ¶
func FormatEventSource(es corev1.EventSource) string
FormatEventSource formats EventSource as a comma separated string excluding Host when empty
func GetAllReplicaSets ¶
func GetAllReplicaSets(ctx context.Context, deployment *appsv1.Deployment, c kubernetes.Interface) ([]*appsv1.ReplicaSet, []*appsv1.ReplicaSet, *appsv1.ReplicaSet, error)
GetAllReplicaSets returns the old and new replica sets targeted by the given Deployment. It gets PodList and ReplicaSetList from client interface. Note that the first set of old replica sets doesn't include the ones with no pods, and the second set of old replica sets include all old replica sets. The third returned value is the new replica set, and it may be nil if it doesn't exist yet.
func GetControllerOf ¶
func GetControllerOf(controllee metav1.Object) *metav1.OwnerReference
GetControllerOf returns the controllerRef if controllee has a controller, otherwise returns nil.
func GetDeploymentCondition ¶
func GetDeploymentCondition(status appsv1.DeploymentStatus, condType appsv1.DeploymentConditionType) *appsv1.DeploymentCondition
GetDeploymentCondition returns the condition with the provided type.
func GetNewReplicaSetTemplate ¶
func GetNewReplicaSetTemplate(deployment *appsv1.Deployment) corev1.PodTemplateSpec
GetNewReplicaSetTemplate returns the desired PodTemplateSpec for the new ReplicaSet corresponding to the given ReplicaSet. Callers of this helper need to set the DefaultDeploymentUniqueLabelKey k/v pair.
func GetPodReplicaSetName ¶
func GetReference ¶
func GetReference(obj runtime.Object) (*corev1.ObjectReference, error)
func IsReplicaSetNew ¶
func IsReplicaSetNew(deployment *appsv1.Deployment, rsMap map[string]*appsv1.ReplicaSet, rsName string) (bool, error)
func ListEventsForObject ¶
func ListEventsForUnstructured ¶ added in v0.7.0
func ListEventsForUnstructured(ctx context.Context, client kubernetes.Interface, obj *unstructured.Unstructured) (*corev1.EventList, error)
func ListPods ¶
func ListPods(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet, getPodList PodListFunc) (*corev1.PodList, error)
ListPods returns a list of pods the given deployment targets. This needs a list of ReplicaSets for the Deployment, which can be found with ListReplicaSets(). Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan), because only the controller itself should do that. However, it does filter out anything whose ControllerRef doesn't match.
func ListReplicaSets ¶
func ListReplicaSets(deployment *appsv1.Deployment, getRSList rsListFunc) ([]*appsv1.ReplicaSet, error)
ListReplicaSets returns a slice of RSes the given deployment targets. Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan), because only the controller itself should do that. However, it does filter out anything whose ControllerRef doesn't match.
func TranslateTimestampSince ¶
Types ¶
type ControllerMetadata ¶
type ControllerMetadata interface { NewReplicaSetTemplate() corev1.PodTemplateSpec LabelSelector() *metav1.LabelSelector Namespace() string Name() string UID() types.UID }
func ControllerAccessor ¶
func ControllerAccessor(controller interface{}) ControllerMetadata
type PodListFunc ¶
func PodListFromClient ¶
func PodListFromClient(ctx context.Context, c kubernetes.Interface) PodListFunc
PodListFromClient returns an PodListFunc that wraps the given client.
type ReplicaSetControllerWrapper ¶
type ReplicaSetControllerWrapper struct {
// contains filtered or unexported fields
}
func (*ReplicaSetControllerWrapper) LabelSelector ¶
func (w *ReplicaSetControllerWrapper) LabelSelector() *metav1.LabelSelector
func (*ReplicaSetControllerWrapper) Name ¶
func (w *ReplicaSetControllerWrapper) Name() string
func (*ReplicaSetControllerWrapper) Namespace ¶
func (w *ReplicaSetControllerWrapper) Namespace() string
func (*ReplicaSetControllerWrapper) NewReplicaSetTemplate ¶
func (w *ReplicaSetControllerWrapper) NewReplicaSetTemplate() corev1.PodTemplateSpec
func (*ReplicaSetControllerWrapper) UID ¶
func (w *ReplicaSetControllerWrapper) UID() types.UID
type ReplicaSetsByCreationTimestamp ¶
type ReplicaSetsByCreationTimestamp []*appsv1.ReplicaSet
ReplicaSetsByCreationTimestamp sorts a list of ReplicaSet by creation timestamp, using their names as a tie breaker.
func (ReplicaSetsByCreationTimestamp) Len ¶
func (o ReplicaSetsByCreationTimestamp) Len() int
func (ReplicaSetsByCreationTimestamp) Less ¶
func (o ReplicaSetsByCreationTimestamp) Less(i, j int) bool
func (ReplicaSetsByCreationTimestamp) Swap ¶
func (o ReplicaSetsByCreationTimestamp) Swap(i, j int)
type SortableEvents ¶
SortableEvents implements sort.Interface for []api.Event based on the Timestamp field
func (SortableEvents) Len ¶
func (list SortableEvents) Len() int
func (SortableEvents) Less ¶
func (list SortableEvents) Less(i, j int) bool
func (SortableEvents) Swap ¶
func (list SortableEvents) Swap(i, j int)