GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(knative): handle multi-path KUBECONFIG entries by xenonnn4w · Pull Request #3655 · knative/func Conversation
|
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Welcome @xenonnn4w! It looks like this is your first PR to knative/func 🎉 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi @xenonnn4w. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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-sigs/prow repository. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## main #3655 +/- ## ========================================== + Coverage 53.33% 56.64% +3.31% ========================================== Files 181 181 Lines 20671 20860 +189 ========================================== + Hits 11025 11817 +792 + Misses 8573 7830 -743 - Partials 1073 1213 +140
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
thanks for the PR, few comments below
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| paths := filepath.SplitList(kubeconfigPath) | ||
| foundExisting := false | ||
| missingCount := 0 | ||
| for _, path := range paths { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
can we simplify this to simply return the first found instead?
something like
for _, path := range paths {
// if path == "" - skip
if _, err := os.Stat(path); err == nil {
return nil
}
// handle errors
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I mightve not been clear enough in my explanation. I dont think we need to capture the number of missing paths at all? If I understand it, we can simplify the loop to simply skip empty, return on first successful path to validate the kubeconfig or return error if no valid paths are present.
isnt havePaths unnecessary? we return good path immediately. And following logically if we ever get to missingCount, isnt it always true? If there is some error found in the loop and 0 successful paths (nothing was returned) then the missingCount is always true?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
/ok-to-test |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
thanks for the review! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/retest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if _, err := os.Stat(kubeconfigPath); os.IsNotExist(err) { | ||
| paths := filepath.SplitList(kubeconfigPath) | ||
| havePaths := false | ||
| missingCount := 0 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
do we still need both of these variables?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
ah i see, both were redundant. Simplified!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| paths := filepath.SplitList(kubeconfigPath) | ||
| foundExisting := false | ||
| missingCount := 0 | ||
| for _, path := range paths { |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I mightve not been clear enough in my explanation. I dont think we need to capture the number of missing paths at all? If I understand it, we can simplify the loop to simply skip empty, return on first successful path to validate the kubeconfig or return error if no valid paths are present.
isnt havePaths unnecessary? we return good path immediately. And following logically if we ever get to missingCount, isnt it always true? If there is some error found in the loop and 0 successful paths (nothing was returned) then the missingCount is always true?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Validate KUBECONFIG with filepath.SplitList and accept any existing path. Keep ErrInvalidKubeconfig for all-missing entries, and surface unreadable path errors explicitly. Add unit tests covering empty env, missing files, and mixed multi-path cases.
|
/lgtm |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauron99, xenonnn4w 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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Fails when KUBECONFIG contains multiple colon-separated paths
There was an error while loading. Please reload this page.