/
Google Kubernetes Engine Jobs

Google Kubernetes Engine Jobs

Disclaimer

Your use of this download is governed by Stonebranch’s Terms of Use.

Version Information

Template Name

Extension Name

Version

Status

Google Kubernetes Engine Jobs

ue-gke-jobs

1 (Current 1.0.0)

Fixes and new Features are introduced.

Refer to Changelog for version history information. 

Overview

Google Kubernetes Engine (GKE) is a service for deploying, managing, and scaling Kubernetes containers on Google Cloud. Among other capabilities, GKE supports Jobs, which are used for executing tasks that run to completion, such as batch jobs or one-time processing tasks. To deploy a Job, a Kubernetes Job resource definition is used. This file is typically defined inside of a YAML or JSON file and specifies the task details, container image, and execution configuration. Once applied to a GKE cluster, the Job runs to completion and terminates automatically.

This integration provides the capability to deploy a GKE Job on a specified cluster or delete a Job from a namespace.

Key Features

Feature

Description

Deploy Job

Deploy and Monitor a GKE job on the specified cluster by providing the required Job Resource Definition:

  • Job can be provided as a UAC Script, a local file, or an HTTP link.
  • STDOUT and EXTENSION Output can be tuned to provide useful information for the execution of the Job.
  • The executed Job can be deleted automatically.
  • Dynamic commands "Retrieve Container Logs" and "Delete Current Job" can be used on invoked Task Instances.

Delete Job

Delete a GKE job from the specified namespace.

Requirements

This integration requires a Universal Agent and a Python runtime to execute the Universal Task.

Area

Details

Python Version

Requires Python 3.11, tested with Python 3.11.8.

Universal Agent Compatibility

  • Compatible with Universal Agent for Windows x64 and version >= 7.6.0.0.

  • Compatible with Universal Agent for Linux and version >= 7.6.0.0.

Universal Controller Compatibility

Universal Controller Version >= 7.6.0.0.

Network and Connectivity

Network Connectivity towards Google Cloud Authentication Endpoints and Google Kubernetes Engine is required.

Google Kubernetes Engine

Tested with GKE 1.30.9-gke.1009000. It should be compatible with later versions as long as backwards compatibility is guaranteed on the API level.

Supported Actions

Action: Deploy Job

This action allows you to deploy a Job on GKE. You must specify the Authentication, Job Resource Definition via one of the available options, and the cluster on which to deploy the Job. There are several other configuration options, such as choosing whether the Universal Task will wait for the GKE Job to complete, specifying the polling interval for completion, and choosing whether logs from the created containers will be retrieved. STDOUT logs can be used for human inspection and EXTENSION output can be used for later machine processing (like providing details to subsequent tasks in the workflow).

Configuration examples

Deploy a Job stored as a UAC script, use a Service Account Key, and wait for Job completion

Deploy a Job to a specific GKE cluster, authenticating with a Service Account Key File, with the Job Resource Definition provided as a UAC script. The Job's execution is monitored until completion for up to 1500 seconds. The Job will be deleted from the designated namespace upon completion so long as its execution is successful. Once the Job completes, the container logs and any information related to the pods tied to the Job will be printed on STDOUT. The EXTENSION Output includes detailed information about the Job specification and the containers created to complete it.

Deploy a Job defined on an external HTTP Link, using Application Default Credentials and Impersonation

Deploy a Job to a specific GKE cluster, using Application Default Credentials, then impersonate the specified Service Account. The Job Resource Definition is retrieved from the provided URL, using the environment variable set for authentication. The Job's execution is monitored until completion for up to 1800 seconds, with any information related to the pods tied to the Job printed on STDOUT. Once the job completes, the container logs are retrieved and printed on STDOUT. The job will be deleted from the designated namespace upon completion, regardless of its execution status. No additional information is included in the EXTENSION Output.

Deploy a Job defined on a local file

Deploy a Job to a specific GKE cluster, using Application Default Credentials for authentication. The Job Resource Definition is retrieved from the local filesystem. The Job's execution is monitored until completion for up to 1800 seconds, with any information related to the pods tied to the Job printed on STDOUT. If the Job executes successfully, it will be deleted from the designated namespace. If the Job fails, the Job will not be deleted, and container information will also be retrieved and printed on STDOUT and EXTENSION Output. The EXTENSION Output includes detailed information about the Job specification and the containers created to complete it.

