Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if no kubeconfig use inclusterconfig test #5603

Merged
merged 2 commits into from
Jul 22, 2021

Conversation

vaikas
Copy link
Contributor

@vaikas vaikas commented Jul 21, 2021

If no kubeconfig is specified, try to use inclusterconfig.

Proposed Changes

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note


Docs

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 21, 2021
@knative-prow-robot knative-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 21, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vaikas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

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

@knative-prow-robot knative-prow-robot added area/test-and-release Test infrastructure, tests or release approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 21, 2021
@codecov
Copy link

codecov bot commented Jul 21, 2021

Codecov Report

Merging #5603 (81bbe4c) into main (003a8a2) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5603   +/-   ##
=======================================
  Coverage   82.79%   82.79%           
=======================================
  Files         199      199           
  Lines        6230     6230           
=======================================
  Hits         5158     5158           
  Misses        744      744           
  Partials      328      328           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 003a8a2...81bbe4c. Read the comment docs.

@vaikas
Copy link
Contributor Author

vaikas commented Jul 21, 2021

Now fails with this:

=== RUN   TestDefaultBrokerWithManyTriggers/test_default_broker_with_many_attribute_and_extension_triggers
    test_runner.go:162: Couldn't initialize clients: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined

When trying to load the in-cluster. I'll keep playing.

@vaikas
Copy link
Contributor Author

vaikas commented Jul 21, 2021

doh, of course it does because the tests do not run in the cluster.

@vaikas
Copy link
Contributor Author

vaikas commented Jul 21, 2021

@benmoss @salaboy
Due to: knative/pkg#2191

And to enable those tests, the order is now:

  1. Use kubeconfig
  2. if that doesn't work, use inclusterconfig
  3. if that doesn't work, use default location for kubeconfig.
    All the tests now pass, and I think the order above is what we wanted.

@salaboy
Copy link
Member

salaboy commented Jul 22, 2021

@vaikas that is the correct order... When I was looking at the code that leads me to my previous PR, I assumed that this order is defined inside the knative client which does the same checks in the same order, and for some reason, these checks are repeated here. Hence I assumed that by removing the if for the default location the checks will be delegated internally to the client that was being created.
I am referring to the checks in here: https://github.com/knative/pkg/blob/main/environment/client_config.go#L54

Can we reuse these checks, so they are not duplicated in every module using pkg? (remember that I am super new with the project structure, so I might be missing something big here :)

@benmoss
Copy link
Member

benmoss commented Jul 22, 2021

I just opened knative/pkg#2197, I think this is the right fix, now sure how to be 100% sure this works for in-cluster, but from reading the code in client-go it should.

@devguyio
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2021
@knative-prow-robot knative-prow-robot merged commit 7251c1b into knative:main Jul 22, 2021
@vaikas vaikas deleted the kubeconfig branch July 22, 2021 19:58
knative-prow-robot pushed a commit that referenced this pull request Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants