From db151177489254e604e464581fb8acc684791bcf Mon Sep 17 00:00:00 2001 From: Baptiste Girard-Carrabin Date: Thu, 6 Jun 2024 17:15:19 +0200 Subject: [PATCH] [local] Remove openEBS support We don't plan on supporting openEBS in our clusters in the foreseable future so let's drop the code to autoscale nodes base on it for now. --- .../processors/datadog/common/common.go | 8 +++---- .../processors/datadog/common/common_test.go | 23 ------------------- .../datadog/pods/transform_local_data.go | 5 +--- .../datadog/pods/transform_local_data_test.go | 10 -------- 4 files changed, 4 insertions(+), 42 deletions(-) diff --git a/cluster-autoscaler/processors/datadog/common/common.go b/cluster-autoscaler/processors/datadog/common/common.go index caed42068f0f..a1c55547c02c 100644 --- a/cluster-autoscaler/processors/datadog/common/common.go +++ b/cluster-autoscaler/processors/datadog/common/common.go @@ -41,8 +41,6 @@ const ( // DatadogStorageProvisionerTopoLVM is the storage provisioner label value to use for topolvm implementation DatadogStorageProvisionerTopoLVM = "topolvm" - // DatadogStorageProvisionerOpenEBS is the storage provisioner label value to use for openebs implementation - DatadogStorageProvisionerOpenEBS = "openebs-lvm" ) var ( @@ -80,10 +78,10 @@ func SetNodeLocalDataResource(nodeInfo *schedulerframework.NodeInfo) { node.Status.Capacity = apiv1.ResourceList{} } - provisioner, _ := node.Labels[DatadogLocalStorageProvisionerLabel] + provisioner := node.Labels[DatadogLocalStorageProvisionerLabel] switch provisioner { - case DatadogStorageProvisionerTopoLVM, DatadogStorageProvisionerOpenEBS: - capacity, _ := node.Labels[DatadogInitialStorageCapacityLabel] + case DatadogStorageProvisionerTopoLVM: + capacity := node.Labels[DatadogInitialStorageCapacityLabel] capacityResource, err := resource.ParseQuantity(capacity) if err == nil { node.Status.Capacity[DatadogLocalDataResource] = capacityResource.DeepCopy() diff --git a/cluster-autoscaler/processors/datadog/common/common_test.go b/cluster-autoscaler/processors/datadog/common/common_test.go index 51f2333aa124..e9d6b754a54c 100644 --- a/cluster-autoscaler/processors/datadog/common/common_test.go +++ b/cluster-autoscaler/processors/datadog/common/common_test.go @@ -158,26 +158,3 @@ func TestShouldNotSetResourcesWithMissingLabel(t *testing.T) { _, ok = ni.Allocatable.ScalarResources[DatadogLocalDataResource] assert.False(t, ok) } - -func TestSetNodeResourceFromOpenEBS(t *testing.T) { - var hundredGB int64 = 100 * 1024 * 1024 * 1024 - ni := schedulerframework.NewNodeInfo() - ni.SetNode(&corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - DatadogLocalStorageProvisionerLabel: "openebs-lvm", - DatadogInitialStorageCapacityLabel: "100Gi", - }, - }, - }) - - SetNodeLocalDataResource(ni) - - nodeValue, ok := ni.Node().Status.Allocatable[DatadogLocalDataResource] - assert.True(t, ok) - assert.Equal(t, nodeValue.String(), resource.NewQuantity(hundredGB, resource.BinarySI).String()) - - niValue, ok := ni.Allocatable.ScalarResources[DatadogLocalDataResource] - assert.True(t, ok) - assert.Equal(t, niValue, hundredGB) -} diff --git a/cluster-autoscaler/processors/datadog/pods/transform_local_data.go b/cluster-autoscaler/processors/datadog/pods/transform_local_data.go index 28508831b031..3df801b79892 100644 --- a/cluster-autoscaler/processors/datadog/pods/transform_local_data.go +++ b/cluster-autoscaler/processors/datadog/pods/transform_local_data.go @@ -67,7 +67,6 @@ import ( const ( storageClassNameLocal = "local-data" storageClassNameTopolvm = "dynamic-local-data" - storageClassNameOpenEBS = "openebs-lvmpv" ) type transformLocalData struct { @@ -124,7 +123,7 @@ func (p *transformLocalData) Process(ctx *context.AutoscalingContext, pods []*ap } switch *pvc.Spec.StorageClassName { - case storageClassNameTopolvm, storageClassNameOpenEBS: + case storageClassNameTopolvm: if storage, ok := pvc.Spec.Resources.Requests["storage"]; ok { po.Spec.Containers[0].Resources.Requests[common.DatadogLocalDataResource] = storage.DeepCopy() po.Spec.Containers[0].Resources.Limits[common.DatadogLocalDataResource] = storage.DeepCopy() @@ -148,8 +147,6 @@ func (p *transformLocalData) Process(ctx *context.AutoscalingContext, pods []*ap func isSpecialPVCStorageClass(className string) bool { switch className { - case storageClassNameOpenEBS: - return true case storageClassNameTopolvm: return true case storageClassNameLocal: diff --git a/cluster-autoscaler/processors/datadog/pods/transform_local_data_test.go b/cluster-autoscaler/processors/datadog/pods/transform_local_data_test.go index 4564bc5f3b6e..67ba58768de9 100644 --- a/cluster-autoscaler/processors/datadog/pods/transform_local_data_test.go +++ b/cluster-autoscaler/processors/datadog/pods/transform_local_data_test.go @@ -118,16 +118,6 @@ func TestTransformLocalDataProcess(t *testing.T) { }, []*corev1.Pod{buildPod("pod1", testLdResources, testLdResources)}, }, - - { - "openebs provisioner is using proper storage capacity value", - []*corev1.Pod{buildPod("pod1", testEmptyResources, testEmptyResources, "pvc-1", "pvc-2")}, - []*corev1.PersistentVolumeClaim{ - buildPVC("pvc-1", testRemoteClass), - buildPVCWithStorage("pvc-2", storageClassNameOpenEBS, "100Gi"), - }, - []*corev1.Pod{buildPod("pod1", testTopolvmResources, testTopolvmResources, "pvc-1")}, - }, } for _, tt := range tests {