diff --git a/pkg/apis/extensions/types.go b/pkg/apis/extensions/types.go index 54bd36fd025..1315653f911 100644 --- a/pkg/apis/extensions/types.go +++ b/pkg/apis/extensions/types.go @@ -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 diff --git a/pkg/apis/extensions/v1beta1/types.go b/pkg/apis/extensions/v1beta1/types.go index 2ba338b9d5b..fd04457aeb2 100644 --- a/pkg/apis/extensions/v1beta1/types.go +++ b/pkg/apis/extensions/v1beta1/types.go @@ -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