fix error during restore when spec.ports are not found

Signed-off-by: Shubheksha Jalan <jshubheksha@gmail.com>
pull/869/head
Shubheksha Jalan 2018-09-25 01:02:22 +05:30
parent 368787c184
commit 907a9fbdd8
1 changed files with 5 additions and 0 deletions

View File

@ -57,6 +57,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