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

Add option to provide Kubernetes cluster for testing #2170

Closed
ktff opened this issue Mar 29, 2020 · 10 comments
Closed

Add option to provide Kubernetes cluster for testing #2170

ktff opened this issue Mar 29, 2020 · 10 comments
Assignees
Labels
domain: tests Anything related to Vector's internal tests needs: more demand Needs more demand before work can begin, +1 or comment to support.

Comments

@ktff
Copy link
Contributor

ktff commented Mar 29, 2020

With #1970, running Kubernetes tests with make will start Kubernetes cluster using kind which is known to being slow at times which can trigger timeouts in out tests.

One of the solutions for this is to enable usage of user provided cluster.

This would solve the issue of timeouts, and enable easier testing on different clusters.

Main issue with this is how to robustly provide builded image, of vector binary to be executed, to the provided Kubernetes cluster.

One way of doing it is by requesting the user to provide a registry to which the image can be pushed.

@ktff ktff added domain: tests Anything related to Vector's internal tests needs: more demand Needs more demand before work can begin, +1 or comment to support. labels Mar 29, 2020
@MOZGIII
Copy link
Contributor

MOZGIII commented Apr 1, 2020

One way of doing it is by requesting the user to provide a registry to which the image can be pushed.

I like this actually. Currently, we spin-up the localhost registry and use that by default. If we provide a way to specify custom docker image/tag - user would be able to pass their existing registries. If we also provide an extension point to integrate with something like ngrok (and/or frp or ssh tunnels) to expose the docker-registry we run - we'll cover even more cases, since not everyone can use an external registry.

@ktff
Copy link
Contributor Author

ktff commented Apr 3, 2020

So, there are 4 different components/steps to testing Kubernetes:

  1. Providing a repository
  2. Building and pushing Vector image
  3. Providing a cluster
  4. Running the tests

We could expose the script on three different granularitis:

  1. Largest granularity, as it's now, which does all steps.
    - If kind works for you, this is the simplest way of testing.
    - Once we find a substitute for kind this would be even more useful.

  2. Medium, the script will do 2. and 4. step and the user would provide 1. and 3.
    - This would enable easier testing if 1. isn't working.
    - It would also make testing on different clusters easier.
    - This is bunched together since cluster needs to be configured to be able to use private repository, so we can't just start local repository. (Minikube is maybe an exception)

  3. Smallest, the script would just do 2. step.
    - Useful for more faster testing/debugging of one test

@MOZGIII @LucioFranco what do you think?

Also what are your experiences with different Kubernetes cluster meant for testing? Like minikube, microk8s, kind, and the like.

@LucioFranco
Copy link
Contributor

The major thing we need implemented is this some script that can build vector, push an image to some registry, and run a set of integration tests against some kube cluster. The config for this should be some kubeconfig and a registry url. This should then allow us to test against any kube cluster whether it is kind, minikube or an actual cluster running somewhere in the cloud. I would not worry about the script setting up a cluster because locally that is very trivially done via minikube.

@ktff
Copy link
Contributor Author

ktff commented Apr 3, 2020

I agree, then to keep it simple we could only support that.

@MOZGIII
Copy link
Contributor

MOZGIII commented Apr 4, 2020

I think it's cool that we can provide a registry. It would be great to have a script for that, maybe to run ad-hoc.

We can also consider using an empty container for vector, and copying compiled files into it before running the test (skaffold/ksync style). This way we don't need a registry.

Also what are your experiences with different Kubernetes cluster meant for testing? Like minikube, microk8s, kind, and the like.

I've been using minikube mostly. k3d looks interesting though.

@MOZGIII
Copy link
Contributor

MOZGIII commented Apr 4, 2020

Also, I'm looking for the tooling that I could call manually. I'm not opposed to having a script that implements a "whole process", but it would be great if it simply outlines the logic while being composed of smaller individually callable components. I.e. so that I can invoke building vector docker image manually.
The reason I want that is I feel like having make kubernetes-tests, while being an excellent command to run the tests, is not the only thing I'd want to do while working on k8s-related functionality. From practice, I had to run vector manually to test some of my assumptions regarding a bug. This kind of troubleshooting would be simplified if I had a set of tools for manual use to do what make kubernetes-tests does internally.
This is on a nice-to-have level though.

@binarylogic binarylogic added this to the Initial containers support milestone Apr 4, 2020
@binarylogic binarylogic assigned MOZGIII and unassigned ktff Apr 4, 2020
@LucioFranco
Copy link
Contributor

I don't think we have users running enough tests for kube to make that worth it. Ideally, CI should cover the majority case and users that need to do so locally should be able to stand up what they need.

@MOZGIII
Copy link
Contributor

MOZGIII commented Apr 8, 2020

The utilities are not for our users, they're for us.

CI should cover the cases that CI is built for, however, when developing, if I want to try to run the code I make at k8s I have to build the image myself.

So, I'm all about having an option to do

bin/build-docker-image mozgiii/vector-tests:mytest taget/release/vector

instead of

docker build -t "mozgiii/vector-tests:mytest" -f - . << EOF
FROM buildpack-deps:18.04-curl
COPY ./taget/release/vector /usr/local/bin
ENTRYPOINT ["/usr/local/bin/vector"]
EOF

Take a look at scripts/kubernetes-test.sh, it has a bunch of cool useful subroutines that could be easily exposed as commands and then reused.

@LucioFranco
Copy link
Contributor

@MOZGIII that seems totally fine, I would say that we can expect developers to have docker and a valid kubeconfig. From there we can write a script as you said to build the image and run tests.

@binarylogic binarylogic modified the milestones: Initial Containers Support, 2020.07.19 - The Great Orientation Jul 20, 2020
@MOZGIII
Copy link
Contributor

MOZGIII commented Jul 29, 2020

Fixed via #2702.

@MOZGIII MOZGIII closed this as completed Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: tests Anything related to Vector's internal tests needs: more demand Needs more demand before work can begin, +1 or comment to support.
Projects
None yet
Development

No branches or pull requests

4 participants