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

Use token file for in cluster config during e2e tests #69273

Conversation

dims
Copy link
Member

@dims dims commented Oct 1, 2018

Change-Id: I08e792d7c4db2d81861eec6f91028ebf26dea8db

What this PR does / why we need it:

In 287f6a5#diff-063e73bab84834a4187b1ad4865050adL337, we stopped initializing BearerToken. We did this because the token file mounted into the container is likely to change, so that PR had a mechanism to re-load the file and pick up new tokens when appropriate. So what we should do to keep the old functionality is to use the token file directly in the temporary kubeconfig we generate.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #69234

Special notes for your reviewer:

Release note:

Use the mounted "/var/run/secrets/kubernetes.io/serviceaccount/token" as the token file for running in-cluster based e2e testing.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 1, 2018
@k8s-ci-robot k8s-ci-robot requested review from deads2k and vishh October 1, 2018 00:49
@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 1, 2018
@dims
Copy link
Member Author

dims commented Oct 1, 2018

based on discussion with @liggitt and @darxkies in #69270

@timothysc
Copy link
Member

@dims did you verify this patch works properly?

@dims
Copy link
Member Author

dims commented Oct 1, 2018

Doing that right now @timothysc

@dims
Copy link
Member Author

dims commented Oct 1, 2018

@timothysc timothysc added the kind/bug Categorizes issue or PR as related to a bug. label Oct 1, 2018
@k8s-ci-robot k8s-ci-robot removed the needs-kind Indicates a PR lacks a `kind/foo` label and requires one. label Oct 1, 2018
Copy link
Member

@timothysc timothysc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

I would like those who made the client-go changes to lgtm this.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 1, 2018
@dims
Copy link
Member Author

dims commented Oct 1, 2018

/assign @mikedanese
/assign @liggitt

cc @darxkies

@@ -335,14 +335,17 @@ func ViperizeFlags() {
}

func createKubeConfig(clientCfg *restclient.Config) *clientcmdapi.Config {
const (
tokenFile = "/var/run/secrets/kubernetes.io/serviceaccount/token"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a full const block (or for this to be a const in general)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. thanks @mikedanese

@mikedanese
Copy link
Member

lgtm, thanks for fixing!

Change-Id: I08e792d7c4db2d81861eec6f91028ebf26dea8db
@dims dims force-pushed the use-token-file-for-in-cluster-config-during-e2e-tests branch from 8697a8b to 57f1f6e Compare October 1, 2018 09:56
@liggitt
Copy link
Member

liggitt commented Oct 1, 2018

this seems ok as a quick fix, though it's unclear where this file is expected to be used from, and whether it is intended to be portable outside the generating environment.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 1, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, liggitt, timothysc

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

k8s-ci-robot added a commit that referenced this pull request Oct 1, 2018
…pstream-release-1.12

Automated cherry pick of #69273: Use token file for in cluster config during e2e tests
@smarterclayton
Copy link
Contributor

Follow up in #71713

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.12 Running in-cluster e2es no longer respects service account RBAC rules.
6 participants