diff --git a/changelogs/unreleased/4101-ywk253100 b/changelogs/unreleased/4101-ywk253100 new file mode 100644 index 000000000..747db01ca --- /dev/null +++ b/changelogs/unreleased/4101-ywk253100 @@ -0,0 +1 @@ +Empty the "ClusterIPs" along with "ClusterIP" when "ClusterIP" isn't "None" \ No newline at end of file diff --git a/pkg/restore/service_action.go b/pkg/restore/service_action.go index 01082c7a1..0b22cf095 100644 --- a/pkg/restore/service_action.go +++ b/pkg/restore/service_action.go @@ -55,6 +55,7 @@ func (a *ServiceAction) Execute(input *velero.RestoreItemActionExecuteInput) (*v if service.Spec.ClusterIP != "None" { service.Spec.ClusterIP = "" + service.Spec.ClusterIPs = nil } /* Do not delete NodePorts if restore triggered with "--preserve-nodeports" flag */ diff --git a/pkg/restore/service_action_test.go b/pkg/restore/service_action_test.go index 54e616a9a..59fef00a1 100644 --- a/pkg/restore/service_action_test.go +++ b/pkg/restore/service_action_test.go @@ -73,13 +73,14 @@ func TestServiceActionExecute(t *testing.T) { expectedRes corev1api.Service }{ { - name: "clusterIP (only) should be deleted from spec", + name: "clusterIP/clusterIPs should be deleted from spec", obj: corev1api.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "svc-1", }, Spec: corev1api.ServiceSpec{ ClusterIP: "should-be-removed", + ClusterIPs: []string{"should-be-removed"}, LoadBalancerIP: "should-be-kept", }, },