testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

Integrate with Kubernetes

Open mraerino opened this issue 6 years ago • 5 comments

Someone at a meetup lately suggested it would be cool to be able to start containers on Kubernetes so blackbox tests of containers can be done using standard test libraries.

Since this library is in an early state, it would be a great opportunity to abstract the container layer in such a way that it does not matter whether the Docker or Kubernetes APIs are used.

mraerino avatar Nov 22 '18 22:11 mraerino

Yep, this is a good idea, I think we should create a Container interface with the current functions we implemented in the container like:

type Container interface{
     Terminate(ctx context.Context, t *testing.T) error
     LivenessCheckPorts(ctx context.Context) (nat.PortSet, error) 
     GetIPAddress(ctx context.Context) (string, error)
     GetHostEndpoint(ctx context.Context, port string) (string, string, error)
}

And we can have a new file kubernetes.go that implements that interface with a function RunPod (it should return a container just like RunContainer but via kubernetes (a pod).

Nice idea! I don't think this is a top priority btw. For example, I am using this library in a project and we use Jenkins to run tests against kubernetes but we use Docker in Docker. I am not sure about the benefits of having the ability to run pods directly. What do you think?

gianarb avatar Nov 23 '18 08:11 gianarb

That sounds great!

mraerino avatar Nov 23 '18 09:11 mraerino

The foundation for this has been laid in #36

mraerino avatar Nov 25 '18 14:11 mraerino

This is probably something we should do with the Java implementation and other forks, at the right time. Please could we discuss the general approach to tackling this?

I can't think of anything specific, but it would be good for all the implementations to be gradually moving towards convergence on feature sets rather than divergence 😄 .

rnorth avatar Nov 26 '18 21:11 rnorth

We have a lot to fix before this. So yes! Let's work on this together when everyone will be ready.

On Mon, Nov 26, 2018, 22:03 Richard North <[email protected] wrote:

This is probably something we should do with the Java implementation and other forks, at the right time. Please could we discuss the general approach to tackling this?

I can't think of anything specific, but it would be good for all the implementations to be gradually moving towards convergence on feature sets rather than divergence 😄 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/testcontainers/testcontainer-go/issues/22#issuecomment-441796947, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjgO2fZEjzfh7eycZhEmDk9WlEJcSX6ks5uzFcPgaJpZM4Yv8cC .

gianarb avatar Nov 26 '18 23:11 gianarb

I think it makes sense to move this thread to Discussions

mdelapenya avatar Aug 25 '22 10:08 mdelapenya