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

SKS-2691: Add support for cpu and memory expansion #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ kustomize: ## Download kustomize locally if necessary.

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0)

GINKGO := $(shell pwd)/bin/ginkgo
ginkgo: ## Download ginkgo locally if necessary.
Expand Down
17 changes: 17 additions & 0 deletions api/v1beta1/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,23 @@ const (
// detecting an error while adding new disk capacity to root directory; those kind of errors are
// usually transient and failed updating are automatically re-tried by the controller.
ExpandingRootPartitionFailedReason = "ExpandingRootPartitionFailed"

// ExpandingVMResourcesReason documents (Severity=Info) ElfMachine currently executing the
// expand resources(CPU/memory) operation.
ExpandingVMResourcesReason = "ExpandingVMResources"

// ExpandingVMResourcesFailedReason (Severity=Warning) documents an ElfMachine controller detecting
// an error while expanding resources(CPU/memory); those kind of errors are usually transient and
// failed updating are automatically re-tried by the controller.
ExpandingVMResourcesFailedReason = "ExpandingVMResourcesFailed"

// RestartingKubeletReason documents (Severity=Info) ElfMachine currently executing the restart kubelet operation.
RestartingKubeletReason = "RestartingKubelet"

// RestartingKubeletFailedReason (Severity=Warning) documents an ElfMachine controller detecting
// an error while restarting kubelet; those kind of errors are usually transient and failed restarting
// are automatically re-tried by the controller.
RestartingKubeletFailedReason = "RestartingKubeletFailed"
)

// Conditions and Reasons related to make connections to a Tower. Can currently be used by ElfCluster and ElfMachine
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1beta1

import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
)

// CloneMode is the type of clone operation used to clone a VM from a template.
Expand Down Expand Up @@ -199,6 +200,10 @@ type GPUStatus struct {
// ResourcesStatus records the resources allocated to the virtual machine.
type ResourcesStatus struct {
Disk int32 `json:"disk,omitempty"`
// CPUCores is the total number of CPU cores allocated for the virtual machine.
CPUCores int32 `json:"cpu,omitempty"`
// Memory is the total number of memory in MiB allocated for the virtual machine.
Memory resource.Quantity `json:"memory,omitempty"`
}

//+kubebuilder:object:generate=false
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

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

63 changes: 34 additions & 29 deletions config/crd/bases/infrastructure.cluster.x-k8s.io_elfclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
controller-gen.kubebuilder.io/version: v0.15.0
name: elfclusters.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -38,14 +38,19 @@ spec:
description: ElfCluster is the Schema for the elfclusters API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand Down Expand Up @@ -95,9 +100,9 @@ spec:
type: string
type: object
vmGracefulShutdown:
description: VMGracefulShutdown indicates the VMs in this ElfCluster
should shutdown gracefully when deleting the VMs. Default to false
because sometimes the OS stuck when shutting down gracefully.
description: |-
VMGracefulShutdown indicates the VMs in this ElfCluster should shutdown gracefully when deleting the VMs.
Default to false because sometimes the OS stuck when shutting down gracefully.
type: boolean
type: object
status:
Expand All @@ -110,37 +115,37 @@ spec:
operational state.
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
to another. This should be when the underlying condition changed.
If that is not known, then using the time when the API field
changed is acceptable.
description: |-
Last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when
the API field changed is acceptable.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition. This field may be empty.
description: |-
A human readable message indicating details about the transition.
This field may be empty.
type: string
reason:
description: The reason for the condition's last transition
in CamelCase. The specific API may choose whether or not this
field is considered a guaranteed API. This field may not be
empty.
description: |-
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may not be empty.
type: string
severity:
description: Severity provides an explicit classification of
Reason code, so the users or machines can immediately understand
the current situation and act accordingly. The Severity field
MUST be set only when Status=False.
description: |-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important.
description: |-
Type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
type: string
required:
- lastTransitionTime
Expand Down
Loading
Loading