Skip to content

Commit 41fb2af

Browse files
acuminoshafeeqesary1992
authored
[GEP-31] Introduce label constants and MachineConfiguration options for in-place updates (#970)
* Introduce labels constants for InPlaceUpdate Co-Authored-By: Shafeeque E S <[email protected]> Co-Authored-By: Ashish Ranjan Yadav <[email protected]> * Introduce `MachineInPlaceUpdateTimeout` field Co-authored-by: Shafeeque E S <[email protected]> Co-authored-by: Ashish Ranjan Yadav <[email protected]> * Introduce `DisableHealthTimeout` field Co-authored-by: Shafeeque E S <[email protected]> Co-authored-by: Ashish Ranjan Yadav <[email protected]> * Run `make generate` Co-authored-by: Shafeeque E S <[email protected]> Co-authored-by: Ashish Ranjan Yadav <[email protected]> * Nits * Address Review * Address Review --------- Co-authored-by: Shafeeque E S <[email protected]> Co-authored-by: Ashish Ranjan Yadav <[email protected]>
1 parent 73405d0 commit 41fb2af

18 files changed

+157
-11
lines changed

docs/documents/apis.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,36 @@ Kubernetes meta/v1.Duration
10551055
</tr>
10561056
<tr>
10571057
<td>
1058+
<code>inPlaceUpdateTimeout</code>
1059+
</td>
1060+
<td>
1061+
<em>
1062+
<a href="https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#Duration">
1063+
Kubernetes meta/v1.Duration
1064+
</a>
1065+
</em>
1066+
</td>
1067+
<td>
1068+
<em>(Optional)</em>
1069+
<p>MachineInPlaceUpdateTimeout is the timeout after which in-place update is declared failed.</p>
1070+
</td>
1071+
</tr>
1072+
<tr>
1073+
<td>
1074+
<code>disableHealthTimeout</code>
1075+
</td>
1076+
<td>
1077+
<em>
1078+
*bool
1079+
</em>
1080+
</td>
1081+
<td>
1082+
<em>(Optional)</em>
1083+
<p>DisableHealthTimeout if set to true, health timeout will be ignored. Leading to machine never being declared failed.</p>
1084+
</td>
1085+
</tr>
1086+
<tr>
1087+
<td>
10581088
<code>maxEvictRetries</code>
10591089
</td>
10601090
<td>

kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ spec:
279279
description: MachineCreationTimeout is the timeout after which
280280
machinie creation is declared failed.
281281
type: string
282+
disableHealthTimeout:
283+
description: DisableHealthTimeout if set to true, health timeout
284+
will be ignored. Leading to machine never being declared
285+
failed.
286+
type: boolean
282287
drainTimeout:
283288
description: MachineDraintimeout is the timeout after which
284289
machine is forcefully deleted.
@@ -287,6 +292,10 @@ spec:
287292
description: MachineHealthTimeout is the timeout after which
288293
machine is declared unhealhty/failed.
289294
type: string
295+
inPlaceUpdateTimeout:
296+
description: MachineInPlaceUpdateTimeout is the timeout after
297+
which in-place update is declared failed.
298+
type: string
290299
maxEvictRetries:
291300
description: MaxEvictRetries is the number of retries that
292301
will be attempted while draining the node.

kubernetes/crds/machine.sapcloud.io_machines.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ spec:
7878
description: MachineCreationTimeout is the timeout after which machinie
7979
creation is declared failed.
8080
type: string
81+
disableHealthTimeout:
82+
description: DisableHealthTimeout if set to true, health timeout will
83+
be ignored. Leading to machine never being declared failed.
84+
type: boolean
8185
drainTimeout:
8286
description: MachineDraintimeout is the timeout after which machine
8387
is forcefully deleted.
@@ -86,6 +90,10 @@ spec:
8690
description: MachineHealthTimeout is the timeout after which machine
8791
is declared unhealhty/failed.
8892
type: string
93+
inPlaceUpdateTimeout:
94+
description: MachineInPlaceUpdateTimeout is the timeout after which
95+
in-place update is declared failed.
96+
type: string
8997
maxEvictRetries:
9098
description: MaxEvictRetries is the number of retries that will be
9199
attempted while draining the node.

kubernetes/crds/machine.sapcloud.io_machinesets.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ spec:
161161
description: MachineCreationTimeout is the timeout after which
162162
machinie creation is declared failed.
163163
type: string
164+
disableHealthTimeout:
165+
description: DisableHealthTimeout if set to true, health timeout
166+
will be ignored. Leading to machine never being declared
167+
failed.
168+
type: boolean
164169
drainTimeout:
165170
description: MachineDraintimeout is the timeout after which
166171
machine is forcefully deleted.
@@ -169,6 +174,10 @@ spec:
169174
description: MachineHealthTimeout is the timeout after which
170175
machine is declared unhealhty/failed.
171176
type: string
177+
inPlaceUpdateTimeout:
178+
description: MachineInPlaceUpdateTimeout is the timeout after
179+
which in-place update is declared failed.
180+
type: string
172181
maxEvictRetries:
173182
description: MaxEvictRetries is the number of retries that
174183
will be attempted while draining the node.

pkg/apis/machine/types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ type MachineConfiguration struct {
9494
// MachineCreationTimeout is the timeout after which machinie creation is declared failed.
9595
MachineCreationTimeout *metav1.Duration
9696

97+
// MachineInPlaceUpdateTimeout is the timeout after which in-place update is declared failed.
98+
MachineInPlaceUpdateTimeout *metav1.Duration
99+
100+
// DisableHealthTimeout if set to true, health timeout will be ignored. Leading to machine never being declared failed.
101+
// This is intended to be used only for in-place updates.
102+
DisableHealthTimeout *bool
103+
97104
// MaxEvictRetries is the number of retries that will be attempted while draining the node.
98105
MaxEvictRetries *int32
99106

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and Gardener contributors
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
package v1alpha1
6+
7+
const (
8+
// AnnotationKeyMachineUpdateFailedReason is the annotation key that indicates the reason for a machine update failure.
9+
AnnotationKeyMachineUpdateFailedReason = "node.machine.sapcloud.io/update-failed-reason"
10+
11+
// LabelKeyNodeCandidateForUpdate is the label key that indicates a node is a candidate for update.
12+
LabelKeyNodeCandidateForUpdate = "node.machine.sapcloud.io/candidate-for-update"
13+
// LabelKeyNodeSelectedForUpdate is the label key that indicates a node has been selected for update.
14+
LabelKeyNodeSelectedForUpdate = "node.machine.sapcloud.io/selected-for-update"
15+
// LabelKeyNodeUpdateResult is the label key that indicates the result of the update on the node.
16+
LabelKeyNodeUpdateResult = "node.machine.sapcloud.io/update-result"
17+
18+
// LabelValueNodeUpdateSuccessful is the label value that indicates the update on the node has succeeded.
19+
LabelValueNodeUpdateSuccessful = "successful"
20+
// LabelValueNodeUpdateFailed is the label value that indicates the update on the node has failed.
21+
LabelValueNodeUpdateFailed = "failed"
22+
)

pkg/apis/machine/v1alpha1/register.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ func Resource(resource string) schema.GroupResource {
3131
return SchemeGroupVersion.WithResource(resource).GroupResource()
3232
}
3333

34-
// func Init() {
35-
// // We only register manually written functions here. The registration of the
36-
// // generated functions takes place in the generated files. The separation
37-
// // makes the code compile even when the generated files are missing.
38-
// SchemeBuilder.Register(addKnownTypes)
39-
// }
40-
4134
// Adds the list of known types to api.Scheme.
4235
func addKnownTypes(scheme *runtime.Scheme) error {
4336
scheme.AddKnownTypes(SchemeGroupVersion,

pkg/apis/machine/v1alpha1/shared_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ type MachineConfiguration struct {
4040
// +optional
4141
MachineCreationTimeout *metav1.Duration `json:"creationTimeout,omitempty"`
4242

43+
// MachineInPlaceUpdateTimeout is the timeout after which in-place update is declared failed.
44+
// +optional
45+
MachineInPlaceUpdateTimeout *metav1.Duration `json:"inPlaceUpdateTimeout,omitempty"`
46+
47+
// DisableHealthTimeout if set to true, health timeout will be ignored. Leading to machine never being declared failed.
48+
// This is intended to be used only for in-place updates.
49+
// +optional
50+
DisableHealthTimeout *bool `json:"disableHealthTimeout,omitempty"`
51+
4352
// MaxEvictRetries is the number of retries that will be attempted while draining the node.
4453
// +optional
4554
MaxEvictRetries *int32 `json:"maxEvictRetries,omitempty"`

pkg/apis/machine/v1alpha1/zz_generated.conversion.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)