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

provider: added k3d provider and node lifecycle handlers #441

Merged

Conversation

harshanarayana
Copy link
Contributor

@harshanarayana harshanarayana commented Jul 13, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR enables a new E2EClusterProvider for k3d based infra.

This change includes the following changes and features.
  1. Added a new Interface type E2EClusterProviderWithImageLoaderAndNodeLifecycle which can be used to setup providers that extend the cluster lifecycle function around the nodes.
  2. Enabled a k3d based provider with support for Node lifecycle management.
  3. Existing Image loader related function and interfaces were augmented with args ...string to be able to provide additional arguments in case if the image load handlers need some of the additional config.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

I have also extended the E2EClusterProviderWithImageLoader 's Image load related methods to take an additional arg ...string value to account for additional options that one can pass while performing image load operation alone.

This comes in handy with k3d where it provides a few different mode of loading images and cleanup workflows.

This change also doesn't break any existing API contract extended by the envfuncs.

Does this PR introduce a user-facing change?

enabled a new `E2eClusterProvider` for `k3d` that can be used as a new cluster provider for running e2e tests.

Additional documentation e.g., Usage docs, etc.:

NA

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Jul 13, 2024
@k8s-ci-robot k8s-ci-robot added 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 13, 2024
@harshanarayana harshanarayana force-pushed the feature/k3d-provider-support branch 2 times, most recently from 0c3a6e3 to d25b6ab Compare July 13, 2024 14:38
@harshanarayana
Copy link
Contributor Author

/cc @cpanato

@k8s-ci-robot k8s-ci-robot requested a review from cpanato July 13, 2024 14:41
@harshanarayana
Copy link
Contributor Author

go install of k3d is failing due to an issue similar to k3d-io/k3d#1324

@harshanarayana
Copy link
Contributor Author

/hold

Holding this under the k3d install issue is resolved.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 14, 2024
@harshanarayana harshanarayana force-pushed the feature/k3d-provider-support branch 2 times, most recently from 3b76b81 to a70ae18 Compare July 16, 2024 05:50
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 16, 2024
Comment on lines +46 to +51
p := commandRunner.NewProc(installCommand)
p.SetStdout(&stdout)
p.SetStderr(&stderr)
result := p.Run()
if result.Err() != nil {
return "", fmt.Errorf("failed to install %s: %s: \n %s", pPath, result.Result(), stderr.String())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding these to be able to capture and log the install failures better during the provider install.

@harshanarayana
Copy link
Contributor Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 16, 2024
@harshanarayana harshanarayana force-pushed the feature/k3d-provider-support branch from a70ae18 to afe220a Compare July 16, 2024 11:21
@harshanarayana harshanarayana changed the title provider: enable k3d based cluster provider provider: added k3d provider and node lifecycle handlers Jul 16, 2024
@harshanarayana harshanarayana force-pushed the feature/k3d-provider-support branch 2 times, most recently from 46696b8 to 6a755b5 Compare July 16, 2024 11:24
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.

/lgtm
thanks

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

/hold

Copy link
Member

@ShwethaKumbla ShwethaKumbla left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Making progress @harshanarayana
Added some more comments.

support/k3d/k3d.go Outdated Show resolved Hide resolved

// PerformNodeLifecycleOperation performs a node operation on a cluster. These operations can range from Add/Remove/Start/Stop.
// This helper is re-used in both node lifecycle handler used as types.StepFunc or env.Func
func PerformNodeLifecycleOperation(ctx context.Context, action support.NodeOperation, node *support.Node, args ...string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this function only applies when using K3d or do you think orther providers will use that.
If only k3d, maybe it belongs in third_party package path if that is the case.

Copy link
Contributor Author

@harshanarayana harshanarayana Aug 1, 2024

Choose a reason for hiding this comment

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

Other providers like minikube can support this.. And kwok technically can be simulated to enable node add and remove workflows. So it can work with other providers as well. We can do that even for kind. But we will have to use adhoc docker command to simulate power on and off kind of workflows

support/k3d/k3d.go Outdated Show resolved Hide resolved
@harshanarayana harshanarayana force-pushed the feature/k3d-provider-support branch from 1597cf5 to 3d1be3f Compare August 15, 2024 13:38
@harshanarayana
Copy link
Contributor Author

@vladimirvivien PTAL when you can. Addressed the required changes in the message for wait for control plane.

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.

More comments.

support/k3d/k3d.go Show resolved Hide resolved
p = commandRunner.RunProc("ls $GOPATH/bin")
if p.Err() != nil {
return "", fmt.Errorf("failed to install %s: %s", pPath, p.Err())
p = commandRunner.NewProc("ls $GOPATH/bin")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think gexe could be improved to make output caputure easier ? If so, please open an issue.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 29, 2024
@harshanarayana
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 1, 2024
@vladimirvivien
Copy link
Contributor

@harshanarayana is this still on your radar for 2025?

@harshanarayana
Copy link
Contributor Author

I will get this done before we cut the christmas release..

@harshanarayana harshanarayana force-pushed the feature/k3d-provider-support branch from 3d1be3f to 6b424cb Compare January 8, 2025 14:15
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 8, 2025
@harshanarayana
Copy link
Contributor Author

@vladimirvivien @cpanato PTAL. I have reorganised all the providers under third_party as suggested in the comments, and added backward compatibility type alias to make sure we do not break existing behaviours for the users who are already consuming this in some form.

@harshanarayana
Copy link
Contributor Author

/test pull-e2e-framework-test

1 similar comment
@harshanarayana
Copy link
Contributor Author

/test pull-e2e-framework-test

@harshanarayana
Copy link
Contributor Author

/test pull-e2e-framework-verify

1 similar comment
@harshanarayana
Copy link
Contributor Author

/test pull-e2e-framework-verify

@cpanato cpanato mentioned this pull request Jan 15, 2025
@cpanato
Copy link
Member

cpanato commented Jan 15, 2025

@harshanarayana rebase after we merge #480

This change includes the following changes and features.

1. Added a new Interface type `E2EClusterProviderWithLifeCycle`
which can be used to setup providers that extend the cluster lifecycle function around the nodes.
2. Enabled a `k3d` based provider with support for Node lifecycle management.
3. Existing Image loader related function and interfaces were augmented with `args ...string`
to be able to provide additional arguments in case if the image load
handlers need some of the additional config.

refactor: re-organize the provider under third_party

uptick kind version to 0.26.0 and fix vcluster test
@harshanarayana harshanarayana force-pushed the feature/k3d-provider-support branch from abd0491 to f8b0bcd Compare January 15, 2025 10:17
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.

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, harshanarayana

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,harshanarayana]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cpanato
Copy link
Member

cpanato commented Jan 15, 2025

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 15, 2025
@k8s-ci-robot k8s-ci-robot merged commit d5fd748 into kubernetes-sigs:main Jan 15, 2025
4 checks passed
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/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. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants