public class KubernetesAssistant extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
applicationName |
protected io.fabric8.kubernetes.clnt.v4_0.KubernetesClient |
client |
protected String |
namespace |
| Constructor and Description |
|---|
KubernetesAssistant(io.fabric8.kubernetes.clnt.v4_0.KubernetesClient client,
String namespace) |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitApplicationReadinessOrFail()
Awaits at most 5 minutes until all pods of the last deployed application are running.
|
void |
awaitApplicationReadinessOrFail(String applicationName)
Awaits at most 5 minutes until all pods of the application are running.
|
void |
awaitPodReadinessOrFail(Predicate<io.fabric8.kubernetes.api.model.v4_0.Pod> filter)
Awaits at most 5 minutes until all pods meets the given predicate.
|
void |
cleanup()
Removes all resources deployed using this class.
|
void |
deploy(InputStream inputStream)
Deploys application reading resources from specified InputStream
|
protected List<? extends io.fabric8.kubernetes.api.model.v4_0.HasMetadata> |
deploy(String name,
InputStream element) |
String |
deployAll(Path directory)
Deploys all y(a)ml and json files located at given directory.
|
String |
deployAll(String pattern)
Deploys application reading resources from classpath, matching the given regular expression.
|
void |
deployAll(String applicationName,
Path directory)
Deploys all y(a)ml and json files located at given directory.
|
void |
deployAll(String applicationName,
String pattern)
Deploys application reading resources from classpath, matching the given regular expression.
|
String |
deployApplication()
Deploys application finding resources in default location in classpath.
|
void |
deployApplication(String applicationName)
Deploys application finding resources in default location in classpath.
|
void |
deployApplication(String applicationName,
String... classpathLocations)
Deploys application reading resources from specified classpath location
|
void |
deployApplication(String applicationName,
URL... urls)
Deploys application reading resources from specified URLs
|
String |
deployApplication(URL... urls)
Deploys application reading resources from specified URLs
|
protected List<io.fabric8.kubernetes.api.model.v4_0.Pod> |
getPods(String label) |
Optional<URL> |
getServiceUrl()
Gets the URL of the first service that have been created during the current session.
|
Optional<URL> |
getServiceUrl(String name)
Gets the URL of the service with the given name that has been created during the current session.
|
String |
project() |
io.fabric8.kubernetes.api.model.v4_0.ReplicationController |
replicationController()
Method that returns the current replication controller object
|
void |
scale(int replicas)
Scaling the last deployed application to given replicas
|
void |
scale(String applicationName,
int replicas)
Scaling the application to given replicas
|
protected io.fabric8.kubernetes.clnt.v4_0.KubernetesClient client
protected String namespace
protected String applicationName
public KubernetesAssistant(io.fabric8.kubernetes.clnt.v4_0.KubernetesClient client,
String namespace)
public String deployApplication() throws IOException
IOExceptionpublic void deployApplication(String applicationName) throws IOException
In this method you specify the application name.
applicationName - to configure in clusterIOExceptionpublic void deployApplication(String applicationName, String... classpathLocations) throws IOException
applicationName - to configure in clusterclasspathLocations - where resources are readIOExceptionpublic String deployApplication(URL... urls) throws IOException
urls - where resources are readIOExceptionpublic void deployApplication(String applicationName, URL... urls) throws IOException
applicationName - to configure in clusterurls - where resources are readIOExceptionpublic void deployAll(String applicationName, String pattern)
applicationName - to configure the clusterpattern - to match the resources.public String deployAll(String pattern)
pattern - to match the resources.public String deployAll(Path directory) throws IOException
directory - where resource files are storedIOExceptionpublic void deployAll(String applicationName, Path directory) throws IOException
applicationName - to configure in clusterdirectory - where resources files are storedIOExceptionpublic void deploy(InputStream inputStream) throws IOException
inputStream - where resources are readIOExceptionprotected List<? extends io.fabric8.kubernetes.api.model.v4_0.HasMetadata> deploy(String name, InputStream element)
public Optional<URL> getServiceUrl(String name)
name - to return its URLpublic Optional<URL> getServiceUrl()
public void cleanup()
public void awaitApplicationReadinessOrFail()
public void awaitApplicationReadinessOrFail(String applicationName)
applicationName - name of the application to wait for pods readinesspublic String project()
public void awaitPodReadinessOrFail(Predicate<io.fabric8.kubernetes.api.model.v4_0.Pod> filter)
filter - used to wait to detect that a pod is up and running.public void scale(int replicas)
replicas - to scale the applicationpublic void scale(String applicationName, int replicas)
applicationName - name of the application to scalereplicas - to scale the applicationpublic io.fabric8.kubernetes.api.model.v4_0.ReplicationController replicationController()
Copyright © 2018 JBoss by Red Hat. All rights reserved.