Skip to content

Commit a25fd1e

Browse files
authored
set DeleteOnTermination per default to true (#122)
Signed-off-by: Felix Breuer <f.breuer94@gmail.com>
1 parent 6fa4c45 commit a25fd1e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ require (
1313
k8s.io/apimachinery v0.35.1
1414
k8s.io/component-base v0.35.1
1515
k8s.io/klog/v2 v2.130.1
16+
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
1617
)
1718

1819
require (
@@ -68,7 +69,6 @@ require (
6869
k8s.io/client-go v0.35.1 // indirect
6970
k8s.io/cluster-bootstrap v0.31.0 // indirect
7071
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
71-
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
7272
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
7373
sigs.k8s.io/randfill v1.0.0 // indirect
7474
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect

pkg/provider/create.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/stackitcloud/machine-controller-manager-provider-stackit/pkg/provider/apis/validation"
1616
"k8s.io/apimachinery/pkg/util/wait"
1717
"k8s.io/klog/v2"
18+
"k8s.io/utils/ptr"
1819
)
1920

2021
// CreateMachine handles a machine creation request by creating a STACKIT server
@@ -155,7 +156,10 @@ func (p *Provider) createServerRequest(req *driver.CreateMachineRequest, provide
155156
// Add boot volume configuration if specified
156157
if providerSpec.BootVolume != nil {
157158
createReq.BootVolume = &client.BootVolumeRequest{
158-
DeleteOnTermination: providerSpec.BootVolume.DeleteOnTermination,
159+
// DeleteOnTermination defaults to false in the IaaS API
160+
// unless explicitly disabled, bootVolumes should always be cleaned up automatically
161+
// otherwise this produces many orphaned volumes since node rolls happen frequently in k8s
162+
DeleteOnTermination: ptr.To(ptr.Deref(providerSpec.BootVolume.DeleteOnTermination, true)),
159163
PerformanceClass: providerSpec.BootVolume.PerformanceClass,
160164
Size: providerSpec.BootVolume.Size,
161165
}

0 commit comments

Comments
 (0)