Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add APIs for machine phases #531

Merged
merged 3 commits into from
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 14 additions & 0 deletions config/crds/cluster_v1alpha1_machine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,25 @@ spec:
type: string
errorReason:
type: string
lastOperation:
properties:
description:
type: string
lastUpdateTime:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Can we change the name lastUpdateTime to lastUpdated just to be consistent with the similar fields in other places and objects.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thanks.

format: date-time
type: string
state:
type: string
type:
type: string
type: object
lastUpdated:
format: date-time
type: string
nodeRef:
type: object
phase:
type: string
providerStatus:
type: object
versions:
Expand Down
30 changes: 30 additions & 0 deletions pkg/apis/cluster/v1alpha1/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,36 @@ type MachineStatus struct {
// Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition
// +optional
Conditions []corev1.NodeCondition `json:"conditions,omitempty"`

// LastOperation describes the last-operation performed by the machine-controller.
// This API should be useful as a history in terms of the latest operation performed on the
// specific machine. It should also convey the state of the latest-operation for example if // it is still on-going, failed or completed successfully.
hardikdr marked this conversation as resolved.
Show resolved Hide resolved
// +optional
LastOperation LastOperation `json:"lastOperation,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this a pointer as its an optional struct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sure, done.


// Phase represents an ongoing-phase a machine is going through. It is expected to be
hardikdr marked this conversation as resolved.
Show resolved Hide resolved
// transient. Higher-level controllers should rely on MachinePhases to take the right
hardikdr marked this conversation as resolved.
Show resolved Hide resolved
// decision such as replacing the Failed machines.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. Higher-Level controllers should rely on .Status.NodeRef as node health checking is a tricky problem

hardikdr marked this conversation as resolved.
Show resolved Hide resolved
// Eg. Pending, Running, Terminating, Failed etc.
// +optional
Phase *string `json:"phase,omitempty"`
}

// LastOperation represents the detail of the last performed operation on the MachineObject.
type LastOperation struct {
// Description is the human-readable description of the last operation.
Description string `json:"description,omitempty"`

// LastUpdateTime is the timestamp at which LastOperation API was last-updated.
LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`

// State is the current status of the last performed operation.
// Eg.Processing, Failed, Successful etc
State *string `json:"state,omitempty"`

// Type is the type of operation which was last performed.
// Eg. Create, Delete, Update etc
Type *string `json:"type,omitempty"`
}

/// [MachineStatus]
Expand Down
36 changes: 36 additions & 0 deletions pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.