Package io.skodjob.testframe.clients
Class KubeClient
java.lang.Object
io.skodjob.testframe.clients.KubeClient
Provides functionality to interact with Kubernetes and OpenShift clusters.
This includes creating clients, reading resources from files, and managing kubeconfig for authentication.
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes the Kubernetes client with configuration derived from environment variables or default context. -
Method Summary
Modifier and TypeMethodDescriptionio.fabric8.kubernetes.client.KubernetesClientReturns the Kubernetes client.Returns the path to the kubeconfig file used for authentication.io.fabric8.openshift.client.OpenShiftClientAdapts the Kubernetes client to an OpenShift client.List<io.fabric8.kubernetes.api.model.HasMetadata>Reads Kubernetes resources from an InputStream.List<io.fabric8.kubernetes.api.model.HasMetadata>readResourcesFromFile(Path file) Reads Kubernetes resources from a file at the specified path.
-
Constructor Details
-
KubeClient
public KubeClient()Initializes the Kubernetes client with configuration derived from environment variables or default context.
-
-
Method Details
-
getClient
public io.fabric8.kubernetes.client.KubernetesClient getClient()Returns the Kubernetes client.- Returns:
- The initialized Kubernetes client.
-
getOpenShiftClient
public io.fabric8.openshift.client.OpenShiftClient getOpenShiftClient()Adapts the Kubernetes client to an OpenShift client.- Returns:
- An instance of OpenShiftClient.
-
getKubeconfigPath
Returns the path to the kubeconfig file used for authentication.- Returns:
- The kubeconfig file path.
-
readResourcesFromFile
public List<io.fabric8.kubernetes.api.model.HasMetadata> readResourcesFromFile(Path file) throws IOException Reads Kubernetes resources from a file at the specified path.- Parameters:
file- The path to the file containing Kubernetes resources.- Returns:
- A list of
HasMetadataresources defined in the file. - Throws:
IOException- If an I/O error occurs reading from the file.
-
readResourcesFromFile
public List<io.fabric8.kubernetes.api.model.HasMetadata> readResourcesFromFile(InputStream is) throws IOException Reads Kubernetes resources from an InputStream.- Parameters:
is- The InputStream containing Kubernetes resources.- Returns:
- A list of
HasMetadataresources defined in the stream. - Throws:
IOException- If an I/O error occurs.
-