GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(knative): handle multi-path KUBECONFIG entries by xenonnn4w · Pull Request #3655 · knative/func

Conversation

@xenonnn4w

@xenonnn4w xenonnn4w commented May 4, 2026 •
edited by gauron99
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Reproduction

Successfully reproduced the bug

Changes

  • Fix validation of KUBECONFIG when multiple paths are provided
  • Use filepath.SplitList to correctly handle OS-specific path separators
  • Treat KUBECONFIG as a list of paths instead of a single file path
  • Validation now succeeds if at least one kubeconfig file exists
  • Return ErrInvalidKubeconfig only when all paths are missing or unreadable
  • Add unit tests covering:
    • empty KUBECONFIG
    • single valid path
    • multiple paths (valid + missing)
    • all paths missing

/kind bug

Fixes #3534

Testing (After Fix)

Case 1: Multiple valid paths

export KUBECONFIG=~/.kube/config:/tmp/second-config
func list

Expected:

  • Validation succeeds (no invalid path error)
  • Command proceeds to cluster connection stage

Case 2: One valid + one missing

export KUBECONFIG=~/.kube/config:/tmp/missing
func list

Expected:

  • Validation succeeds

Case 3: All paths missing

export KUBECONFIG=/tmp/miss1:/tmp/miss2
func list

Expected:

  • invalid kubeconfig: kubeconfig file does not exist at path: /tmp/miss1:/tmp/miss2

Case 4: Empty KUBECONFIG

unset KUBECONFIG
func list

Expected:

  • No validation error

Extra

make test ; passed
make check ;passed

Release Note

func commands now correctly support multi-path KUBECONFIG values. Validation succeeds if at least one referenced kubeconfig file exists, aligning behavior with kubectl and client-go.```

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@knative-prow knative-prow Bot added the kind/bug Bugs label May 4, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented May 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: xenonnn4w / name: Snowiee (94e517b)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow

knative-prow Bot commented May 4, 2026

Copy link
Copy Markdown

Welcome @xenonnn4w! It looks like this is your first PR to knative/func 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot added size/M 🤖 PR changes 30-99 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels May 4, 2026
@knative-prow

knative-prow Bot commented May 4, 2026

Copy link
Copy Markdown

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow
knative-prow Bot requested review from dsimansk and jrangelramos May 4, 2026 19:30
@codecov

codecov Bot commented May 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.64%. Comparing base (5e9d6f8) to head (245fbf2).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
pkg/knative/client.go 54.54% 3 Missing and 2 partials ⚠️
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     
Flag Coverage Δ
e2e 36.27% <45.45%> (-0.03%) ⬇️
e2e go 32.92% <44.44%> (?)
e2e node 28.63% <44.44%> (?)
e2e python 33.28% <44.44%> (?)
e2e quarkus 28.77% <44.44%> (?)
e2e rust 28.16% <44.44%> (?)
e2e springboot 26.64% <44.44%> (?)
e2e typescript 28.75% <44.44%> (?)
e2e-config-ci 17.97% <0.00%> (-0.11%) ⬇️
integration 17.36% <44.44%> (?)
unit macos-14 44.69% <55.55%> (+1.08%) ⬆️
unit macos-latest 44.69% <55.55%> (+1.08%) ⬆️
unit ubuntu-24.04-arm 44.94% <54.54%> (+1.14%) ⬆️
unit ubuntu-latest 45.55% <55.55%> (+1.07%) ⬆️
unit windows-latest 44.68% <55.55%> (+1.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gauron99
gauron99 reviewed May 6, 2026
View reviewed changes

@gauron99 gauron99 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkg/knative/client.go Outdated
paths := filepath.SplitList(kubeconfigPath)
foundExisting := false
missingCount := 0
for _, path := range paths {

@gauron99 gauron99 May 6, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

xenonnn4w reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@gauron99 gauron99 May 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkg/knative/client_test.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gauron99

gauron99 commented May 6, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot added ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test 🤖 Needs an org member to approve testing labels May 6, 2026
@xenonnn4w
xenonnn4w force-pushed the kubeconfig branch from 441773e to 43c3962 Compare May 6, 2026 15:58
@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. and removed size/M 🤖 PR changes 30-99 lines, ignoring generated files. labels May 6, 2026
@xenonnn4w

xenonnn4w commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

thanks for the review!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xenonnn4w
xenonnn4w force-pushed the kubeconfig branch from 43c3962 to 94e517b Compare May 6, 2026 16:15
@xenonnn4w

xenonnn4w commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

/retest

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gauron99
gauron99 reviewed May 7, 2026
View reviewed changes
Comment thread pkg/knative/client.go Outdated
if _, err := os.Stat(kubeconfigPath); os.IsNotExist(err) {
paths := filepath.SplitList(kubeconfigPath)
havePaths := false
missingCount := 0

@gauron99 gauron99 May 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@xenonnn4w xenonnn4w May 7, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkg/knative/client.go Outdated
paths := filepath.SplitList(kubeconfigPath)
foundExisting := false
missingCount := 0
for _, path := range paths {

@gauron99 gauron99 May 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@xenonnn4w
fix(knative): handle multi-path KUBECONFIG entries
245fbf2
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.
@xenonnn4w
xenonnn4w force-pushed the kubeconfig branch from 94e517b to 245fbf2 Compare May 7, 2026 12:50
@knative-prow knative-prow Bot added size/M 🤖 PR changes 30-99 lines, ignoring generated files. and removed size/L 🤖 PR changes 100-499 lines, ignoring generated files. labels May 7, 2026
@gauron99

gauron99 commented May 8, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approve
lets see if the integration tests were a flake

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot assigned gauron99 May 8, 2026
@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label May 8, 2026
@knative-prow

knative-prow Bot commented May 8, 2026

Copy link
Copy Markdown

[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

Details Needs approval from an approver in each of these files:
  • OWNERS [gauron99]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot added the approved 🤖 PR has been approved by an approver from all required OWNERS files. label May 8, 2026
@knative-prow
knative-prow Bot merged commit cea1c1d into knative:main May 8, 2026
141 of 145 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@gauron99 gauron99 mentioned this pull request May 11, 2026
Fails when KUBECONFIG contains multiple colon-separated paths #3534
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gauron99 gauron99 gauron99 left review comments
@dsimansk dsimansk Awaiting requested review from dsimansk
@jrangelramos jrangelramos Awaiting requested review from jrangelramos

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gauron99 gauron99

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. kind/bug Bugs lgtm 🤖 PR is ready to be merged. ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Fails when KUBECONFIG contains multiple colon-separated paths

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@xenonnn4w @gauron99
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.