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 KubernetesSlave
GetNode
from theStepContext
.Kubernetes namespace Pod is running in.Kubernetes Pod name.io.fabric8.kubernetes.client.dsl.PodResource
Get 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
- ifNode
context not instance ofKubernetesSlave
or 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
GetNode
from theStepContext
. If the context instance is instance ofKubernetesSlave
it will be returned otherwise an exception is thrown.- Returns:
- kubernetes slave node context, never
null
- Throws:
IOException
- if IO exceptionInterruptedException
- if interruptedAbortException
- ifNode
context is not instance ofKubernetesSlave
-