Documentation ¶
Index ¶
- Variables
- func ByNumber(list Revisions) sort.Interface
- func ListControllerRevisionsAndPods(ctx context.Context, r client.Reader, namespace string, ...) (*appsv1.ControllerRevisionList, *corev1.PodList, error)
- func Sort(r Revisions)
- type ControllerRevision
- func (c *ControllerRevision) DeepCopyObject() runtime.Object
- func (c *ControllerRevision) GetObjectKind() schema.ObjectKind
- func (c *ControllerRevision) Name() string
- func (c *ControllerRevision) Number() int64
- func (c *ControllerRevision) Object() client.Object
- func (c *ControllerRevision) PodTemplate() *corev1.Pod
- type DaemonSetHistory
- type DeploymentHistory
- type History
- type PodPredicate
- type ReplicaSet
- func (r *ReplicaSet) CurrentReplicas() int32
- func (r *ReplicaSet) DeepCopyObject() runtime.Object
- func (r *ReplicaSet) GetObjectKind() schema.ObjectKind
- func (r *ReplicaSet) Name() string
- func (r *ReplicaSet) Number() int64
- func (r *ReplicaSet) Object() client.Object
- func (r *ReplicaSet) PodTemplate() *corev1.Pod
- func (r *ReplicaSet) ReadyReplicas() int32
- type Replicas
- type Revision
- type Revisions
- type StatefulSetHistory
Constants ¶
This section is empty.
Variables ¶
var AddToScheme = localSchemeBuilder.AddToScheme
AddToScheme adds all types necessary to handle history-related objects to the given scheme.
var DecodingVersions = []schema.GroupVersion{ corev1.SchemeGroupVersion, appsv1.SchemeGroupVersion, }
DecodingVersions is a list of GroupVersions that need to be decoded for handling history-related objects.
var Scheme = runtime.NewScheme()
Scheme is a *runtime.Scheme including all types necessary to handle history-related objects.
var SupportedKinds = []string{"Deployment", "StatefulSet", "DaemonSet"}
SupportedKinds is a list of object kinds supported by this package.
Functions ¶
func ByNumber ¶
ByNumber returns an implementation of the sort.Interface for sorting Revisions by number.
func ListControllerRevisionsAndPods ¶ added in v0.4.0
func ListControllerRevisionsAndPods(ctx context.Context, r client.Reader, namespace string, selector *metav1.LabelSelector) (*appsv1.ControllerRevisionList, *corev1.PodList, error)
ListControllerRevisionsAndPods is a helper for a ControllerRevision-based History implementation that needs to find all ControllerRevisions and Pods belonging to a given workload object.
Types ¶
type ControllerRevision ¶
type ControllerRevision struct { ControllerRevision *appsv1.ControllerRevision Template *corev1.Pod Replicas }
ControllerRevision is a Revision of a StatefulSet or DaemonSet.
func NewControllerRevisionForDaemonSet ¶
func NewControllerRevisionForDaemonSet(controllerRevision *appsv1.ControllerRevision) (*ControllerRevision, error)
NewControllerRevisionForDaemonSet transforms the given ControllerRevision of a DaemonSet to a Revision object.
func NewControllerRevisionForStatefulSet ¶
func NewControllerRevisionForStatefulSet(controllerRevision *appsv1.ControllerRevision) (*ControllerRevision, error)
NewControllerRevisionForStatefulSet transforms the given ControllerRevision of a StatefulSet to a Revision object.
func (*ControllerRevision) DeepCopyObject ¶
func (c *ControllerRevision) DeepCopyObject() runtime.Object
DeepCopyObject implements runtime.Object.
func (*ControllerRevision) GetObjectKind ¶
func (c *ControllerRevision) GetObjectKind() schema.ObjectKind
GetObjectKind implements runtime.Object.
func (*ControllerRevision) Name ¶
func (c *ControllerRevision) Name() string
func (*ControllerRevision) Number ¶
func (c *ControllerRevision) Number() int64
func (*ControllerRevision) Object ¶
func (c *ControllerRevision) Object() client.Object
func (*ControllerRevision) PodTemplate ¶
func (c *ControllerRevision) PodTemplate() *corev1.Pod
type DaemonSetHistory ¶
DaemonSetHistory implements the History interface for DaemonSets.
func (DaemonSetHistory) ListRevisions ¶
type DeploymentHistory ¶
DeploymentHistory implements the History interface for Deployments.
func (DeploymentHistory) ListRevisions ¶
type History ¶
type History interface { // ListRevisions returns a sorted revision history (ascending) of the given object. ListRevisions(ctx context.Context, obj client.Object) (Revisions, error) }
History is a kind-specific client that knows how to access the revision history of objects of that kind. Instantiate a History with For or ForGroupKind. Alternatively, use ListRevisions as a shortcut for listing revisions of a single object.
func For ¶
For instantiates a new History client for the given Object. Note that the object is only used to determine the GroupKind to pass to ForGroupKind. The object for which to list revisions must be passed to History.ListRevisions. I.e., the following
history.For(c, &appsv1.Deployment{})
is a convenient shortcut for
history.ForGroupKind(c, appsv1.SchemeGroupVersion.WithKind("Deployment").GroupKind())
type PodPredicate ¶ added in v0.4.0
func PodBelongsToDaemonSetRevision ¶ added in v0.4.0
func PodBelongsToDaemonSetRevision(revision *appsv1.ControllerRevision) PodPredicate
func PodBelongsToStatefulSetRevision ¶ added in v0.4.0
func PodBelongsToStatefulSetRevision(revision *appsv1.ControllerRevision) PodPredicate
type ReplicaSet ¶
type ReplicaSet struct { ReplicaSet *appsv1.ReplicaSet // contains filtered or unexported fields }
ReplicaSet is a Revision of a Deployment.
func NewReplicaSet ¶
func NewReplicaSet(replicaSet *appsv1.ReplicaSet) (*ReplicaSet, error)
NewReplicaSet transforms the given ReplicaSet to a Revision object.
func (*ReplicaSet) CurrentReplicas ¶ added in v0.4.0
func (r *ReplicaSet) CurrentReplicas() int32
func (*ReplicaSet) DeepCopyObject ¶
func (r *ReplicaSet) DeepCopyObject() runtime.Object
DeepCopyObject implements runtime.Object.
func (*ReplicaSet) GetObjectKind ¶
func (r *ReplicaSet) GetObjectKind() schema.ObjectKind
GetObjectKind implements runtime.Object.
func (*ReplicaSet) Name ¶
func (r *ReplicaSet) Name() string
func (*ReplicaSet) Number ¶
func (r *ReplicaSet) Number() int64
func (*ReplicaSet) Object ¶
func (r *ReplicaSet) Object() client.Object
func (*ReplicaSet) PodTemplate ¶
func (r *ReplicaSet) PodTemplate() *corev1.Pod
func (*ReplicaSet) ReadyReplicas ¶ added in v0.4.0
func (r *ReplicaSet) ReadyReplicas() int32
type Replicas ¶ added in v0.4.0
type Replicas struct {
Current, Ready int32
}
Replicas is a common struct for storing numbers of replicas.
func CountReplicas ¶ added in v0.4.0
func CountReplicas(podList *corev1.PodList, predicate PodPredicate) Replicas
CountReplicas counts the number of total and ready replicas matching the given predicate in the list of pods.
func (Replicas) CurrentReplicas ¶ added in v0.4.0
func (Replicas) ReadyReplicas ¶ added in v0.4.0
type Revision ¶
type Revision interface { // Object is embedded in Revision so that Revision objects can be passed around like a printable API object to // printers.ResourcePrinter. runtime.Object // Number returns the revision number identifying this Revision. Number() int64 // Name returns the name of the underlying revision object. Name() string // Object returns the full revision object (e.g., *appsv1.ReplicaSet or *appsv1.ControllerRevision). Object() client.Object // PodTemplate returns the PodTemplate that was specified in this revision of the object. PodTemplate() *corev1.Pod // CurrentReplicas returns the total number of replicas belonging to the Revision. CurrentReplicas() int32 // ReadyReplicas returns the number of ready replicas belonging to the Revision. ReadyReplicas() int32 }
Revision represents a single revision in the history of a workload object. E.g., a ReplicaSet in a Deployment's history.
type Revisions ¶
type Revisions []Revision
Revisions is a list of Revision objects.
func ListRevisions ¶ added in v0.4.0
ListRevisions returns a sorted revision history (ascending) of the given object. This is a convenient shortcut for using For and calling History.ListRevisions.
func (Revisions) ByNumber ¶
ByNumber finds the Revision with the given revision number in a sorted revision list. -1 denotes the latest revision, -2 the previous one, etc.
func (Revisions) DeepCopyObject ¶
DeepCopyObject implements runtime.Object.
func (Revisions) GetObjectKind ¶
func (r Revisions) GetObjectKind() schema.ObjectKind
GetObjectKind implements runtime.Object.
type StatefulSetHistory ¶
StatefulSetHistory implements the History interface for StatefulSets.