Documentation ¶
Index ¶
- func AbortRollingUpdate(c *RollingUpdaterConfig) error
- func AddDeploymentKeyToReplicationController(oldRc *corev1.ReplicationController, ...) (*corev1.ReplicationController, error)
- func CreateNewControllerFromCurrentController(rcClient corev1client.ReplicationControllersGetter, codec runtime.Codec, ...) (*corev1.ReplicationController, error)
- func FindSourceController(r corev1client.ReplicationControllersGetter, namespace, name string) (*corev1.ReplicationController, error)
- func GetNextControllerAnnotation(rc *corev1.ReplicationController) (string, bool)
- func LoadExistingNextReplicationController(c corev1client.ReplicationControllersGetter, namespace, newName string) (*corev1.ReplicationController, error)
- func NewCmdRollingUpdate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command
- func Rename(c corev1client.ReplicationControllersGetter, rc *corev1.ReplicationController, ...) error
- func SetNextControllerAnnotation(rc *corev1.ReplicationController, name string)
- func UpdateExistingReplicationController(rcClient corev1client.ReplicationControllersGetter, ...) (*corev1.ReplicationController, error)
- type NewControllerConfig
- type RollingUpdateOptions
- type RollingUpdater
- type RollingUpdaterCleanupPolicy
- type RollingUpdaterConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbortRollingUpdate ¶
func AbortRollingUpdate(c *RollingUpdaterConfig) error
func AddDeploymentKeyToReplicationController ¶
func AddDeploymentKeyToReplicationController(oldRc *corev1.ReplicationController, rcClient corev1client.ReplicationControllersGetter, podClient corev1client.PodsGetter, deploymentKey, deploymentValue, namespace string, out io.Writer) (*corev1.ReplicationController, error)
func CreateNewControllerFromCurrentController ¶
func CreateNewControllerFromCurrentController(rcClient corev1client.ReplicationControllersGetter, codec runtime.Codec, cfg *NewControllerConfig) (*corev1.ReplicationController, error)
func FindSourceController ¶
func FindSourceController(r corev1client.ReplicationControllersGetter, namespace, name string) (*corev1.ReplicationController, error)
func GetNextControllerAnnotation ¶
func GetNextControllerAnnotation(rc *corev1.ReplicationController) (string, bool)
func LoadExistingNextReplicationController ¶
func LoadExistingNextReplicationController(c corev1client.ReplicationControllersGetter, namespace, newName string) (*corev1.ReplicationController, error)
func NewCmdRollingUpdate ¶
func Rename ¶
func Rename(c corev1client.ReplicationControllersGetter, rc *corev1.ReplicationController, newName string) error
func SetNextControllerAnnotation ¶
func SetNextControllerAnnotation(rc *corev1.ReplicationController, name string)
func UpdateExistingReplicationController ¶
func UpdateExistingReplicationController(rcClient corev1client.ReplicationControllersGetter, podClient corev1client.PodsGetter, oldRc *corev1.ReplicationController, namespace, newName, deploymentKey, deploymentValue string, out io.Writer) (*corev1.ReplicationController, error)
Types ¶
type NewControllerConfig ¶
type RollingUpdateOptions ¶
type RollingUpdateOptions struct { FilenameOptions *resource.FilenameOptions OldName string KeepOldName bool DeploymentKey string Image string Container string PullPolicy string Rollback bool Period time.Duration Timeout time.Duration Interval time.Duration DryRun bool OutputFormat string Namespace string EnforceNamespace bool ScaleClient scaleclient.ScalesGetter ClientSet kubernetes.Interface Builder *resource.Builder ShouldValidate bool Validator func(bool) (validation.Schema, error) FindNewName func(*corev1.ReplicationController) string PrintFlags *genericclioptions.PrintFlags ToPrinter func(string) (printers.ResourcePrinter, error) genericclioptions.IOStreams }
func NewRollingUpdateOptions ¶
func NewRollingUpdateOptions(streams genericclioptions.IOStreams) *RollingUpdateOptions
func (*RollingUpdateOptions) Run ¶
func (o *RollingUpdateOptions) Run() error
type RollingUpdater ¶
type RollingUpdater struct {
// contains filtered or unexported fields
}
RollingUpdater provides methods for updating replicated pods in a predictable, fault-tolerant way.
func NewRollingUpdater ¶
func NewRollingUpdater(namespace string, rcClient corev1client.ReplicationControllersGetter, podClient corev1client.PodsGetter, sc scaleclient.ScalesGetter) *RollingUpdater
NewRollingUpdater creates a RollingUpdater from a client.
func (*RollingUpdater) Update ¶
func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error
Update all pods for a ReplicationController (oldRc) by creating a new controller (newRc) with 0 replicas, and synchronously scaling oldRc and newRc until oldRc has 0 replicas and newRc has the original # of desired replicas. Cleanup occurs based on a RollingUpdaterCleanupPolicy.
Each interval, the updater will attempt to make progress however it can without violating any availability constraints defined by the config. This means the amount scaled up or down each interval will vary based on the timeliness of readiness and the updater will always try to make progress, even slowly.
If an update from newRc to oldRc is already in progress, we attempt to drive it to completion. If an error occurs at any step of the update, the error will be returned.
A scaling event (either up or down) is considered progress; if no progress is made within the config.Timeout, an error is returned.
TODO: make this handle performing a rollback of a partially completed rollout.
type RollingUpdaterCleanupPolicy ¶
type RollingUpdaterCleanupPolicy string
RollingUpdaterCleanupPolicy is a cleanup action to take after the deployment is complete.
const ( // DeleteRollingUpdateCleanupPolicy means delete the old controller. DeleteRollingUpdateCleanupPolicy RollingUpdaterCleanupPolicy = "Delete" // PreserveRollingUpdateCleanupPolicy means keep the old controller. PreserveRollingUpdateCleanupPolicy RollingUpdaterCleanupPolicy = "Preserve" // RenameRollingUpdateCleanupPolicy means delete the old controller, and rename // the new controller to the name of the old controller. RenameRollingUpdateCleanupPolicy RollingUpdaterCleanupPolicy = "Rename" )
type RollingUpdaterConfig ¶
type RollingUpdaterConfig struct { // Out is a writer for progress output. Out io.Writer // OldRC is an existing controller to be replaced. OldRc *corev1.ReplicationController // NewRc is a controller that will take ownership of updated pods (will be // created if needed). NewRc *corev1.ReplicationController // UpdatePeriod is the time to wait between individual pod updates. UpdatePeriod time.Duration // Interval is the time to wait between polling controller status after // update. Interval time.Duration // Timeout is the time to wait for controller updates before giving up. Timeout time.Duration // MinReadySeconds is the number of seconds to wait after the pods are ready MinReadySeconds int32 // CleanupPolicy defines the cleanup action to take after the deployment is // complete. CleanupPolicy RollingUpdaterCleanupPolicy // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). // Absolute number is calculated from percentage by rounding up. // This can not be 0 if MaxSurge is 0. // By default, a fixed value of 1 is used. // Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods // immediately when the rolling update starts. Once new pods are ready, old RC // can be scaled down further, followed by scaling up the new RC, ensuring // that the total number of pods available at all times during the update is at // least 70% of desired pods. MaxUnavailable intstr.IntOrString // MaxSurge is the maximum number of pods that can be scheduled above the desired number of pods. // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). // This can not be 0 if MaxUnavailable is 0. // Absolute number is calculated from percentage by rounding up. // By default, a value of 1 is used. // Example: when this is set to 30%, the new RC can be scaled up immediately // when the rolling update starts, such that the total number of old and new pods do not exceed // 130% of desired pods. Once old pods have been killed, new RC can be scaled up // further, ensuring that total number of pods running at any time during // the update is at most 130% of desired pods. MaxSurge intstr.IntOrString // OnProgress is invoked if set during each scale cycle, to allow the caller to perform additional logic or // abort the scale. If an error is returned the cleanup method will not be invoked. The percentage value // is a synthetic "progress" calculation that represents the approximate percentage completion. OnProgress func(oldRc, newRc *corev1.ReplicationController, percentage int) error }
RollingUpdaterConfig is the configuration for a rolling deployment process.