Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 1.38 KB

File metadata and controls

51 lines (40 loc) · 1.38 KB

embedded-k3s

Maven dependency

pom.xml
<dependency>
    <groupId>com.playtika.testcontainers</groupId>
    <artifactId>embedded-k3s</artifactId>
    <scope>test</scope>
</dependency>

Consumes (via bootstrap.properties)

  • embedded.k3s.enabled (true|false, default is true)

  • embedded.k3s.reuseContainer (true|false, default is false)

  • embedded.k3s.dockerImage (default is 'rancher/k3s:v1.27.1-k3s1')

  • embedded.k3s.port (int, default is '6443')

Produces

  • embedded.k3s.kubeconfig Kubeconfig for Kubernetes client

  • embedded.k3s.networkAlias

  • embedded.k3s.internalPort

  • Bean K3Container embeddedK3s

Example for configuring client

You have few options for choosing client:

@Bean(destroyMethod = "close")
public ApiClient kubernetesClient(@Value("${embedded.k3s.kubeconfig}") String kubeconfig) {
    return Config.fromConfig(new StringReader(kubeConfigYaml));
}
@Bean(destroyMethod = "close")
public KubernetesClient kubernetesClient(@Value("${embedded.k3s.kubeconfig}") String kubeconfig) {
    return new KubernetesClientBuilder().withConfig(Config.from(kubeconfig)).build();
}