Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 124 additions & 2 deletions docs/documents/apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,60 @@ Kubernetes meta/v1.Time
</tbody>
</table>
<br>
<h3 id="machine.sapcloud.io/v1alpha1.InPlaceUpdateMachineDeployment">
<b>InPlaceUpdateMachineDeployment</b>
</h3>
<p>
(<em>Appears on:</em>
<a href="#machine.sapcloud.io/v1alpha1.MachineDeploymentStrategy">MachineDeploymentStrategy</a>)
</p>
<p>
<p>InPlaceUpdateMachineDeployment specifies the spec to control the desired behavior of inplace update.</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>UpdateConfiguration</code>
</td>
<td>
<em>
<a href="#machine.sapcloud.io/v1alpha1.UpdateConfiguration">
UpdateConfiguration
</a>
</em>
</td>
<td>
<p>
(Members of <code>UpdateConfiguration</code> are embedded into this type.)
</p>
</td>
</tr>
<tr>
<td>
<code>orchestrationType</code>
</td>
<td>
<em>
<a href="#machine.sapcloud.io/v1alpha1.OrchestrationType">
OrchestrationType
</a>
</em>
</td>
<td>
<p>OrchestrationType specifies the orchestration type for the inplace update.</p>
</td>
</tr>
</tbody>
</table>
<br>
<h3 id="machine.sapcloud.io/v1alpha1.LastOperation">
<b>LastOperation</b>
</h3>
Expand Down Expand Up @@ -1525,6 +1579,23 @@ RollingUpdateMachineDeployment
to be.</p>
</td>
</tr>
<tr>
<td>
<code>inPlaceUpdate</code>
</td>
<td>
<em>
<a href="#machine.sapcloud.io/v1alpha1.InPlaceUpdateMachineDeployment">
InPlaceUpdateMachineDeployment
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>InPlaceUpdate update config params. Present only if MachineDeploymentStrategyType =
InPlaceUpdate.</p>
</td>
</tr>
</tbody>
</table>
<br>
Expand Down Expand Up @@ -2535,6 +2606,17 @@ see: <a href="https://issues.k8s.io/61966">https://issues.k8s.io/61966</a></p>
</tbody>
</table>
<br>
<h3 id="machine.sapcloud.io/v1alpha1.OrchestrationType">
<b>OrchestrationType</b>
(<code>string</code> alias)</p></h3>
<p>
(<em>Appears on:</em>
<a href="#machine.sapcloud.io/v1alpha1.InPlaceUpdateMachineDeployment">InPlaceUpdateMachineDeployment</a>)
</p>
<p>
<p>OrchestrationType specifies the orchestration type for the inplace update.</p>
</p>
<br>
<h3 id="machine.sapcloud.io/v1alpha1.RollbackConfig">
<b>RollbackConfig</b>
</h3>
Expand Down Expand Up @@ -2592,6 +2674,46 @@ int64
<tbody>
<tr>
<td>
<code>UpdateConfiguration</code>
</td>
<td>
<em>
<a href="#machine.sapcloud.io/v1alpha1.UpdateConfiguration">
UpdateConfiguration
</a>
</em>
</td>
<td>
<p>
(Members of <code>UpdateConfiguration</code> are embedded into this type.)
</p>
</td>
</tr>
</tbody>
</table>
<br>
<h3 id="machine.sapcloud.io/v1alpha1.UpdateConfiguration">
<b>UpdateConfiguration</b>
</h3>
<p>
(<em>Appears on:</em>
<a href="#machine.sapcloud.io/v1alpha1.InPlaceUpdateMachineDeployment">InPlaceUpdateMachineDeployment</a>,
<a href="#machine.sapcloud.io/v1alpha1.RollingUpdateMachineDeployment">RollingUpdateMachineDeployment</a>)
</p>
<p>
<p>UpdateConfiguration specifies the udpate configuration for the deployment strategy.</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>maxUnavailable</code>
</td>
<td>
Expand All @@ -2608,7 +2730,7 @@ Value can be an absolute number (ex: 5) or a percentage of desired machines (ex:
Absolute number is calculated from percentage by rounding down.
This can not be 0 if MaxSurge is 0.
Example: when this is set to 30%, the old machine set can be scaled down to 70% of desired machines
immediately when the rolling update starts. Once new machines are ready, old machine set
immediately when the update starts. Once new machines are ready, old machine set
can be scaled down further, followed by scaling up the new machine set, ensuring
that the total number of machines available at all times during the update is at
least 70% of desired machines.</p>
Expand All @@ -2633,7 +2755,7 @@ Value can be an absolute number (ex: 5) or a percentage of desired machines (ex:
This can not be 0 if MaxUnavailable is 0.
Absolute number is calculated from percentage by rounding up.
Example: when this is set to 30%, the new machine set can be scaled up immediately when
the rolling update starts, such that the total number of old and new machines does not exceed
the update starts, such that the total number of old and new machines does not exceed
130% of desired machines. Once old machines have been killed,
new machine set can be scaled up further, ensuring that total number of machines running
at any time during the update is utmost 130% of desired machines.</p>
Expand Down
45 changes: 43 additions & 2 deletions kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,47 @@ spec:
description: The MachineDeployment strategy to use to replace existing
machines with new ones.
properties:
inPlaceUpdate:
description: |-
InPlaceUpdate update config params. Present only if MachineDeploymentStrategyType =
InPlaceUpdate.
properties:
maxSurge:
anyOf:
- type: integer
- type: string
description: |-
The maximum number of machines that can be scheduled above the desired number of
machines.
Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%).
This can not be 0 if MaxUnavailable is 0.
Absolute number is calculated from percentage by rounding up.
Example: when this is set to 30%, the new machine set can be scaled up immediately when
the update starts, such that the total number of old and new machines does not exceed
130% of desired machines. Once old machines have been killed,
new machine set can be scaled up further, ensuring that total number of machines running
at any time during the update is utmost 130% of desired machines.
x-kubernetes-int-or-string: true
maxUnavailable:
anyOf:
- type: integer
- type: string
description: |-
The maximum number of machines that can be unavailable during the update.
Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%).
Absolute number is calculated from percentage by rounding down.
This can not be 0 if MaxSurge is 0.
Example: when this is set to 30%, the old machine set can be scaled down to 70% of desired machines
immediately when the update starts. Once new machines are ready, old machine set
can be scaled down further, followed by scaling up the new machine set, ensuring
that the total number of machines available at all times during the update is at
least 70% of desired machines.
x-kubernetes-int-or-string: true
orchestrationType:
description: OrchestrationType specifies the orchestration
type for the inplace update.
type: string
type: object
rollingUpdate:
description: |-
Rolling update config params. Present only if MachineDeploymentStrategyType =
Expand All @@ -180,7 +221,7 @@ spec:
This can not be 0 if MaxUnavailable is 0.
Absolute number is calculated from percentage by rounding up.
Example: when this is set to 30%, the new machine set can be scaled up immediately when
the rolling update starts, such that the total number of old and new machines does not exceed
the update starts, such that the total number of old and new machines does not exceed
130% of desired machines. Once old machines have been killed,
new machine set can be scaled up further, ensuring that total number of machines running
at any time during the update is utmost 130% of desired machines.
Expand All @@ -195,7 +236,7 @@ spec:
Absolute number is calculated from percentage by rounding down.
This can not be 0 if MaxSurge is 0.
Example: when this is set to 30%, the old machine set can be scaled down to 70% of desired machines
immediately when the rolling update starts. Once new machines are ready, old machine set
immediately when the update starts. Once new machines are ready, old machine set
can be scaled down further, followed by scaling up the new machine set, ensuring
that the total number of machines available at all times during the update is at
least 70% of desired machines.
Expand Down
35 changes: 33 additions & 2 deletions pkg/apis/machine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ type MachineDeploymentStrategy struct {
// TODO: Update this to follow our convention for oneOf, whatever we decide it
// to be.
RollingUpdate *RollingUpdateMachineDeployment

// InPlaceUpdate update config params. Present only if MachineDeploymentStrategyType =
// InPlaceUpdate.
InPlaceUpdate *InPlaceUpdateMachineDeployment
}

// MachineDeploymentStrategyType is the strategy to be used for rolling a MachineDeployment
Expand All @@ -492,17 +496,34 @@ const (

// RollingUpdateMachineDeploymentStrategyType means that old MCs will be replaced by new one using rolling update i.e gradually scale down the old MCs and scale up the new one.
RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate"

// InPlaceUpdateMachineDeploymentStrategyType signifies that VMs will be updated in place and
// machine objects will gradually transition from the old MachineSet to the new MachineSet without requiring VM recreation.
InPlaceUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "InPlaceUpdate"
)

// RollingUpdateMachineDeployment specifies the spec to control the desired behavior of rolling update.
type RollingUpdateMachineDeployment struct {
UpdateConfiguration
}

// InPlaceUpdateMachineDeployment specifies the spec to control the desired behavior of inplace update.
type InPlaceUpdateMachineDeployment struct {
UpdateConfiguration

// OrchestrationType specifies the orchestration type for the inplace update.
OrchestrationType OrchestrationType
}

// UpdateConfiguration specifies the udpate configuration for the deployment strategy.
type UpdateConfiguration struct {
// The maximum number of machines that can be unavailable during the update.
// Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%).
// Absolute number is calculated from percentage by rounding down.
// 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 MC can be scaled down to 70% of desired machines
// immediately when the rolling update starts. Once new machines are ready, old MC
// immediately when the update starts. Once new machines are ready, old MC
// can be scaled down further, followed by scaling up the new MC, ensuring
// that the total number of machines available at all times during the update is at
// least 70% of desired machines.
Expand All @@ -515,13 +536,23 @@ type RollingUpdateMachineDeployment struct {
// 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 MC can be scaled up immediately when
// the rolling update starts, such that the total number of old and new machines do not exceed
// the update starts, such that the total number of old and new machines do not exceed
// 130% of desired machines. Once old machines have been killed,
// new MC can be scaled up further, ensuring that total number of machines running
// at any time during the update is atmost 130% of desired machines.
MaxSurge *intstr.IntOrString
}

// OrchestrationType specifies the orchestration type for the inplace update.
type OrchestrationType string

const (
// OrchestrationTypeAuto signifies that the machines are automatically selected for update based on UpdateConfiguration.
OrchestrationTypeAuto OrchestrationType = "Auto"
// OrchestrationTypeManual signifies that the user has to select the machines to be updated manually.
OrchestrationTypeManual OrchestrationType = "Manual"
)

// MachineDeploymentStatus is the most recently observed status of the MachineDeployment.
type MachineDeploymentStatus struct {
// The generation observed by the MachineDeployment controller.
Expand Down
36 changes: 34 additions & 2 deletions pkg/apis/machine/v1alpha1/machinedeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ type MachineDeploymentStrategy struct {
// to be.
// +optional
RollingUpdate *RollingUpdateMachineDeployment `json:"rollingUpdate,omitempty"`

// InPlaceUpdate update config params. Present only if MachineDeploymentStrategyType =
// InPlaceUpdate.
// +optional
InPlaceUpdate *InPlaceUpdateMachineDeployment `json:"inPlaceUpdate,omitempty"`
}

// MachineDeploymentStrategyType are valid strategy types for rolling MachineDeployments
Expand All @@ -124,16 +129,33 @@ const (

// RollingUpdateMachineDeploymentStrategyType means that old MCs will be replaced by new one using rolling update i.e gradually scale down the old MCs and scale up the new one.
RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate"

// InPlaceUpdateMachineDeploymentStrategyType signifies that VMs will be updated in place and
// machine objects will gradually transition from the old MachineSet to the new MachineSet without requiring VM recreation.
InPlaceUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "InPlaceUpdate"
)

// RollingUpdateMachineDeployment is the spec to control the desired behavior of rolling update.
type RollingUpdateMachineDeployment struct {
UpdateConfiguration `json:",inline"`
}

// InPlaceUpdateMachineDeployment specifies the spec to control the desired behavior of inplace update.
type InPlaceUpdateMachineDeployment struct {
UpdateConfiguration `json:",inline"`

// OrchestrationType specifies the orchestration type for the inplace update.
OrchestrationType OrchestrationType `json:"orchestrationType,omitempty"`
}

// UpdateConfiguration specifies the udpate configuration for the deployment strategy.
type UpdateConfiguration struct {
// The maximum number of machines that can be unavailable during the update.
// Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%).
// Absolute number is calculated from percentage by rounding down.
// This can not be 0 if MaxSurge is 0.
// Example: when this is set to 30%, the old machine set can be scaled down to 70% of desired machines
// immediately when the rolling update starts. Once new machines are ready, old machine set
// immediately when the update starts. Once new machines are ready, old machine set
// can be scaled down further, followed by scaling up the new machine set, ensuring
// that the total number of machines available at all times during the update is at
// least 70% of desired machines.
Expand All @@ -146,14 +168,24 @@ type RollingUpdateMachineDeployment struct {
// This can not be 0 if MaxUnavailable is 0.
// Absolute number is calculated from percentage by rounding up.
// Example: when this is set to 30%, the new machine set can be scaled up immediately when
// the rolling update starts, such that the total number of old and new machines does not exceed
// the update starts, such that the total number of old and new machines does not exceed
// 130% of desired machines. Once old machines have been killed,
// new machine set can be scaled up further, ensuring that total number of machines running
// at any time during the update is utmost 130% of desired machines.
// +optional
MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"`
}

// OrchestrationType specifies the orchestration type for the inplace update.
type OrchestrationType string

const (
// OrchestrationTypeAuto signifies that the machines are automatically selected for update based on UpdateConfiguration.
OrchestrationTypeAuto OrchestrationType = "Auto"
// OrchestrationTypeManual signifies that the user has to select the machines to be updated manually.
OrchestrationTypeManual OrchestrationType = "Manual"
)

// MachineDeploymentStatus is the most recently observed status of the MachineDeployment.
type MachineDeploymentStatus struct {
// The generation observed by the MachineDeployment controller.
Expand Down
Loading