Deploy a Job without waiting for completion

Deploy a Job to a specific GKE cluster, using a Service Account Key file for authentication. The Task Instance will not monitor the Job’s execution status and will exit immediately after deploying the Job. The only applicable additional output provided by the Task Instance is the Job's specification on the EXTENSION Output.

Action: Delete Job

This action allows you to delete a Job on GKE. You must specify the Authentication and the namespace to search for existing Jobs. In the Job Name dynamic choice field, a list of Jobs within the specified namespace is retrieved, alongside each Job's current status. You can then choose the Job for deletion. 

This action is provided as a fallback mechanism to allow Job Deletion. In most cases, the following options would be used.

  • Automatic: For "Deploy Job" related Task instances, the Delete Job Options field can be used to delete deployed Jobs automatically.
  • Manual: Dynamic command "Delete Current Job" can be executed for executed Task instances of type "Deploy Job".

Configuration examples

Delete a Job

Delete a specified Job from the specified namespace, after authenticating using Application Default Credentials. The Project ID and the Cluster must also be specified.

Action Output


Output Type

Description

Examples

EXTENSION

The EXTENSION Output provides the following information:

  • "exit_code", "status_description": General info regarding the Task execution. For more information, refer to the exit code table.

  • "invocation.fields": The task configuration used for this Task execution.

  • "result.job_specification": Specification of deployed job, along with the name and namespace it has been deployed on. Only applicable if Action is set to Deploy Job.

  • "result.containers": Information relating to containers, as well as container logs pertaining to execution of deployed job. Logs are returned for all generated pods, even if they have been restarted. Only applicable if Action is set to Deploy Job.

  • "result.errors": List of errors that might have occurred during execution.


Successful Job Deployment
{
	"exit_code": 0,
	"status_description": "Task executed successfully",
	"invocation": {
		"extension": "ue-gke-jobs",
		"version": "1.0.0",
		"fields": { ... }
	},
	"result": {
		"containers": [
		{
			"pod_name": "pi-json-name-wxx5r",
			"container_name": "pi",
			"container_log": "3.141592653589793",
			"exit_code": "0",
			"restart_count": "0"
		},
		{
			"pod_name": "pi-json-name-wxx5r",
			"container_name": "hello-sbaro",
			"container_log": "Hello SB Team\n",
			"exit_code": "0",
			"restart_count": "0"
		}
	],
		"job_specification": {
			"name": "pi-json-name",
			"namespace": "default",
			"active_deadline_seconds": 1800,
			"backoff_limit": 6,
			"completions": 1,
			"parallelism": 1,
			"pod_failure_policy": null,
			"pod_replacement_policy": "TerminatingOrFailed",
			"success_policy": null,
			"ttl_seconds_after_finished": 3600,
			"suspend": false
		}
	}
}
Successful Job Deletion
{
	"exit_code": 0,
	"status_description": "Task executed successfully",
	"invocation": {
		"extension": "ue-gke-jobs",
		"version": "1.0.0",
		"fields": { ... }
	},
	"result": null
}
Failed Job Deployment
{
	"exit_code": 21,
	"status_description": "DuplicateJobNameError: A job with the name (pi-json-name) already exists in the namespace (default)",
	"invocation": {
		"extension": "ue-gke-jobs",
		"version": "1.0.0",
		"fields": { ... }
	},
	"result": {
		"errors": [
			"Data Validation Error: Pleace ensure that you specify a Job Name that is unique to the default namespace"
		]
	}
}
Failed Job Deletion
{
	"exit_code": 20,
	"status_description": "Data Validation Error: The Job name you selected (pi-json-name) does not seem to exist inside of the specified namespace (default)",
	"invocation": {
		"extension": "ue-gke-jobs",
		"version": "1.0.0",
		"fields": { ... },
	"result": {
		"errors": [
			"Data Validation Error: The Job name you selected (pi-json-name) does not seem to exist inside of the specified namespace (default)"
		]
	}
}

STDOUT

The Task Instance STDOUT may include events relating to pod status, as well as container logs generated by the Job deployed. To tune STDOUT, use STDOUT Options.


Input Fields


Name

Type

Description

Version Information

Action

Choice

The action performed upon Task execution. Available options are:

  • Deploy Job (default)

  • Delete Job

Introduced in 1.0.0

Authentication Method

Choice

The way the Google Cloud account will be verified. Available options are:

  • Service Account Key

  • Application Default Credentials

Introduced in 1.0.0

Service Account Key

Credential

The UAC Credential containing the Google Cloud Service Account Key to be used for authentication. The contents of the Service Account Key should be input on the Token field of a Resolvable UAC Credential.

Only available if Authentication Method is set to Service Account Key.

Introduced in 1.0.0

Application Default Credentials

Credential

The UAC Credential containing the Google Cloud Application Default Credentials to be used for authentication. The contents of the Application Default Credentials should be input on the Token field of a Resolvable UAC Credential.

Only available if Authentication Method is set to Application Default Credentials.

Introduced in 1.0.0

Impersonate Service Account

Checkbox

Specifies whether a different Service Account should be impersonated.


Target Service Account

Text

The Service Account to impersonate. IAM roles required for creating short-lived tokens must be configured beforehand.

Only available if Impersonate Service Account is selected.

Introduced in 1.0.0

Project ID

Text

The GKE Project to deploy the specified Job on.

Only available if Authentication Method is set to Application Default Credentials.

Introduced in 1.0.0

Cluster

Dynamic Choice

The Cluster to deploy or delete the Job on.

Introduced in 1.0.0

Job Resource Definition Source

Choice

Specifies how to retrieve the definition of the Job to be deployed. The content of the file should be in YAML or JSON format and should contain only one job definition. Available options are:

  • UAC Script

  • Local File

  • HTTP Link

Only available if Action is set to Deploy Job.

Introduced in 1.0.0

Job Definition Script

Script

UAC Script containing the definition of the Job to be deployed.

Only available if Job Resource Definition Source is set to UAC Script.

Introduced in 1.0.0

Job Definition File Path

Text

Local path to Job definition file.

Only available if Job Resource Definition Source is set to Local File.

Introduced in 1.0.0

Job Definition Link

Text

HTTP link to file to use as Job definition. If authentication is required to retrieve the file, it should be part of the link provided.

Only available if Job Resource Definition Source is set to HTTP Link.

Introduced in 1.0.0

Job Name

Dynamic Choice

The name of the Job to be deleted.

Only available if Action is set to Delete Job.

Introduced in 1.0.0

Namespace

Text

The namespace in which the Job to be deleted resides.

Only available if Action is set to Delete Job.

Introduced in 1.0.0

Wait for Success or Failure

Checkbox

If selected, the Task Instance waits until the Job completes.

Only available if Action is set to Deploy Job.

Introduced in 1.0.0

Delete Job Options

Choice

Specifies the conditions under which the Deployed Job should be deleted. Available options are:

  • Do not Delete Job

  • Delete Job on Successful execution (default)

  • Delete Job regardless of execution status

Only available if Action is set to Deploy Job and Wait for Success or Failure is selected.

Introduced in 1.0.0

Timeout Seconds

Integer

The maximum number of seconds to monitor for Job completion. Set to 0 to monitor indefinitely.

Only available if Action is set to Deploy Job and Wait for Success or Failure is selected.

Introduced in 1.0.0

Retrieve Container Information Only on Failure

Checkbox

Specifies whether container information is only retrieved when the Job fails. This option does nothing if Include Container Logs or Include Container Information options are not requested as part of the Standard Output Options or Extension Output Options, respectively.

Only available if Action is set to Deploy Job and Wait for Success or Failure is selected.

Introduced in 1.0.0

Extension Output Options

Multiple Choice

Controls whether additional information is printed to Extension Output. Available options are:

  • Include Job Specification

  • Include Container Information (Only applicable if Wait for Success or Failure is selected)

Only available if Action is set to Deploy Job.

Introduced in 1.0.0

STDOUT Options

Multiple Choice

Controls whether additional information is printed to Standard Output. Available options are:

  • Include Container Logs

  • Enable Pod Monitoring

Only available if Action is set to Deploy Job and Wait for Success or Failure is selected.

Introduced in 1.0.0

Output Fields

The following output-only fields provide better visibility during the execution of Universal Task Instances. Both fields are only applicable when Action is set to Deploy Job.

Name

Type

Description

Version Information

Job Name

Text

Name of deployed Job.

Only available if Action is set to Deploy Job.

Introduced in 1.0.0

Job Namespace

Text

Namespace the Job has been deployed on.

Only available if Action is set to Deploy Job.

Introduced in 1.0.0

Dynamic Commands

Users can Interact with Task Instances through Dynamic Commands. The following Dynamic Commands are supported.

Name

Description

Version Information

Retrieve Container Logs

Retrieves all container logs associated with the executing Job that have been generated up to that point. The name of the Job to retrieve container logs for is inferred from the Job Name and Job Namespace Output Fields.

Only available if Action is set to Deploy Job.

Introduced in 1.0.0

Delete Current Job

Deletes the executed Job from the specified namespace. The name of the Job to delete, as well as the namespace it resides inside of, is inferred from the Job Name and Job Namespace Output Fields.

Only available if Action is set to Deploy Job.

Introduced in 1.0.0

Environment Variables

Environment Variables can be set from the Environment Variables Task definition table. They can be useful for authentication purposes when retrieving the Job Definition via HTTP Link.

Cancelation and Rerun

If the Task Instance is cancelled, it will stop monitoring the Job’s current status. If the deployment process has already been initiated, it will not be impacted in any way.

In the case of a Task Rerun, a new Job will be created using the same Job Definition Resource. This results in an attempt to create a Job with the same name in the same namespace. If the previously executed Job has not been deleted, either via the relevant Task field, the relevant dynamic command, or directly through GKE, the Task Instance will conclude in a Failed state, as GKE requires jobs within the same namespace to have unique names.

Exit Codes

Exit Code

Status

Status Description

0

Success

“SUCCESS: Task executed successfully.“

1

Failure

“Execution Failed: <<Error Description>>”

2

Failure

“Authentication Error: Account cannot be authenticated.“

20

Failure

“Data Validation Error: <<Error Description>>“

21

Failure

“DuplicateJobNameError: Job Naming Error.“

40

Failure

“TimeoutExceededError: Timeout Error.“

STDOUT and STDERR


By default, the integration keeps STDOUT empty unless specified otherwise through the STDOUT Options field when the Action is set to Deploy Job. You can choose to include events related to the deployed Job’s pods, which will display information about pod and container creation, execution, and deletion as they happen. Additionally, selecting Include Container Logs will cause the Task Instance to print all container logs produced during the Job execution once it completes.

STDERR provides additional information specified by the Log Level field.

Backward compatibility is not guaranteed for the content of STDOUT/STDERR and can be changed in future versions without notice

How To

Import Universal Template

To use the Universal Template, you first must perform the following steps.

  1. This Universal Task requires the Resolvable Credentials feature. Check that the Resolvable Credentials Permitted system property has been set to true.

  2. To import the Universal Template into your Controller, follow these instructions.

  3. When the files have been imported successfully, refresh the Universal Templates list; the Universal Template will appear on the list.

Modifications of this integration, applied by users or customers, before or after import, might affect the supportability of this integration. For more information refer to Integration Modifications.

Configure Universal Task

For a new Universal Task, create a new task, and enter the required input fields.

Integration Modifications

Modifications applied by users or customers, before or after import, might affect the supportability of this integration. The following modifications are discouraged to retain the support level as applied for this integration.

  • Python code modifications should not be done.

  • Template Modifications

    • General Section

      • "Name", "Extension", "Variable Prefix", and "Icon" should not be changed.

    • Universal Template Details Section

      • "Template Type", "Agent Type", "Send Extension Variables", and "Always Cancel on Force Finish" should not be changed.

    • Result Processing Defaults Section

      • Success and Failure Exit codes should not be changed.

      • Success and Failure Output processing should not be changed.

    • Fields Restriction Section
      The setup of the template does not impose any restrictions. However, concerning the "Exit Code Processing Fields" section.

      1. Success/Failure exit codes need to be respected.

      2. In principle, as STDERR and STDOUT outputs can change in follow-up releases of this integration, they should not be considered as a reliable source for determining the success or failure of a task.

Users and customers are encouraged to report defects, or feature requests at Stonebranch Support Desk.

Document References

This document references the following documents:

Document Link

Description

Universal Templates

User documentation for creating, working with and understanding Universal Templates and Integrations.

Universal Tasks

User documentation for creating Universal Tasks in the Universal Controller user interface.

Changelog

ue-gke-jobs-1.0.0 (2025-03-17)

Initial Version


Related content