-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vmop): first implementation (#4)
## Description Implementation resource VirtualMachineOperation. The VirtualMachineOperation custom resource allows for declarative management of a working virtual machine. It enables actions such as stopping, starting, and restarting the virtual machine. ## Why do we need it, and what problem does it solve? The VirtualMachineOperation resource is needed to provide a high-level abstraction for managing virtual machines. It solves the problem of efficiently and easily controlling the state of virtual machines through a declarative approach, rather than relying on manual, time-consuming operations. ## What is the expected result? VirtualMachineOperation is an immutable resource. After deployment, it can have 4 phases of status: Completed, Failed, InProgress, Pending. --------- Signed-off-by: Yaroslav Borbat <[email protected]> Signed-off-by: Yaroslav Borbat <[email protected]> Co-authored-by: Ivan Mikheykin <[email protected]>
- Loading branch information
1 parent
6c7ec69
commit 7bf5e68
Showing
18 changed files
with
905 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
images/virtualization-controller/api/v1alpha2/virtual_machine_operation.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package v1alpha2 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
const ( | ||
VMOPKind = "VirtualMachineOperation" | ||
VMOPResource = "virtualmachineoperations" | ||
) | ||
|
||
// VirtualMachineOperation is operation performed on the VirtualMachine. | ||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
type VirtualMachineOperation struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec VirtualMachineOperationSpec `json:"spec"` | ||
Status VirtualMachineOperationStatus `json:"status,omitempty"` | ||
} | ||
|
||
type VirtualMachineOperationSpec struct { | ||
Type VMOPOperation `json:"type"` | ||
VirtualMachineName string `json:"virtualMachineName"` | ||
Force bool `json:"force,omitempty"` | ||
} | ||
|
||
type VirtualMachineOperationStatus struct { | ||
Phase VMOPPhase `json:"phase"` | ||
FailureReason string `json:"failureReason,omitempty"` | ||
FailureMessage string `json:"failureMessage,omitempty"` | ||
} | ||
|
||
// VirtualMachineOperationList contains a list of VirtualMachineOperation | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
type VirtualMachineOperationList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
Items []VirtualMachineOperation `json:"items"` | ||
} | ||
|
||
type VMOPPhase string | ||
|
||
const ( | ||
VMOPPhasePending VMOPPhase = "Pending" | ||
VMOPPhaseInProgress VMOPPhase = "InProgress" | ||
VMOPPhaseCompleted VMOPPhase = "Completed" | ||
VMOPPhaseFailed VMOPPhase = "Failed" | ||
) | ||
|
||
type VMOPOperation string | ||
|
||
const ( | ||
VMOPOperationTypeRestart VMOPOperation = "Restart" | ||
VMOPOperationTypeStart VMOPOperation = "Start" | ||
VMOPOperationTypeStop VMOPOperation = "Stop" | ||
) |
93 changes: 93 additions & 0 deletions
93
images/virtualization-controller/api/v1alpha2/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.