Class KubernetesNodeContext
java.lang.Object
org.csanchez.jenkins.plugins.kubernetes.pipeline.KubernetesNodeContext
- All Implemented Interfaces:
Serializable
helper class for steps running in a kubernetes `node` context
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKubernetesNodeContext(org.jenkinsci.plugins.workflow.steps.StepContext context) Create new Kubernetes context -
Method Summary
Modifier and TypeMethodDescriptionfinal KubernetesSlaveGetNodefrom theStepContext.Kubernetes namespace Pod is running in.Kubernetes Pod name.io.fabric8.kubernetes.client.dsl.PodResourceGet nodePodResource.
-
Constructor Details
-
KubernetesNodeContext
public KubernetesNodeContext(@NonNull org.jenkinsci.plugins.workflow.steps.StepContext context) throws Exception Create new Kubernetes context- Parameters:
context- step context, not null- Throws:
Exception- ifNodecontext not instance ofKubernetesSlaveor interrupted.
-
-
Method Details
-
getPodName
Kubernetes Pod name.- Returns:
- pod name, never
null
-
getNamespace
Kubernetes namespace Pod is running in.- Returns:
- kubernetes namespace or
null
-
getPodResource
@NonNull public io.fabric8.kubernetes.client.dsl.PodResource getPodResource() throws IOException, InterruptedException, org.jenkinsci.plugins.kubernetes.auth.KubernetesAuthExceptionGet nodePodResource.- Returns:
- client pod resource, never
null - Throws:
IOException- if IO exceptionInterruptedException- if interruptedorg.jenkinsci.plugins.kubernetes.auth.KubernetesAuthException- if authentication failure- See Also:
-
getKubernetesSlave
GetNodefrom theStepContext. If the context instance is instance ofKubernetesSlaveit will be returned otherwise an exception is thrown.- Returns:
- kubernetes slave node context, never
null - Throws:
IOException- if IO exceptionInterruptedException- if interruptedAbortException- ifNodecontext is not instance ofKubernetesSlave
-