Class EphemeralAgentKubernetesExecutionService
java.lang.Object
com.atlassian.bamboo.agent.ephemeral.EphemeralAgentKubernetesExecutionService
- All Implemented Interfaces:
EphemeralAgentExecutionService
public class EphemeralAgentKubernetesExecutionService
extends Object
implements EphemeralAgentExecutionService
-
Field Summary
Modifier and TypeFieldDescriptionprotected CustomVariableContext
static final long
static final long
static final long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes pods with completed Agent execution.@NotNull DeleteAgentPodsResult
Deletes all ephemeral agent pods in any pod state.@NotNull DeleteAgentPodResult
Delete the pod with the requested name from the cluster if the one exists.@NotNull String
describePod
(@NotNull String podName) Describe pod details in human-readable way.protected KubernetesExecutor
Gets names of pods with running agent container.@NotNull Optional<EphemeralAgentPod>
Get pod detailsgetPodContainerLogs
(@NotNull String podName, @NotNull Optional<String> containerName, @NotNull Optional<Integer> resultsLimit, @NotNull Optional<String> afterTimestamp) Gets either the whole pod or the particular pod container's logs.@NotNull List<EphemeralAgentPod>
getPods()
Get all pods.@NotNull LaunchAgentPodResult
launch
(@NotNull EphemeralAgentTemplate ephemeralAgentTemplate, @NotNull CommonContext context) Launch ephemeral agent based on delivered template and cotext.protected @NotNull String
randomizeName
(@NotNull String rawName)
-
Field Details
-
KUBERNETES_EXECUTOR_COMMAND_EXECUTION_TIMEOUT_VAL
public static final long KUBERNETES_EXECUTOR_COMMAND_EXECUTION_TIMEOUT_VAL -
KUBERNETES_EXECUTOR_COMMAND_IDLE_TIMEOUT_VAL
public static final long KUBERNETES_EXECUTOR_COMMAND_IDLE_TIMEOUT_VAL -
customVariableContext
-
MAX_EPHEMERAL_AGENTS_LAUNCH_RETRIES_NUMBER_VAL
public static final long MAX_EPHEMERAL_AGENTS_LAUNCH_RETRIES_NUMBER_VAL
-
-
Constructor Details
-
EphemeralAgentKubernetesExecutionService
public EphemeralAgentKubernetesExecutionService()
-
-
Method Details
-
getKubernetesExecutor
-
launch
@NotNull public @NotNull LaunchAgentPodResult launch(@NotNull @NotNull EphemeralAgentTemplate ephemeralAgentTemplate, @NotNull @NotNull CommonContext context) Description copied from interface:EphemeralAgentExecutionService
Launch ephemeral agent based on delivered template and cotext.- Specified by:
launch
in interfaceEphemeralAgentExecutionService
- Parameters:
ephemeralAgentTemplate
- ephemeral configuration's templatecontext
- buildable context- Returns:
- result of agent launch
-
getPods
Description copied from interface:EphemeralAgentExecutionService
Get all pods.- Specified by:
getPods
in interfaceEphemeralAgentExecutionService
- Returns:
- list of ephemeral agent pod instances
-
getPod
Description copied from interface:EphemeralAgentExecutionService
Get pod details- Specified by:
getPod
in interfaceEphemeralAgentExecutionService
- Parameters:
podName
- pod name
-
describePod
@NotNull public @NotNull String describePod(@NotNull @NotNull String podName) throws KubernetesExecutorException Description copied from interface:EphemeralAgentExecutionService
Describe pod details in human-readable way.- Specified by:
describePod
in interfaceEphemeralAgentExecutionService
- Parameters:
podName
- pod name- Throws:
KubernetesExecutorException
-
deletePod
@NotNull public @NotNull DeleteAgentPodResult deletePod(@NotNull @NotNull String ephemeralAgentPodName) Description copied from interface:EphemeralAgentExecutionService
Delete the pod with the requested name from the cluster if the one exists.- Specified by:
deletePod
in interfaceEphemeralAgentExecutionService
- Parameters:
ephemeralAgentPodName
- unique across cluster pod name- Returns:
- result of agent pod removal
-
clearNonActivePods
public void clearNonActivePods()Description copied from interface:EphemeralAgentExecutionService
Removes pods with completed Agent execution.- Specified by:
clearNonActivePods
in interfaceEphemeralAgentExecutionService
-
getPodContainerLogs
@NotNull public @NotNull io.atlassian.fugue.Either<String,List<String>> getPodContainerLogs(@NotNull @NotNull String podName, @NotNull @NotNull Optional<String> containerName, @NotNull @NotNull Optional<Integer> resultsLimit, @NotNull @NotNull Optional<String> afterTimestamp) Description copied from interface:EphemeralAgentExecutionService
Gets either the whole pod or the particular pod container's logs. If the afterTimestamp is used, there must exist a log entry with this particular time stamp. Otherwise, an empty list will be returned.- Specified by:
getPodContainerLogs
in interfaceEphemeralAgentExecutionService
- Parameters:
podName
- ephemeral configuration's templatecontainerName
- optional name of the container, if empty the logs from the whole pod are requestedresultsLimit
- limit of logs lines, if empty all logs are fetchedafterTimestamp
- only log entries created after this timestamp will be taken- Returns:
- either error message if failed or list of log lines if successful
-
deleteAllPods
Description copied from interface:EphemeralAgentExecutionService
Deletes all ephemeral agent pods in any pod state.- Specified by:
deleteAllPods
in interfaceEphemeralAgentExecutionService
- Returns:
- result of pods removal
-
getNamesOfPodsWithRunningAgent
Description copied from interface:EphemeralAgentExecutionService
Gets names of pods with running agent container.- Specified by:
getNamesOfPodsWithRunningAgent
in interfaceEphemeralAgentExecutionService
- Returns:
- list of pod names if ephemeral agents are enabled, empty list otherwise
-
randomizeName
-