Skip to content

Commit

Permalink
Merge pull request #369 from MUzairS15/k8s/error
Browse files Browse the repository at this point in the history
Return standard k8s error
  • Loading branch information
Mohd Uzair authored Sep 15, 2023
2 parents 979d953 + 97e85bc commit e454ec8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions utils/kubernetes/apply-manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (client *Client) ApplyManifest(contents []byte, recvOptions ApplyOptions) e
continue
}

return ErrApplyManifest(err)
return err
}

helper, err := constructObject(client.KubeClient, client.RestConfig, object)
Expand All @@ -55,7 +55,7 @@ func (client *Client) ApplyManifest(contents []byte, recvOptions ApplyOptions) e
continue
}

return ErrApplyManifest(err)
return err
}

// Default to namespace from the UI. If no namespace is passed, use the namespace used in the manifest.
Expand All @@ -68,7 +68,7 @@ func (client *Client) ApplyManifest(contents []byte, recvOptions ApplyOptions) e
continue
}

return ErrApplyManifest(er)
return er
}
} else {
options.Namespace = val
Expand All @@ -81,7 +81,7 @@ func (client *Client) ApplyManifest(contents []byte, recvOptions ApplyOptions) e
continue
}

return ErrApplyManifest(err)
return err
}

if options.Delete {
Expand All @@ -91,16 +91,15 @@ func (client *Client) ApplyManifest(contents []byte, recvOptions ApplyOptions) e
continue
}

return ErrApplyManifest(err)
return err
}
} else {
_, err = createObject(helper, options.Namespace, object, options.Update)
if err != nil && !kubeerror.IsAlreadyExists(err) {
if recvOptions.IgnoreErrors {
continue
}

return ErrApplyManifest(err)
return err
}
}
}
Expand Down Expand Up @@ -175,6 +174,7 @@ func createObject(restHelper *resource.Helper, namespace string, obj runtime.Obj
}
return object, nil
}

return nil, err
}

Expand Down

0 comments on commit e454ec8

Please sign in to comment.