-
Notifications
You must be signed in to change notification settings - Fork 41.2k
ServiceConnection for K3sContainer #45717
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
Comments
@SpringFactories(ConnectionDetailsFactory.class)
class MinIOContainerConnectionDetailsFactory
extends ContainerConnectionDetailsFactory<MinIOContainer, ConnectionDetails> {
MinIOContainerConnectionDetailsFactory() {
super(DockerImageNames.MINIO_IMAGE);
}
@Override
protected ConnectionDetails getContainerConnectionDetails(ContainerConnectionSource<MinIOContainer> source) {
return new MinIOContainerConnectionDetails(source);
}
private static final class MinIOContainerConnectionDetails extends ContainerConnectionDetails<MinIOContainer> {
private MinIOContainerConnectionDetails(ContainerConnectionSource<MinIOContainer> source) {
super(source);
}
}
}
|
The In the case of @MichaelDausmann can you provide a bit more background about what you're trying to achieve? Perhaps you can share a sample application that uses your current workaround? |
@philwebb ah ok, good point. I'm specifically setting up a local dev environment with TestContainers for a Spring/Boot application that interacts directly with Kubernetes via the io.fabric8.kubernetes.client. so I guess to answer your question directly, I am connecting to the Kubernetes API server inside the K3sContainer. the workaround lets me create a KubernetesClient bean with an active client
... because I have set the application properties, the autoConfigure finds what it needs and connects without issue. At deployment .autoConfigure doesn't need e.g. a host because it is deployed in the cluster and the default url is fine |
@livk-cloud I will give your approach a try |
I would like to use K3sContainer for local Development, I already have Kafka and Neo4j working with @Serviceconnection. This would be nice...
K3sContainer is here (modules/k3s/src/main/java/org/testcontainers/k3s/K3sContainer.java)
Looks like it would require work here (spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection)
and here (spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure).
Workaround
Here is my workaround
The text was updated successfully, but these errors were encountered: