8000 Adding an e2e test on GMSA support by wk8 · Pull Request #82109 · kubernetes/kubernetes · GitHub
[go: up one dir, main page]

Skip to content

Conversation

wk8
Copy link
Contributor
@wk8 wk8 commented Aug 29, 2019

What type of PR is this?
/kind feature

What this PR does / why we need it:
The previously existing e2e GMSA test really only tests a small part of the
whole GMSA set up process, namely that once the API has inlined the GMSA
contents in the pod's spec, and sent that to a worker's kubelet, then the
kubelet passes that down to the runtime.

This new test, in contrast, really tests the whole thing, i.e. deploying the
admission webhook, then deploying a GMSA custom resource, and using that
resource within a pod.

The downside of this test though, is that it does need to make a lot of
assumptions about the cluster it runs against, notably that it runs on a worker
node that's already been joined to a working Active Directory domain (there are
other assumptions, all documented at the beginning of the test file); for that
reason, it is only intended to ever be run against an AKS cluster with the
custom AKS extension from
kubernetes-sigs/windows-testing#98.

Note that this test doesn't aim at testing every edge-case, such as
a pod trying to use a GMSA it doesn't have access to; the webhook has
its own tests for these. This test's goal is to ensure the happy path
doesn't break.

Special notes for your reviewer:
Before this test can actually be run as part of nightly builds, we'll have to make
sure that:

  1. test: Creates AD Domain for GMSA e2e testing kubernetes-sigs/windows-testing#98 gets merged
  2. the test cluster needs to be at least version 1.15.0
  3. the WindowsGMSA=true feature flag is turned on on both the API and the workers' kubelets
  4. the API needs to have both MutatingAdmissionWebhook and ValidatingAdmissionWebhook admission controllers enabled
  5. the cluster needs to have at least one Linux node on which pods can be scheduled; that's needed for the webhook's pod.

Until then, this test should be skipped; note that I did it run successfully
on a cluster brought up with AKS-engine with all the modifications outlined
above.

Also, this test assumes that the test itself runs on a Linux box, is that okay?
This is because the webhook deploy script has been written in bash.

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. 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. 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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. kind/feature Categorizes issue or PR as related to a new feature. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Aug 29, 2019
@wk8
Copy link
Contributor Author
wk8 commented Aug 29, 2019

/priority important-soon
/sig windows
/milestone v1.16

@k8s-ci-robot
Copy link
Contributor

@wk8: You must be a member of the kubernetes/milestone-maintainers GitHub team to set the milestone. If you believe you should be able to issue the /milestone command, please contact your and have them propose you as an additional delegate for this responsibility.

In response to this:

/priority important-soon
/sig windows
/milestone v1.16

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/windows Categorizes an issue or PR as relevant to SIG Windows. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 29, 2019
wk8 added a commit to wk8/kubernetes that referenced this pull request Aug 29, 2019
Concerns from alpha-phase reviews have been addressed in
kubernetes#80320
and
kubernetes#82109
and early adopters have given positive feedback; so it seems there are
no blockers to graduate GMSA support to beta.

This patch also enables GMSA support by default, mainly for the sake of
making it easier for cluster admins to use, as well as for e2e tests in
nightly builds.

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
@wk8 wk8 force-pushed the wk8/gmsa-e2e branch 2 times, most recently from e5f4339 to 894c80c Compare August 29, 2019 03:20
@ddebroy
Copy link
Contributor
ddebroy commented Aug 29, 2019

/assign @PatrickLang

8000
Copy link
Contributor
@ddebroy ddebroy Aug 29, 2019

Choose a reason for hiding this comment

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

Please do a framework.skipf() here instead of Failf so that this test will not require explicit skipping in clusters where the dependencies are not fulfilled. Check out

framework.Skipf("Requires at least %d nodes (not %d)", 2, len(nodes.Items))

or
framework.Skipf("Environment does not support getting controller-manager metrics - skipping")

for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing, but wouldn't that also have the negative effect of skipping this test in nightly builds (where it should run, and fail, in that case) if the dependencies stop being fulfilled there?

