From 3afc380c1f4923b96bb356811fb6eeaa017e27d6 Mon Sep 17 00:00:00 2001 From: liubo02 Date: Tue, 21 Feb 2023 12:26:52 +0800 Subject: [PATCH] fix(ebs): fix missing param in sc when modify ebs --- pkg/manager/volumes/delegation/aws/ebs_modifier.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/manager/volumes/delegation/aws/ebs_modifier.go b/pkg/manager/volumes/delegation/aws/ebs_modifier.go index 96573039c9..3eba2df05b 100644 --- a/pkg/manager/volumes/delegation/aws/ebs_modifier.go +++ b/pkg/manager/volumes/delegation/aws/ebs_modifier.go @@ -131,6 +131,7 @@ func (m *EBSModifier) ModifyVolume(ctx context.Context, pvc *corev1.PersistentVo return true, nil } +// If some params are not set, assume they are equal. func (m *EBSModifier) diffVolume(actual, desired *Volume) bool { if diffInt32(actual.IOPS, desired.IOPS) { return true @@ -141,6 +142,9 @@ func (m *EBSModifier) diffVolume(actual, desired *Volume) bool { if diffInt32(actual.Size, desired.Size) { return true } + if actual.Type == "" || desired.Type == "" { + return false + } if actual.Type != desired.Type { return true } @@ -149,12 +153,8 @@ func (m *EBSModifier) diffVolume(actual, desired *Volume) bool { } func diffInt32(a, b *int32) bool { - if a == nil && b == nil { - return false - } - if a == nil || b == nil { - return true + return false } if *a == *b {