[OpenShift] Add condition check for optional resources - #220
Conversation
|
@savitaashture: GitHub didn't allow me to request PR reviews from the following users: piyush-garg. Note that only tektoncd members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
The following is the coverage report on the affected files.
|
caff8b3 to
f096dd8
Compare
| CustomResourceDefinitions().Get(ctx, crdName, metav1.GetOptions{}) | ||
| return err == nil, ignoreNotFound(err) | ||
| } | ||
|
|
||
| func ignoreNotFound(err error) error { | ||
| if errors.IsNotFound(err) { | ||
| return nil | ||
| } | ||
| return err | ||
| } |
There was a problem hiding this comment.
could we avoid the ignoreNotFound function ..
how about,
...
_, err = apiextensionsclientset.ApiextensionsV1beta1().
CustomResourceDefinitions().Get(ctx, crdName, metav1.GetOptions{})
if err == nil {
return true, nil
}
if !errors.IsNotFound(err) {
return false, nil
}
return false, err
}
There was a problem hiding this comment.
I feel instead of adding multiple if conditions calling separate functions will be more clear
WDYT?
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nikhil-thomas, piyush-garg The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
Changes
Apply optional addons
consoleyamlsamplesandconsolequickstartsbased on CRD existance/cc @piyush-garg @nikhil-thomas @vdemeester
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Release Notes