-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
autoscaling: add new crd for automatic storagescaling
added a new crd for automatic storage scaling Signed-off-by: parth-gr <[email protected]>
- Loading branch information
Showing
12 changed files
with
967 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
Copyright 2025 Red Hat OpenShift Container Storage. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/api/resource" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// StorageAutoScalerSpec defines the desired state of StorageAutoScaler | ||
type StorageAutoScalerSpec struct { | ||
// StorageClusterName is the name of the storage cluster for which the storage scaling is to be done. | ||
// +kubebuilder:validation:Required | ||
StorageClusterName string `json:"storageClusterName,omitempty"` | ||
// DeviceClassName is the name of the device class for which the storage scaling is to be done. | ||
// +kubebuilder:validation:Required | ||
DeviceClassName string `json:"deviceClassName,omitempty"` | ||
// CapacityLimit is the capacity limit for the storage scaling for the specific deviceClass and storagecluster. | ||
// +kubebuilder:validation:Required | ||
CapacityLimit resource.Quantity `json:"capacityLimit,omitempty"` | ||
} | ||
|
||
type StorageAutoScalerPhase string | ||
|
||
const ( | ||
PhaseWaiting StorageAutoScalerPhase = "Waiting" | ||
PhaseInProgress StorageAutoScalerPhase = "InProgress" | ||
PhaseFailed StorageAutoScalerPhase = "Failed" | ||
PhaseCompleted StorageAutoScalerPhase = "Completed" | ||
) | ||
|
||
// StorageAutoScalerStatus defines the observed state of StorageAutoScaler | ||
type StorageAutoScalerStatus struct { | ||
// Phase describes the Phase of StorageAutoScaler | ||
// +kubebuilder:validation:Enum=Waiting;InProgress;Failed;Completed | ||
Phase StorageAutoScalerPhase `json:"phase,omitempty"` | ||
// LastRunTimeStamp is the time stamp of the last run of the storage scaling | ||
LastRunTimeStamp metav1.Time `json:"lastRunTimeStamp,omitempty"` | ||
// The current size is the original size of the OSDs before the expansion in progress is completed. | ||
// After the expansion is completed, this would be updated to the expected OSD size. | ||
// Used for vertical scaling of OSDs. | ||
CurrentOsdSize resource.Quantity `json:"currentOsdSize,omitempty"` | ||
// The ExpectedOsdSize is the size that the auto-expansion has decided to set. | ||
// This will be set on the storageCLuster CR as the desired size of the OSDs. | ||
// Used for vertical scaling of OSDs. | ||
ExpectedOsdSize resource.Quantity `json:"expectedOsdSize,omitempty"` | ||
// The current OSD count is the original count of the OSDs before the expansion in progress is completed. | ||
// After the expansion is completed, this would be updated to the expected OSD count. | ||
// Used for horizontal scaling of OSDs. | ||
CurrentOsdCount uint16 `json:"currentOsdCount,omitempty"` | ||
// The Expected OSD count is the count that the auto-expansion has decided to set. | ||
// This will be set on the storageCluster CR as the desired count of the OSDs. | ||
// Used for horizontal scaling of OSDs. | ||
ExpectedOsdCount uint16 `json:"expectedOsdCount,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=.metadata.creationTimestamp, description="Age" | ||
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=.status.phase,description="Current Phase" | ||
// +kubebuilder:printcolumn:name="LastRunTimeStamp",type=date,JSONPath=.status.lastRunTimeStamp,description="Last Run Time Stamp" | ||
// +operator-sdk:csv:customresourcedefinitions:displayName="Auto Storage Scaling" | ||
|
||
// StorageAutoScaler represents the automatic storage scaling for storage cluster. | ||
type StorageAutoScaler struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec StorageAutoScalerSpec `json:"spec,omitempty"` | ||
Status StorageAutoScalerStatus `json:"status,omitempty"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
127 changes: 127 additions & 0 deletions
127
config/crd/bases/ocs.openshift.io_autostoragescalings.yaml
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,127 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.16.1 | ||
name: autostoragescalings.ocs.openshift.io | ||
spec: | ||
group: ocs.openshift.io | ||
names: | ||
kind: AutoStorageScaling | ||
listKind: AutoStorageScalingList | ||
plural: autostoragescalings | ||
singular: autostoragescaling | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- description: Age | ||
jsonPath: .metadata.creationTimestamp | ||
name: Age | ||
type: date | ||
- description: Current Phase | ||
jsonPath: .status.phase | ||
name: Phase | ||
type: string | ||
- description: Last Run Time Stamp | ||
jsonPath: .status.lastRunTimeStamp | ||
name: LastRunTimeStamp | ||
type: date | ||
name: v1 | ||
schema: | ||
openAPIV3Schema: | ||
description: AutoStorageScaling represents the automatic storage scaling for | ||
odf cluster. | ||
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 | ||
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 | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: AutoStorageScalingSpec defines the desired state of AutoStorageScaling | ||
properties: | ||
capacityLimit: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
description: CapacityLimit is the capacity limit for the storage scaling | ||
for the specific deviceClass and storagecluster. | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
deviceClassName: | ||
description: DeviceClassName is the name of the device class for which | ||
the storage scaling is to be done. | ||
type: string | ||
storageClusterName: | ||
description: StorageClusterName is the name of the storage cluster | ||
for which the storage scaling is to be done. | ||
type: string | ||
required: | ||
- capacityLimit | ||
- deviceClassName | ||
- storageClusterName | ||
type: object | ||
status: | ||
description: AutoStorageScalingStatus defines the observed state of AutoStorageScaling | ||
properties: | ||
expectedOsdCount: | ||
description: |- | ||
The Expected OSD count is the count that the auto-expansion has decided to set. | ||
This will be set on the storageCLuster CR as the desired count of the OSDs. | ||
Used for horizontal scaling of OSDs. | ||
format: int32 | ||
type: integer | ||
expectedOsdSize: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
description: |- | ||
The ExpectedOsdSize is the size that the auto-expansion has decided to set. | ||
This will be set on the storageCLuster CR as the desired size of the OSDs. | ||
Used for vertical scaling of OSDs. | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
knownOsdCount: | ||
description: |- | ||
The known OSD count is the original count of the OSDs before the expansion in progress is completed. | ||
After the expansion is completed, this would be updated to the expected OSD count. | ||
Used for horizontal scaling of OSDs. | ||
format: int32 | ||
type: integer | ||
knownOsdSize: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
description: |- | ||
The known size is the original size of the OSDs before the expansion in progress is completed. | ||
After the expansion is completed, this would be updated to the expected OSD size. | ||
Used for vertical scaling of OSDs. | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
lastRunTimeStamp: | ||
description: LastRunTimeStamp is the time stamp of the last run of | ||
the storage scaling | ||
format: date-time | ||
type: string | ||
phase: | ||
description: Phase describes the Phase of AutoStorageScaling | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
Oops, something went wrong.