Skip to content

Commit

Permalink
Merge pull request #1324 from huww98/disk-refuse-detach-acs
Browse files Browse the repository at this point in the history
disk: refuse to delete disk on ACS
  • Loading branch information
k8s-ci-robot authored Feb 18, 2025
2 parents 5c07cd7 + b6e25ef commit 4efbfff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/disk/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
}
}
if disk.Status == DiskStatusInuse && canDetach {
if strings.HasPrefix(disk.InstanceId, "eci-") {
// We should never be asked to delete a disk on an ECI instance.
if strings.HasPrefix(disk.InstanceId, "eci-") || strings.HasPrefix(disk.InstanceId, "acs-") {
// We should never be asked to delete a disk on an serverless instance.
// If we reach here, something goes seriously wrong.
// TODO: ECI does not support multi-attach?
return nil, status.Errorf(codes.Internal, "refuse to delete disk on ECI instance %s", disk.InstanceId)
return nil, status.Errorf(codes.Internal, "refuse to delete disk on serverless instance %s", disk.InstanceId)
}
err := cs.ad.detachDisk(ctx, ecsClient, req.VolumeId, disk.InstanceId)
if err != nil {
Expand Down

0 comments on commit 4efbfff

Please sign in to comment.