Skip to content

Commit 950f442

Browse files
aaronfernary1992acuminoshafeeqes
authored
[GEP-31] Introduce Constants needed for Conditons and Status for InPlace update (#980) (#983)
* Introduce Constants needed for Conditons and Status * Address PR review feedback --------- Co-authored-by: Ashish Ranjan Yadav <ashish.ranjan.yadav@sap.com> Co-authored-by: Sonu Kumar Singh <sksgkpvks@gmail.com> Co-authored-by: Shafeeque E S <shafeeque.e.s@sap.com>
1 parent 3e2be40 commit 950f442

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

pkg/apis/machine/types.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,15 @@ const (
221221

222222
// MachineCrashLoopBackOff means creation or deletion of the machine is failing. It means that machine object is present but there is no corresponding VM.
223223
MachineCrashLoopBackOff MachinePhase = "CrashLoopBackOff"
224+
225+
// MachineInPlaceUpdating means machine is being updated in-place
226+
MachineInPlaceUpdating MachinePhase = "InPlaceUpdating"
227+
228+
// MachineInPlaceUpdateSuccessful means machine in-place update was successful
229+
MachineInPlaceUpdateSuccessful MachinePhase = "InPlaceUpdateSuccessful"
230+
231+
// MachineInPlaceUpdateFailed means machine in-place update failed
232+
MachineInPlaceUpdateFailed MachinePhase = "InPlaceUpdateFailed"
224233
)
225234

226235
// MachineState is a label for the state of a machines at the current time.
@@ -249,6 +258,12 @@ const (
249258
// MachineOperationUpdate indicates that the operation was an update
250259
MachineOperationUpdate MachineOperationType = "Update"
251260

261+
// MachineOperationInPlaceUpdate indicates that the operation was an in-place update
262+
MachineOperationInPlaceUpdate MachineOperationType = "InPlaceUpdate"
263+
264+
// MachineOperationDrainNode indicates that the operation was a drain node
265+
MachineOperationDrainNode MachineOperationType = "DrainNode"
266+
252267
// MachineOperationHealthCheck indicates that the operation was a create
253268
MachineOperationHealthCheck MachineOperationType = "HealthCheck"
254269

@@ -271,6 +286,29 @@ const (
271286
ConditionUnknown ConditionStatus = "Unknown"
272287
)
273288

289+
const (
290+
// NodeInPlaceUpdate is a node condition type for in-place update
291+
NodeInPlaceUpdate corev1.NodeConditionType = "InPlaceUpdate"
292+
293+
// CandidateForUpdate is a constant for reason in condition that indicates node is candidate for update
294+
CandidateForUpdate string = "CandidateForUpdate"
295+
296+
// SelectedForUpdate is a constant for reason in condition that indicates node is selected for update
297+
SelectedForUpdate string = "SelectedForUpdate"
298+
299+
// DrainSuccessful is a constant for reason in condition that indicates node drain is successful
300+
DrainSuccessful string = "DrainSuccessful"
301+
302+
// ReadyForUpdate is a constant for reason in condition that indicates node is ready for update
303+
ReadyForUpdate string = "ReadyForUpdate"
304+
305+
// UpdateSuccessful is a constant for reason in condition that indicates update succeeded
306+
UpdateSuccessful string = "UpdateSuccessful"
307+
308+
// UpdateFailed is a constant for reason in condition that indicates update failed
309+
UpdateFailed string = "UpdateFailed"
310+
)
311+
274312
/********************** MachineSet APIs ***************/
275313

276314
// +genclient

pkg/apis/machine/v1alpha1/machine_types.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ const (
151151

152152
// MachineCrashLoopBackOff means machine creation is failing. It means that machine object is present but there is no corresponding VM.
153153
MachineCrashLoopBackOff MachinePhase = "CrashLoopBackOff"
154+
155+
// MachineInPlaceUpdating means machine is being updated in-place
156+
MachineInPlaceUpdating MachinePhase = "InPlaceUpdating"
157+
158+
// MachineInPlaceUpdateSuccessful means machine in-place update was successful
159+
MachineInPlaceUpdateSuccessful MachinePhase = "InPlaceUpdateSuccessful"
160+
161+
// MachineInPlaceUpdateFailed means machine in-place update failed
162+
MachineInPlaceUpdateFailed MachinePhase = "InPlaceUpdateFailed"
154163
)
155164

156165
// MachineState is a current state of the operation.
@@ -179,6 +188,12 @@ const (
179188
// MachineOperationUpdate indicates that the operation was an update
180189
MachineOperationUpdate MachineOperationType = "Update"
181190

191+
// MachineOperationInPlaceUpdate indicates that the operation was an in-place update
192+
MachineOperationInPlaceUpdate MachineOperationType = "InPlaceUpdate"
193+
194+
// MachineOperationDrainNode indicates that the operation was a drain node
195+
MachineOperationDrainNode MachineOperationType = "DrainNode"
196+
182197
// MachineOperationHealthCheck indicates that the operation was a health check of node object
183198
MachineOperationHealthCheck MachineOperationType = "HealthCheck"
184199

@@ -201,6 +216,29 @@ const (
201216
ConditionUnknown ConditionStatus = "Unknown"
202217
)
203218

219+
const (
220+
// NodeInPlaceUpdate is a node condition type for in-place update
221+
NodeInPlaceUpdate corev1.NodeConditionType = "InPlaceUpdate"
222+
223+
// CandidateForUpdate is a constant for reason in condition that indicates node is candidate for update
224+
CandidateForUpdate string = "CandidateForUpdate"
225+
226+
// SelectedForUpdate is a constant for reason in condition that indicates node is selected for update
227+
SelectedForUpdate string = "SelectedForUpdate"
228+
229+
// ReadyForUpdate is a constant for reason in condition that indicates node is ready for update
230+
ReadyForUpdate string = "ReadyForUpdate"
231+
232+
// DrainSuccessful is a constant for reason in condition that indicates node drain is successful
233+
DrainSuccessful string = "DrainSuccessful"
234+
235+
// UpdateSuccessful is a constant for reason in condition that indicates update succeeded
236+
UpdateSuccessful string = "UpdateSuccessful"
237+
238+
// UpdateFailed is a constant for reason in condition that indicates update failed
239+
UpdateFailed string = "UpdateFailed"
240+
)
241+
204242
// CurrentStatus contains information about the current status of Machine.
205243
type CurrentStatus struct {
206244
Phase MachinePhase `json:"phase,omitempty"`

pkg/util/provider/machineutils/utils.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ const (
2323
// InitiateDrain specifies next step as initiate node drain
2424
InitiateDrain = "Initiate node drain"
2525

26+
// NodeReadyForUpdate specifies next step as node ready for update.
27+
NodeReadyForUpdate = "Node drain successful. Node is ready for update"
28+
2629
// DelVolumesAttachments specifies next step as deleting volume attachments
2730
DelVolumesAttachments = "Delete Volume Attachments"
2831

0 commit comments

Comments
 (0)