kubernetes-sigs / kubetest2

Kubetest2 is the framework for launching and running end-to-end tests on Kubernetes.
Apache License 2.0
325 stars 105 forks source link

export all deployer struct #252

Closed errordeveloper closed 7 months ago

errordeveloper commented 7 months ago

this will ensure that each deployer can be easily called as a library, which GKE deployer already allows (kubernetes-sigs/kubetest2#135)

k8s-ci-robot commented 7 months ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: errordeveloper Once this PR has been reviewed and has the lgtm label, please assign xmcqueen for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/kubernetes-sigs/kubetest2/blob/master/OWNERS)** 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 commented 7 months ago

Welcome @errordeveloper!

It looks like this is your first PR to kubernetes-sigs/kubetest2 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubetest2 has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot commented 7 months ago

Hi @errordeveloper. 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](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
errordeveloper commented 7 months ago

@amwat as you mentioned in https://github.com/kubernetes-sigs/kubetest2/pull/135#pullrequestreview-667126661

Usability of deployers as libraries is questionable considering the contract between deployers and testers is still binary invocation.

I can see that testers are already exported, e.g.:

https://github.com/kubernetes-sigs/kubetest2/blob/d7fcb799ce84ceda66c8b9b1ec8eefcbe226f293/pkg/testers/clusterloader2/cl2.go#L36-L47

I'm sure there are many exec's, but I'm not hugely objected as long as I can start with outer logic controlled by a Go program. The chances are that I might have to implement a custom tester.

upodroid commented 7 months ago

Hi

Thank you for opening this PR. The deployers are effectively a finished program that shouldn't be called as libraries. If there is a missing feature, we recommend that you open a PR here and add it.

We have external implementations listed here that use pkg/* to create their own deployers.

What problem are you trying to solve?

errordeveloper commented 7 months ago

@upodroid thanks for your comment. I thought this change would be reasonable given GKE deployer is public (see #135).

I'd like to use kubetest2 in a project and will likely have a custom tester. I'd rather avoid creating a bash wrapper or a go program that uses exec, I don't see what would be the issue in exporting these structs, given GKE one is already is already exported. If there was a major objection, I suppose you should put the package under internal/, which would give a stronger signal that something is not intended to be shared outside the repo.

We have external implementations listed here that use pkg/* to create their own deployers.

What I want to do is use GKE and kind deployers, at the moment I can use the GKE one, but not kind. I'd rather not fork/rewrite same code.

upodroid commented 7 months ago

I'd like to use kubetest2 in a project and will likely have a custom tester. I'd rather avoid creating a bash wrapper or a go program that uses exec, I don't see what would be the issue in exporting these structs, given GKE one is already is already exported.

kubetest2 should be used like this. https://github.com/kubernetes-sigs/kubetest2/blob/master/kubetest2-gce/ci-tests/buildupdown-legacy.sh or https://github.com/kubernetes-sigs/kubetest2/blob/master/kubetest2-tester-node/ci-tests/gce-test.sh It should be the only program you call to run the entire process of creating a cluster, testing it and tearing it down.

The GKE one was exported for another project I work on and it wasn't a good idea. https://github.com/knative/hack/pull/230 we embedded that deployer in another program and it was painful to work with and I got rid of it.

errordeveloper commented 7 months ago

Thanks, I guess I'll just look for something else or write my own library.

The GKE one was exported for another project I work on and it wasn't a good idea. https://github.com/knative/hack/pull/230 we embedded that deployer in another program and it was painful to work with and I got rid of it.

Just curious, what was the most painful aspect of that?