Package io.github.pod4dev.java
Class KubePlayer
java.lang.Object
io.github.pod4dev.java.KubePlayer
- All Implemented Interfaces:
GenericContainer,AutoCloseable
Work with /kube/play API.
-
Constructor Summary
ConstructorsConstructorDescriptionKubePlayer(String yamlPath) Creates player with specified path for k8s YAML specification.KubePlayer(String socketPath, String yamlPath) Creates player with specified paths for socket file and k8s YAML specification. -
Method Summary
Modifier and TypeMethodDescriptiongetMappedHost(String serviceName, int exposedPort) Getting mapped host for the given service's name and exposed port.intgetMappedPort(String serviceName, int exposedPort) Getting mapped port for the given service's name and exposed port.voidstart()Creates the pod or container and immediately starts it.voidstop()Stops the pod or container with clearing created volumes.withCleanup(boolean doCleanup) Do resources cleanup after stopping.withExposedService(String serviceName, int exposedPort) Specify service and its port for expose.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.pod4dev.java.GenericContainer
close
-
Constructor Details
-
KubePlayer
Creates player with specified path for k8s YAML specification. The socket path is autodetected viaPODMAN_SOCKETenvironment variable.- Parameters:
yamlPath- path to k8s YAML specification.- Throws:
PodmanException- ifyamlPathis empty or error during initialization is happened.
-
KubePlayer
Creates player with specified paths for socket file and k8s YAML specification. The socket path is autodetected viaPODMAN_SOCKETenvironment variable.- Parameters:
socketPath- path to socket file.yamlPath- path to k8s YAML specification.- Throws:
PodmanException- ifyamlPathis empty or error during initialization is happened.
-
-
Method Details
-
withExposedService
Description copied from interface:GenericContainerSpecify service and its port for expose.- Specified by:
withExposedServicein interfaceGenericContainer- Parameters:
serviceName- name of service to expose.exposedPort- port to expose.- Returns:
- container with exposed services.
- Throws:
PodmanException
-
withCleanup
Description copied from interface:GenericContainerDo resources cleanup after stopping.- Specified by:
withCleanupin interfaceGenericContainer- Parameters:
doCleanup- default if true.- Returns:
- customised container.
-
start
Description copied from interface:GenericContainerCreates the pod or container and immediately starts it. All created resources will be cleared out when a SIGTERM is received or pods exit.- Specified by:
startin interfaceGenericContainer- Throws:
PodmanException
-
stop
Description copied from interface:GenericContainerStops the pod or container with clearing created volumes.- Specified by:
stopin interfaceGenericContainer- Throws:
PodmanException
-
getMappedHost
Description copied from interface:GenericContainerGetting mapped host for the given service's name and exposed port.- Specified by:
getMappedHostin interfaceGenericContainer- Parameters:
serviceName- the service name.exposedPort- the exposed port.- Returns:
- mapped host.
-
getMappedPort
Description copied from interface:GenericContainerGetting mapped port for the given service's name and exposed port.- Specified by:
getMappedPortin interfaceGenericContainer- Parameters:
serviceName- the service name.exposedPort- the exposed port.- Returns:
- mapped host.
- Throws:
PodmanException
-