Copy link
Contributor

Choose a reason for hiding this comment

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

golint requires this to be gmsaWebhookDeployScriptURL instead of gmsaWebhookDeployScriptUrl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@ddebroy
Copy link
Contributor
ddebroy commented Aug 29, 2019

/assign @adelina-t

@ddebroy
Copy link
Contributor

/test pull-kubernetes-bazel-build

@ddebroy
Copy link
Contributor
ddebroy commented Aug 29, 2019

/test pull-kubernetes-e2e-gce-device-plugin-gpu

@adelina-t
Copy link
Contributor

/cc @BCLAU

Copy link
Contributor

Choose a reason for hiding this comment

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

To be honest, not a fan of this URL being here in the tests. Then again, I don't really have any alternative ideea :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same, didn't love it... Sorry. :(

Copy link
Contributor

Choose a reason for hiding this comment

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

could go with powershell get-content here. Type is aliased to get-content, but much less known.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, changing :)

Copy link
Contributor

Choose a reason for hiding this comment

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

more of a nit, but I feel this might go in a utils.go to be reused.

Copy link
Contributor Author
@wk8 wk8 Aug 29, 2019

Choose a reason for hiding this comment

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

Indeed. Do you mean a utils.go in the same package? Or something more general?

Copy link
Contributor

Choose a reason for hiding this comment

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

in the same package, so it may be used by other tests if needed. It would be nice to have, but not a necessity

@adelina-t
Copy link
Contributor

/lgtm
@BCLAU can you also take a look?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 29, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 29, 2019
The previously existing e2e GMSA test really only tests a small part of the
whole GMSA set up process, namely that once the API has inlined the GMSA
contents in the pod's spec, and sent that to a worker's kubelet, then the
kubelet passes that down to the runtime.

This new test, in contrast, really tests the whole thing, i.e. deploying the
admission webhook, then deploying a GMSA custom resource, and using that
resource within a pod.

The downside of this test though, is that it does need to make a lot of
assumptions about the cluster it runs against, notably that it runs on a worker
node that's already been joined to a working Active Directory domain (there are
other assumptions, all documented at the beginning of the test file); for that
reason, it is only intended to ever be run against an AKS cluster with the
custom AKS extension from
kubernetes-sigs/windows-testing#98.

Note that this test doesn't aim at testing every edge-case, such as
a pod trying to use a GMSA it doesn't have access to; the webhook has
its own tests for these. This test's goal is to ensure the happy path
doesn't break.

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
@wk8
Copy link
Contributor Author
wk8 commented Aug 29, 2019

@adelina-t : thanks for the quick review! Amended as requested.

@adelina-t
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 29, 2019
@PatrickLang
Copy link
Contributor

/milestone v1.16

@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 29, 2019
// downloadFile saves a remote URL to a local temp file, and returns its path.
// It's the caller's responsibility to clean up the temp file when done.
func downloadFile(url string) (string, error) {
response, err := http.Get(url)
Copy link
Contributor

Choose a reason for hiding this comment

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

today I learned that this automatically follows 30x redirects https://golang.org/pkg/net/http/#Client.Get

node := nodes[0]

ginkgo.By("retrieving the contents of the GMSACredentialSpec custom resource manifest from the node")
crdManifestContents := retrieveCRDManifestFileContents(f, node)
Copy link
Contributor

Choose a reason for hiding this comment

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

just a nit - if this isn't referenced, will the linter fail?

I think the test sufficiently validates that the CRD exists as-is, so maybe this needs to be _ = ... . If the CRD contents are wrong, then createPodWithGmsa will fail later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is referenced in customResourceCleanup, err := createGmsaCustomResource(crdManifestContents) below :)

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yeah, missed that, needed to hit ctrl-f again

@PatrickLang
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: PatrickLang, wk8

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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 29, 2019
@k8s-ci-robot k8s-ci-robot merged commit e176e47 into kubernetes:master Aug 30, 2019
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 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/testing Categorizes an issue or PR as relevant to SIG Testing. sig/windows Categorizes an issue or PR as relevant to SIG Windows. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0