mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-30 19:55:36 +00:00
Empty the "ClusterIPs" along with "ClusterIP" when "ClusterIP" isn't "None" (#4101)
More details please refer to #4098 Fixes #4098 Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Empty the "ClusterIPs" along with "ClusterIP" when "ClusterIP" isn't "None"
|
||||
@@ -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 */
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user