Documentation ¶
Index ¶
- Constants
- func FindNewReplicaSet(deployment *extensions.Deployment, rsList []extensions.ReplicaSet) (*extensions.ReplicaSet, error)
- func FindOldReplicaSets(deployment *extensions.Deployment, rsList []extensions.ReplicaSet, ...) ([]*extensions.ReplicaSet, []*extensions.ReplicaSet, error)
- func GetActualReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int32
- func GetAvailablePodsForReplicaSets(c clientset.Interface, rss []*extensions.ReplicaSet, minReadySeconds int32) (int32, error)
- func GetNewReplicaSet(deployment *extensions.Deployment, c clientset.Interface) (*extensions.ReplicaSet, error)
- func GetNewReplicaSetTemplate(deployment *extensions.Deployment) api.PodTemplateSpec
- func GetOldReplicaSets(deployment *extensions.Deployment, c clientset.Interface) ([]*extensions.ReplicaSet, []*extensions.ReplicaSet, error)
- func GetPodsForReplicaSets(c clientset.Interface, replicaSets []*extensions.ReplicaSet) ([]api.Pod, error)
- func GetReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int32
- func IsPodAvailable(pod *api.Pod, minReadySeconds int32) bool
- func IsRollingUpdate(deployment *extensions.Deployment) bool
- func LabelPodsWithHash(podList *api.PodList, rs *extensions.ReplicaSet, c clientset.Interface, ...) (bool, error)
- func ListPods(deployment *extensions.Deployment, getPodList podListFunc) (*api.PodList, error)
- func ListReplicaSets(deployment *extensions.Deployment, getRSList rsListFunc) ([]extensions.ReplicaSet, error)
- func NewRSNewReplicas(deployment *extensions.Deployment, allRSs []*extensions.ReplicaSet, ...) (int32, error)
- func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired int32) (int32, int32, error)
- func Revision(rs *extensions.ReplicaSet) (int64, error)
- func SetFromReplicaSetTemplate(deployment *extensions.Deployment, template api.PodTemplateSpec) *extensions.Deployment
- func WaitForObservedDeployment(getDeploymentFunc func() (*extensions.Deployment, error), ...) error
- func WaitForPodsHashPopulated(c clientset.Interface, desiredGeneration int64, namespace, name string) error
- func WaitForReplicaSetUpdated(c clientset.Interface, desiredGeneration int64, namespace, name string) error
Constants ¶
const ( // The revision annotation of a deployment's replica sets which records its rollout sequence RevisionAnnotation = "deployment.kubernetes.io/revision" // Here are the possible rollback event reasons RollbackRevisionNotFound = "DeploymentRollbackRevisionNotFound" RollbackTemplateUnchanged = "DeploymentRollbackTemplateUnchanged" RollbackDone = "DeploymentRollback" )
Variables ¶
This section is empty.
Functions ¶
func FindNewReplicaSet ¶
func FindNewReplicaSet(deployment *extensions.Deployment, rsList []extensions.ReplicaSet) (*extensions.ReplicaSet, error)
FindNewReplicaSet returns the new RS this given deployment targets (the one with the same pod template).
func FindOldReplicaSets ¶
func FindOldReplicaSets(deployment *extensions.Deployment, rsList []extensions.ReplicaSet, podList *api.PodList) ([]*extensions.ReplicaSet, []*extensions.ReplicaSet, error)
FindOldReplicaSets returns the old replica sets targeted by the given Deployment, with the given PodList and 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 GetActualReplicaCountForReplicaSets ¶
func GetActualReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int32
GetActualReplicaCountForReplicaSets returns the sum of actual replicas of the given replica sets.
func GetAvailablePodsForReplicaSets ¶
func GetAvailablePodsForReplicaSets(c clientset.Interface, rss []*extensions.ReplicaSet, minReadySeconds int32) (int32, error)
Returns the number of available pods corresponding to the given replica sets.
func GetNewReplicaSet ¶
func GetNewReplicaSet(deployment *extensions.Deployment, c clientset.Interface) (*extensions.ReplicaSet, error)
GetNewReplicaSet returns a replica set that matches the intent of the given deployment; get ReplicaSetList from client interface. Returns nil if the new replica set doesn't exist yet.
func GetNewReplicaSetTemplate ¶
func GetNewReplicaSetTemplate(deployment *extensions.Deployment) api.PodTemplateSpec
Returns the desired PodTemplateSpec for the new ReplicaSet corresponding to the given ReplicaSet.
func GetOldReplicaSets ¶
func GetOldReplicaSets(deployment *extensions.Deployment, c clientset.Interface) ([]*extensions.ReplicaSet, []*extensions.ReplicaSet, error)
GetOldReplicaSets returns the old replica sets targeted by the given Deployment; get 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.
func GetPodsForReplicaSets ¶
func GetPodsForReplicaSets(c clientset.Interface, replicaSets []*extensions.ReplicaSet) ([]api.Pod, error)
func GetReplicaCountForReplicaSets ¶
func GetReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int32
Returns the sum of Replicas of the given replica sets.
func IsRollingUpdate ¶
func IsRollingUpdate(deployment *extensions.Deployment) bool
func LabelPodsWithHash ¶
func LabelPodsWithHash(podList *api.PodList, rs *extensions.ReplicaSet, c clientset.Interface, namespace, hash string) (bool, error)
LabelPodsWithHash labels all pods in the given podList with the new hash label. The returned bool value can be used to tell if all pods are actually labeled.
func ListPods ¶
func ListPods(deployment *extensions.Deployment, getPodList podListFunc) (*api.PodList, error)
ListPods returns a list of pods the given deployment targets.
func ListReplicaSets ¶
func ListReplicaSets(deployment *extensions.Deployment, getRSList rsListFunc) ([]extensions.ReplicaSet, error)
ListReplicaSets returns a slice of RSes the given deployment targets.
func NewRSNewReplicas ¶
func NewRSNewReplicas(deployment *extensions.Deployment, allRSs []*extensions.ReplicaSet, newRS *extensions.ReplicaSet) (int32, error)
NewRSNewReplicas calculates the number of replicas a deployment's new RS should have. When one of the followings is true, we're rolling out the deployment; otherwise, we're scaling it. 1) The new RS is saturated: newRS's replicas == deployment's replicas 2) Max number of pods allowed is reached: deployment's replicas + maxSurge == all RSs' replicas
func ResolveFenceposts ¶
func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired int32) (int32, int32, error)
ResolveFenceposts resolves both maxSurge and maxUnavailable. This needs to happen in one step. For example:
2 desired, max unavailable 1%, surge 0% - should scale old(-1), then new(+1), then old(-1), then new(+1) 1 desired, max unavailable 1%, surge 0% - should scale old(-1), then new(+1) 2 desired, max unavailable 25%, surge 1% - should scale new(+1), then old(-1), then new(+1), then old(-1) 1 desired, max unavailable 25%, surge 1% - should scale new(+1), then old(-1) 2 desired, max unavailable 0%, surge 1% - should scale new(+1), then old(-1), then new(+1), then old(-1) 1 desired, max unavailable 0%, surge 1% - should scale new(+1), then old(-1)
func Revision ¶
func Revision(rs *extensions.ReplicaSet) (int64, error)
Revision returns the revision number of the input replica set
func SetFromReplicaSetTemplate ¶
func SetFromReplicaSetTemplate(deployment *extensions.Deployment, template api.PodTemplateSpec) *extensions.Deployment
SetFromReplicaSetTemplate sets the desired PodTemplateSpec from a replica set template to the given deployment.
func WaitForObservedDeployment ¶
func WaitForObservedDeployment(getDeploymentFunc func() (*extensions.Deployment, error), desiredGeneration int64, interval, timeout time.Duration) error
Polls for deployment to be updated so that deployment.Status.ObservedGeneration >= desiredGeneration. Returns error if polling timesout.
Types ¶
This section is empty.