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

Introduce ConsumedCapacity into the SpaceProvisionerConfig status #450

Open
wants to merge 3 commits 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
29 changes: 28 additions & 1 deletion api/v1alpha1/docs/apiref.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,29 @@ Defines all parameters concerned with the console
|===


[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-consumedcapacity"]
==== ConsumedCapacity



ConsumedCapacity describes the capacity of the cluster consumed by the spaces
currently provisioned to it.



.Appears In:
****
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-spaceprovisionerconfigstatus[$$SpaceProvisionerConfigStatus$$]
****

[cols="20a,50a,15a,15a", options="header"]
|===
| Field | Description | Default | Validation
| *`memoryUsagePercentPerNodeRole`* __object (keys:string, values:integer)__ | MemoryUsagePercentPerNodeRole is the percent of the memory used per node role (eg. worker, master) + | |
| *`spaceCount`* __integer__ | SpaceCount is the number of spaces currently deployed to the cluster + | |
|===


[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-deactivationconfig"]
==== DeactivationConfig

Expand Down Expand Up @@ -2861,8 +2884,12 @@ the space scheduling decisions. + | |
[cols="20a,50a,15a,15a", options="header"]
|===
| Field | Description | Default | Validation
| *`consumedCapacity`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-consumedcapacity[$$ConsumedCapacity$$]__ | ConsumedCapacity reflects the runtime state of the cluster and the capacity it currently consumes. +
Nil if the consumed capacity is not known + | |
| *`conditions`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-condition[$$Condition$$] array__ | Conditions describes the state of the configuration (its validity). +
The only known condition type is "Ready". + | |
The only known condition type is "Ready". The SpaceProvisionerConfig is ready when the following is true: +
* the referenced ToolchainCluster object exists and is itself ready +
* the consumed capacity doesn't breach the thresholds defined in the spec + | |
|===


Expand Down
30 changes: 26 additions & 4 deletions api/v1alpha1/spaceprovisionerconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package v1alpha1
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

const (
SpaceProvisionerConfigToolchainClusterNotFoundReason = "ToolchainClusterNotFound"
SpaceProvisionerConfigToolchainClusterNotReadyReason = "ToolchainClusterNotReady"
SpaceProvisionerConfigValidReason = "AllChecksPassed"
SpaceProvisionerConfigToolchainClusterNotFoundReason = "ToolchainClusterNotFound"
SpaceProvisionerConfigToolchainClusterNotReadyReason = "ToolchainClusterNotReady"
SpaceProvisionerConfigInsufficientCapacityReason = "InsufficientCapacity"
SpaceProvisionerConfigFailedToDetermineCapacityReason = "FailedToDetermineCapacity"
SpaceProvisionerConfigValidReason = "AllChecksPassed"
SpaceProvisionerConfigDisabledReason = "Disabled"
)

// +k8s:openapi-gen=true
Expand Down Expand Up @@ -50,10 +53,29 @@ type SpaceProvisionerCapacityThresholds struct {
MaxMemoryUtilizationPercent uint `json:"maxMemoryUtilizationPercent,omitempty"`
}

// ConsumedCapacity describes the capacity of the cluster consumed by the spaces
// currently provisioned to it.
type ConsumedCapacity struct {
metlos marked this conversation as resolved.
Show resolved Hide resolved
// MemoryUsagePercentPerNodeRole is the percent of the memory used per node role (eg. worker, master)
// +maptype: atomic
MemoryUsagePercentPerNodeRole map[string]int `json:"memoryUsagePercentPerNodeRole"`

// SpaceCount is the number of spaces currently deployed to the cluster
SpaceCount int `json:"spaceCount"`
metlos marked this conversation as resolved.
Show resolved Hide resolved
}

// +k8s:openapi-gen=true
type SpaceProvisionerConfigStatus struct {
// ConsumedCapacity reflects the runtime state of the cluster and the capacity it currently consumes.
// Nil if the consumed capacity is not known
// +optional
ConsumedCapacity *ConsumedCapacity `json:"consumedCapacity,omitempty"`

// Conditions describes the state of the configuration (its validity).
// The only known condition type is "Ready".
// The only known condition type is "Ready". The SpaceProvisionerConfig is ready when the following is true:
// * the referenced ToolchainCluster object exists and is itself ready
// * the consumed capacity doesn't breach the thresholds defined in the spec
//
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
Expand Down
27 changes: 27 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

10 changes: 8 additions & 2 deletions api/v1alpha1/zz_generated.openapi.go

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

Loading