fix error during restore when spec.ports are not found

Signed-off-by: Shubheksha Jalan <jshubheksha@gmail.com>
This commit is contained in:
Shubheksha Jalan
2018-09-25 01:02:22 +05:30
committed by Steve Kriss
parent 856e632109
commit b51b3c27ce

View File

@@ -59,6 +59,11 @@ func (a *serviceAction) Execute(obj runtime.Unstructured, restore *api.Restore)
delete(spec, "clusterIP")
}
// Since spec.ports is an optional key, we can ignore 'not found' errors. Also assuming it was a string already.
if val, _ := collections.GetString(spec, "spec.ports"); val != "None" {
delete(spec, "spec.ports")
}
preservedPorts, err := getPreservedPorts(obj)
if err != nil {
return nil, nil, err