Add kube client oidc authentication support for testing #1577
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.
Changes
Currently, the test client in Tekton test doesn't support Kubernetes cluster with oidc authentication.
I tried to run e2e test for my Tekton build, and I found the test can only use the kubeconfig which in
~/.kube/config
, and my kube cluster useoidc
for auth but the current Tekton client doesn't support that.I take a look the knative serving and eventing, their clients have the config for oidc:
https://github.com/knative/serving/blob/78995f561c50acb87c9f5d386e07dbb3c597aeeb/test/clients.go#L25
But tekton test client doesn't have that:
https://github.com/tektoncd/pipeline/blob/master/test/clients.go
Without this
oidc
package,all tests will fail like:So I follow what knative repo did in this PR:
1, Use
dep
to add oidc package:dep ensure -add k8s.io/client-go/plugin/pkg/client/auth/oidc
2, Add import in
test/init_test.go
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them: