Skip to main content

GetServiceAccountNameFromTaskExecutionMetadata

Retrieves the service account name from the provided task execution metadata. It first attempts to get the service account from the security context's RunAs field, and if not found, falls back to the deprecated K8sServiceAccount field directly on the metadata.

def GetServiceAccountNameFromTaskExecutionMetadata(
taskExecutionMetadata: pluginmachinery_core.TaskExecutionMetadata
) - > string

Retrieves the service account name from the provided task execution metadata. This function first attempts to get the service account from the security context's run-as configuration, and if not found, falls back to a deprecated method of directly getting it from the task execution metadata.

Parameters

NameTypeDescription
taskExecutionMetadatapluginmachinery_core.TaskExecutionMetadataThe metadata object containing information about the task execution, including security context details.

Returns

TypeDescription
stringThe Kubernetes service account name associated with the task execution.