add way to draft k8s resources without local kubeconfig #87
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This fixes issue #83. Without this improvement, users cannot Draft Kubernetes Deployment and Services without a local k8s context (kubeconfig).
This also fixes a bug with #80.
#80 swaps how ensureDraftBinary works. This was the pattern introduced by that PR
This pattern will enter the
if (!downloadResult)
even when Draft is correctly installed which is not the intent. The reason is ensureDraftBinary() was switched to return an errorable in #80 whichgetAsyncResult
will extract the result or throw in the case of error. When ensureDraftBinary() is successful, it doesn't actually return a result. This results in theif (!downloadResult) {
being inadvertently evaluated as true.This is simply fixed by removing the
if (!downloadResult) {
entirely.getAsyncResult
will throw ifensureDraftBinary
fails and thrown errors result in an equivalent error message tovscode.window.showErrorMessage
(throwing is actually better because it also adds a "report error" button to the message).Fixes #83
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Should be tested by PMs before release. Sometime we need to create full integration tests for this project. https://github.com/redhat-developer/vscode-extension-tester is promising. This is out of scope for this PR, though.
Checklist: