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

feat: add vcluster e2e cluster provider #450

Merged
merged 8 commits into from
Nov 14, 2024

Conversation

crandles
Copy link
Contributor

@crandles crandles commented Aug 29, 2024

addition of vcluster provider; interested to see if the CI fails. vcluster needs a "host" cluster to launch into, so I've followed an existing example where a real cluster or kind cluster are utilized as necessary:

if os.Getenv("REAL_CLUSTER") == "true" {

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR enables a new E2EClusterProvider for vcluster based clusters.

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., Usage docs, etc.:

NA

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Aug 29, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @crandles. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 29, 2024
@crandles crandles force-pushed the add-vcluster branch 2 times, most recently from 9f6fc49 to c1c98a4 Compare August 29, 2024 12:03
@crandles crandles marked this pull request as ready for review August 29, 2024 13:10
@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 Aug 29, 2024
@vladimirvivien
Copy link
Contributor

@crandles this is awesome and thanks for the contribution.
At first glance it looks Okay, but I will ask @harshanarayana to take a look as well since he's the E2E provider expert 😉

Copy link
Contributor

@vladimirvivien vladimirvivien left a comment

Choose a reason for hiding this comment

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

This is a great start. I left some comments.

echo.SetEnv("KUBECONFIG", c.hostKubeCfg)
}

p := echo.RunProc(command)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think @harshanarayana has some util wrapper for running procs that should be considered here.

Copy link
Contributor

@vladimirvivien vladimirvivien left a comment

Choose a reason for hiding this comment

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

This looks good to me.
LGTM

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 11, 2024
@vladimirvivien
Copy link
Contributor

/retest

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 11, 2024
@crandles
Copy link
Contributor Author

Updated copyright, verify-boilerplate passes locally now.

@vladimirvivien
Copy link
Contributor

/retest

@crandles
Copy link
Contributor Author

golangci appears to be passing now for thew new code I've added, though errirng for some existing LOC:

third_party/helm/helm.go:240:9: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
		err = fmt.Errorf(missingHelm)
		      ^
third_party/flux/flux_setup.go:47:16: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
			return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
			            ^
third_party/flux/flux_setup.go:61:16: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
			return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
			            ^
pkg/env/env.go:229:11: printf: non-constant format string in call to (*testing.common).Skipf (govet)
		t.Skipf(message)
		        ^
pkg/env/env.go:513:22: printf: non-constant format string in call to (*testing.common).Skipf (govet)
					internalT.Skipf(message)

Assuming that won't block this PR.

@vladimirvivien
Copy link
Contributor

@harshanarayana and @cpanato any idea why golangci failing on previously working code ?

@crandles
Copy link
Contributor Author

crandles commented Sep 28, 2024

errors were primarily for:

SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)

It's possible that I'm using a different toolchain version, but as the warning seemed fair, I've fixed it via cf9cbf2

make verify now passes locally.

@vladimirvivien
Copy link
Contributor

@crandles is this ready to go now ?

@crandles
Copy link
Contributor Author

Yes, I believe so

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 25, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 25, 2024
@crandles
Copy link
Contributor Author

crandles commented Oct 25, 2024

rebased due to go.mod conflict

Copy link
Contributor

@vladimirvivien vladimirvivien 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 Nov 4, 2024
@vladimirvivien
Copy link
Contributor

@harshanarayana @ShwethaKumbla @cpanato PTAL I think we need a second reviewer.

@harshanarayana
Copy link
Contributor

I will check by eod tomorrow.

@crandles
Copy link
Contributor Author

crandles commented Nov 4, 2024

Seems to fail installing vcluster; can't reproduce. Any tips? I think I'm installing vcluster the same way other tools are (ko|kwok|kind)

@harshanarayana
Copy link
Contributor

harshanarayana commented Nov 5, 2024

Seems to fail installing vcluster; can't reproduce. Any tips? I think I'm installing vcluster the same way other tools are (ko|kwok|kind)

@crandles

Helm and flux are installed slightly in a different way, https://github.com/kubernetes-sigs/e2e-framework/blob/777cbcd59fbbe572b71dde89c8f7b0b1a5ddc4a7/hack/install-helm.sh

test: install-helm install-flux ## Runs golang unit tests
	./hack/test-go.sh

But you are right about ko or kwok though

@vladimirvivien
Copy link
Contributor

/retest

@crandles
Copy link
Contributor Author

crandles commented Nov 12, 2024

Is there a recommended way to simulate the prow test runner locally?

This looks relevant: https://docs.prow.k8s.io/docs/build-test-update/#running-a-prowjob-locally (and this job), I'll try to follow it.


Trying this out so far, not quite working yet:

# new makefile target
run-pr-tests:
	mkdir -p ./build ./build/out ./build/node_dir
	curl -s -o build/e2e-framework-presubmits.yaml https://raw.githubusercontent.com/kubernetes/test-infra/master/config/jobs/kubernetes-sigs/e2e-framework/e2e-framework-presubmits.yaml
	curl -s -o build/pj-on-kind.sh https://raw.githubusercontent.com/kubernetes-sigs/prow/refs/heads/main/pkg/pj-on-kind.sh
	curl -s -o build/prow-config.yaml https://raw.githubusercontent.com/kubernetes/test-infra/refs/heads/master/config/prow/config.yaml
	NODE_DIR=$(realpath build/node_dir) OUT_DIR=$(realpath build/out) CONFIG_PATH=$(realpath build/prow-config.yaml) JOB_CONFIG_PATH=$(realpath build/e2e-framework-presubmits.yaml) bash ./build/pj-on-kind.sh pull-e2e-framework-test

Output
latest: Pulling from k8s-prow/mkpj
Digest: sha256:6e71c2d9f675bce23136443cd8093fad59ed3344325d305963e89eadb7d3b6d5
Status: Image is up to date for gcr.io/k8s-prow/mkpj:latest
gcr.io/k8s-prow/mkpj:latest

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview gcr.io/k8s-prow/mkpj:latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
time="2024-11-13T04:38:37Z" level=warning msg="empty -github-token-path, will use anonymous github client"
time="2024-11-13T04:38:37Z" level=info msg="Throttle(0, 0, [])" client=github
PR Number: 450
time="2024-11-13T04:39:20Z" level=info msg="GetPullRequest(kubernetes-sigs, e2e-framework, 450)" client=github
time="2024-11-13T04:39:20Z" level=debug msg="Using GitHub REST API Version: 2022-11-28" client=github
time="2024-11-13T04:39:20Z" level=debug msg="Used token for request" cache-mode= client=github method=GET path=/repos/kubernetes-sigs/e2e-framework/pulls/450 throttled=true
time="2024-11-13T04:39:20Z" level=debug msg="GetPullRequest(kubernetes-sigs, e2e-framework, 450) finished" client=github duration=419.387292ms
latest: Pulling from k8s-prow/mkpod
Digest: sha256:1a95d701f6cafae2c004088e47f15efc0b8e5b8d8fb6a23a2e2ccd94471eda46
Status: Image is up to date for gcr.io/k8s-prow/mkpod:latest
gcr.io/k8s-prow/mkpod:latest

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview gcr.io/k8s-prow/mkpod:latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
time="2024-11-13T04:39:22Z" level=info msg="Generated build-id for job." build-id=1856557443136360448
time="2024-11-13T04:39:22Z" level=info msg="Pod-utils configured for local mode. Instead of uploading to GCS, files will be copied to an output dir on the node." out-dir=/Users/c/code/e2e-framework/build/out/pull-e2e-framework-test/1856557443136360448
For each of the following volumes specify one of:
 - 'empty' to use an emptyDir;
 - a path on the host to use hostPath;
 - '' (nothing) to use the existing volume source and assume it is available in the cluster
Volume "service": empty
Applying pod to the mkpod cluster. Configure kubectl for the mkpod cluster with:
>  export KUBECONFIG='/Users/c/.kube/kind-config-mkpod'
NAME                                   READY   STATUS     RESTARTS   AGE
aed6b1e8-6ada-4b27-90ad-c7387846b7b0   0/2     Init:0/3   0          0s
aed6b1e8-6ada-4b27-90ad-c7387846b7b0   0/2     Init:0/3   0          4s
aed6b1e8-6ada-4b27-90ad-c7387846b7b0   0/2     Init:1/3   0          7s
aed6b1e8-6ada-4b27-90ad-c7387846b7b0   0/2     Init:2/3   0          10s
aed6b1e8-6ada-4b27-90ad-c7387846b7b0   0/2     Init:2/3   0          12s
aed6b1e8-6ada-4b27-90ad-c7387846b7b0   0/2     PodInitializing   0          13s
aed6b1e8-6ada-4b27-90ad-c7387846b7b0   2/2     Running           0          70s
---
% kubectl logs -f aed6b1e8-6ada-4b27-90ad-c7387846b7b0
Defaulted container "test" out of: test, sidecar, clonerefs (init), initupload (init), place-entrypoint (init)
Docker in Docker enabled, initializing...
================================================================================
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.all.forwarding = 1
Starting Docker: docker.
Waiting for docker to be ready, sleeping for 1 seconds.
================================================================================
Done setting up docker in docker.
ERROR: (gcloud.auth.activate-service-account) Unable to read file [/etc/service-account/service-account.json]: [Errno 2] No such file or directory: '/etc/service-account/service-account.json'
+ WRAPPED_COMMAND_PID=271
+ wait 271
+ make test
./hack/install-helm.sh
Downloading https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz
Verifying checksum... Done.
...
./hack/test-go.sh
go: downloading sigs.k8s.io/controller-runtime v0.19.1
go: downloading k8s.io/klog/v2 v2.130.1
go: downloading k8s.io/client-go v0.31.2
go: downloading k8s.io/apimachinery v0.31.2
...
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: waiting for init preliminary setup: read init-p: connection reset by peer: unknown.
...

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 13, 2024
@crandles
Copy link
Contributor Author

crandles commented Nov 13, 2024

found/resolved a couple of issues:

  • I was mistaken on the vcluster installation path, it is vclusterctl not vcluster
    • Apparently I've been falling back to an alternatively installed vcluster in my CI
  • there was a flaw in the version defaulting logic

@cpanato
Copy link
Member

cpanato commented Nov 14, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 14, 2024
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

thanks

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, crandles, vladimirvivien

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:
  • OWNERS [cpanato,vladimirvivien]

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 merged commit 9ed2008 into kubernetes-sigs:main Nov 14, 2024
3 of 4 checks passed
@crandles
Copy link
Contributor Author

Thanks for the reviews!

I will try to rebase next time, and I may follow up with an issue about how to run the pr tests locally. I need to spend more time looking at the pj on kind script.

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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants