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

test/e2e_node: add kubelet credential provider tests #108651

Merged
merged 7 commits into from Mar 23, 2022

Conversation

andrewsykim
Copy link
Member

@andrewsykim andrewsykim commented Mar 11, 2022

Co-authored-by: Aditi Sharma adi.sky17@gmail.com

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds a node e2e test for the kubelet credential provider feature by implementing a barebones credential provider for GCP that is built alongside the node e2e artifacts.

Reasons why including a GCP-specific implementation just for testing could work:

  • it can be implemented with just the standard http client, meaning it can continue to be used for testing purposes even after cloud providers are fully removed in-tree.
  • the plugin can be adapted in-tree to mimic certain behaviors (like longer timeouts, caching, etc) that we specifically need for tests
  • enabling the credential provider mechanism directly from the e2e runner seems simpler than trying to configure it through prow job config
  • avoids circular dependencies when trying to use the GCP credential provider in k8s.io/cloud-provider-gcp for tests in k/k

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/provider/gcp Issues or PRs related to gcp provider area/test sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 11, 2022
func getCredentials() error {
provider := &provider{
client: &http.Client{
Timeout: 10 * time.Second,
Copy link
Member

Choose a reason for hiding this comment

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

this is a hard timeout, I mean, it can still be downloading something that it will exit, just mentioning most probably you are aware :)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just taken from https://github.com/kubernetes/kubernetes/blob/master/pkg/credentialprovider/gcp/metadata.go#L65 -- but 10s seems generous though for an htttp request against a metadata endpoint to get an auth token, we're not downloading images or anything like that

}

var parsedBlob TokenBlob
if err := json.Unmarshal([]byte(tokenJSONBlob), &parsedBlob); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

nit: are you not already returning a []byte?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, fixed this

Testname: Test kubelet image credential provider
Description: Create Pod with image from private registry, image credentials fetched from external credential provider by kubelet.
*/
framework.ConformanceIt("should be able to create pod with image credentials fetched from external credential provider [NodeConformance]", func() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Conformance part is temporary cause I want to try to run it on pre-submit.

Copy link
Member Author

@andrewsykim andrewsykim force-pushed the node-e2e-cred-provider branch 4 times, most recently from 5a117b5 to 7d4236c Compare March 14, 2022 16:51
@andrewsykim andrewsykim changed the title [WIP] test/e2e_node: add kubelet credential provider tests test/e2e_node: add kubelet credential provider tests Mar 14, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 14, 2022
@andrewsykim andrewsykim changed the title test/e2e_node: add kubelet credential provider tests [WIP] test/e2e_node: add kubelet credential provider tests Mar 14, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 14, 2022
@ehashman ehashman added this to Waiting on Author in SIG Node PR Triage Mar 14, 2022
Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

/lgtm

@SergeyKanzhelev
Copy link
Member

/retest

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewsykim, SergeyKanzhelev

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

@andrewsykim
Copy link
Member Author

/retest

@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@andrewsykim
Copy link
Member Author

/retest

@adisky
Copy link
Contributor

adisky commented Mar 23, 2022

/test pull-kubernetes-integration

@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

1 similar comment
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

andrewsykim and others added 7 commits March 23, 2022 10:30
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Co-authored-by: Aditi Sharma <adi.sky17@gmail.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Co-authored-by: Aditi Sharma <adi.sky17@gmail.com>
…vider for testing only

Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Co-authored-by: Aditi Sharma <adi.sky17@gmail.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Co-authored-by: Aditi Sharma <adi.sky17@gmail.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Co-authored-by: Aditi Sharma <adi.sky17@gmail.com>
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
Co-authored-by: Aditi Sharma <adi.sky17@gmail.com>
…-credential-provider

Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 23, 2022
Copy link
Contributor

@adisky adisky left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 23, 2022
@andrewsykim
Copy link
Member Author

/retest

1 similar comment
@andrewsykim
Copy link
Member Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit da88853 into kubernetes:master Mar 23, 2022
SIG Node CI/Test Board automation moved this from PRs - Needs Reviewer to Done Mar 23, 2022
SIG Node PR Triage automation moved this from Waiting on Author to Done Mar 23, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.24 milestone Mar 23, 2022
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/provider/gcp Issues or PRs related to gcp provider area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging this pull request may close these issues.

None yet

9 participants