Add new types for DaemonSet update.

This commit is contained in:
Madhusudan.C.S 2015-12-07 16:58:35 -08:00
parent a5d2c1b0fb
commit 6a6699a1b2
2 changed files with 90 additions and 0 deletions

View File

@ -308,6 +308,48 @@ type DeploymentList struct {
Items []Deployment `json:"items"`
}
type DaemonSetUpdateStrategy struct {
// Type of daemon set update. Only "RollingUpdate" is supported at this time. Default is RollingUpdate.
Type DaemonSetUpdateStrategyType `json:"type,omitempty"`
// Rolling update config params. Present only if DeploymentStrategyType =
// RollingUpdate.
//---
// TODO: Update this to follow our convention for oneOf, whatever we decide it
// to be. Same as DeploymentStrategy.RollingUpdate
RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty"`
}
type DaemonSetUpdateStrategyType string
const (
// Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other.
RollingUpdateDaemonSetUpdateStrategyType DaemonSetUpdateStrategyType = "RollingUpdate"
)
// Spec to control the desired behavior of daemon set rolling update.
type RollingUpdateDaemonSet struct {
// The maximum number of DaemonSet pods that can be unavailable during the
// update. Value can be an absolute number (ex: 5) or a percentage of total
// number of DaemonSet pods at the start of the update (ex: 10%). Absolute
// number is calculated from percentage by rounding up.
// Default value is 1.
// Example: when this is set to 30%, 30% of the currently running DaemonSet
// pods can be stopped for an update at any given time. The update starts
// by stopping at most 30% of the currently running DaemonSet pods and then
// brings up new DaemonSet pods in their place. Once the new pods are ready,
// it then proceeds onto other DaemonSet pods, thus ensuring that at least
// 70% of original number of DaemonSet pods are available at all times
// during the update.
MaxUnavailable intstr.IntOrString `json:"maxUnavailable,omitempty"`
// Minimum number of seconds for which a newly created DaemonSet pod should
// be ready without any of its container crashing, for it to be considered
// available. Defaults to 0 (pod will be considered available as soon as it
// is ready).
MinReadySeconds int `json:"minReadySeconds,omitempty"`
}
// DaemonSetSpec is the specification of a daemon set.
type DaemonSetSpec struct {
// Selector is a label query over pods that are managed by the daemon set.
@ -316,6 +358,9 @@ type DaemonSetSpec struct {
// More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors
Selector *LabelSelector `json:"selector,omitempty"`
// The update strategy to use to replace existing DaemonSet with a new one.
Strategy DaemonSetUpdateStrategy `json:"strategy,omitempty"`
// Template is the object that describes the pod that will be created.
// The DaemonSet will create exactly one copy of this pod on every node
// that matches the template's node selector (or on every node if no node

View File

@ -298,6 +298,48 @@ type DeploymentList struct {
Items []Deployment `json:"items"`
}
type DaemonSetUpdateStrategy struct {
// Type of daemon set update. Only "RollingUpdate" is supported at this time. Default is RollingUpdate.
Type DaemonSetUpdateStrategyType `json:"type,omitempty"`
// Rolling update config params. Present only if DeploymentStrategyType =
// RollingUpdate.
//---
// TODO: Update this to follow our convention for oneOf, whatever we decide it
// to be. Same as DeploymentStrategy.RollingUpdate
RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty"`
}
type DaemonSetUpdateStrategyType string
const (
// Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other.
RollingUpdateDaemonSetUpdateStrategyType DaemonSetUpdateStrategyType = "RollingUpdate"
)
// Spec to control the desired behavior of daemon set rolling update.
type RollingUpdateDaemonSet struct {
// The maximum number of DaemonSet pods that can be unavailable during the
// update. Value can be an absolute number (ex: 5) or a percentage of total
// number of DaemonSet pods at the start of the update (ex: 10%). Absolute
// number is calculated from percentage by rounding up.
// Default value is 1.
// Example: when this is set to 30%, 30% of the currently running DaemonSet
// pods can be stopped for an update at any given time. The update starts
// by stopping at most 30% of the currently running DaemonSet pods and then
// brings up new DaemonSet pods in their place. Once the new pods are ready,
// it then proceeds onto other DaemonSet pods, thus ensuring that at least
// 70% of original number of DaemonSet pods are available at all times
// during the update.
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
// Minimum number of seconds for which a newly created DaemonSet pod should
// be ready without any of its container crashing, for it to be considered
// available. Defaults to 0 (pod will be considered available as soon as it
// is ready).
MinReadySeconds int32 `json:"minReadySeconds,omitempty"`
}
// DaemonSetSpec is the specification of a daemon set.
type DaemonSetSpec struct {
// Selector is a label query over pods that are managed by the daemon set.
@ -306,6 +348,9 @@ type DaemonSetSpec struct {
// More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors
Selector *LabelSelector `json:"selector,omitempty"`
// The update strategy to use to replace existing DaemonSet with a new one.
Strategy DaemonSetUpdateStrategy `json:"strategy,omitempty"`
// Template is the object that describes the pod that will be created.
// The DaemonSet will create exactly one copy of this pod on every node
// that matches the template's node selector (or on every node if no node