Skip to content

Commit

Permalink
[local] Remove openEBS support
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Fricounet committed Jun 6, 2024
1 parent 28ea8f5 commit 1bdb3c0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 42 deletions.
8 changes: 3 additions & 5 deletions cluster-autoscaler/processors/datadog/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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()
Expand Down
23 changes: 0 additions & 23 deletions cluster-autoscaler/processors/datadog/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import (
const (
storageClassNameLocal = "local-data"
storageClassNameTopolvm = "dynamic-local-data"
storageClassNameOpenEBS = "openebs-lvmpv"
)

type transformLocalData struct {
Expand Down Expand Up @@ -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()
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1bdb3c0

Please sign in to comment.