Skip to content

Overview

The Job Manager component represents the core module of the ICOS Controller runtime. This module is responsible for the runtime management and provides control, persistence and the coordination between ICOS components. Such a component enables the continuum to be consistent within real time, furthermore becoming the centre of the truth in the mentioned continuum.

For ICOS to become trustable at runtime, and consistently manage ICOS execution in such a diverse continuum, Job Manager provides the notion of a Job. The Job Manager provides job lifecycle management operations (CRUD) that enable consistent and efficient execution of a job, furthermore, managing both the state of the job and the state of the actual resource within the agent that owes that job.

ICOS Concepts

Jobs

A Job defines the minimal executable unit to be managed by ICOS Controller at runtime. For this unit to become executable by the different ICOS Agents, more importantly, without considering their underlying runtime technology.

Job Groups

When an application is composed of multiple components it becomes a set of jobs, in other words, a job group. Job group holds all the information regarding the application, including all the components(jobs) that compose the application, the relationship between the different jobs (application topology) and other information such as requirements and policies such application must meet.

Application Component Description

Describes, following ICOS syntax, the components an application is composed of, as well as their requirements to be met and policies to be enforced. Currently, the Application Descriptor may vary from version to version, so it is recommended to check the Application Descriptor Repository.

Target

Defines the underlying infrastructure able to execute a single job, taking into consideration the mentioned requirements and the capacity the infrastructure piece provides, since appropriate quality of service must be enforced. This target is selected by the Matchmaker (described in the next section) for each job that comprises an application.

Resource

Abstract representation of the actual application component executed within a single target. This representation is retrieved from the orchestrator at runtime during the execution of the corresponding job.

ICOS Agent

The actual underlying orchestrator that manages the infrastructure where the job is executed. From a Job Manager’s perspective, whenever an agent takes a job for execution, it becomes the owner of such a job, meaning that only the mentioned agent can manage this job’s life cycle.

Swagger Job Manager API

ICOS Job Manager Microservice.

Terms of service

http://swagger.io/terms/

Contact information:
API Support
http://www.swagger.io/support
support@swagger.io

License: Apache 2.0

OpenAPI

Security

Bearer

apiKey API Key
Description "Type 'Bearer TOKEN' to correctly set the API Key"
Name Authorization
In header

/jobmanager/groups

GET

Summary

Get All JobGroups

Description

get all jobgroups

Responses
Code Description Schema
200 OK [ [ models.JobGroup ] ]
400 Bad Request string
404 Not Found string

PUT

Summary

update a JobGroup

Description

update a jobgroup

Parameters
Name Located in Description Required Schema
JobGroup body JobGroup information Yes models.JobGroup
Responses
Code Description Schema
200 OK models.JobGroup
400 Bad Request string
404 Not Found string

POST

Summary

create new JobGroup

Description

create new jobgroup

Parameters
Name Located in Description Required Schema
application body Application manifest YAML Yes string
Responses
Code Description Schema
201 Created models.JobGroup
422 Unprocessable Entity string

/jobmanager/groups/start/{group_uuid}

PUT

Summary

Start JobGroup by UUID

Description

Start jobgroup by uuid

Parameters
Name Located in Description Required Schema
group_uuid path JobGroup UUID Yes string
Responses
Code Description Schema
200 OK models.JobGroup
400 Bad Request string
404 Not Found string

/jobmanager/groups/stop/{group_uuid}

PUT

Summary

Stop JobGroup by UUID

Description

stop jobgroup by uuid

Parameters
Name Located in Description Required Schema
group_uuid path JobGroup UUID Yes string
Responses
Code Description Schema
200 OK models.JobGroup
400 Bad Request string
404 Not Found string

/jobmanager/groups/{group_uuid}

GET

Summary

Get JobGroup by UUID

Description

get jobgroup by uuid

Parameters
Name Located in Description Required Schema
group_uuid path JobGroup UUID Yes string
Responses
Code Description Schema
200 OK models.JobGroup
400 Bad Request string
404 Not Found string

DELETE

Summary

delete job group by UUID

Description

delete job group by uuid

Parameters
Name Located in Description Required Schema
group_uuid path JobGroup UUID Yes string
Responses
Code Description Schema
200 OK string
400 Bad Request string
404 Not Found string

/jobmanager/jobs

GET

Summary

List all Jobs

Description

get all jobs

Responses
Code Description Schema
200 OK [ [ models.Job ] ]
404 Can not find Jobs string

PUT

Summary

Update a Job

Description

update a job

Parameters
Name Located in Description Required Schema
job_uuid path Job UUID Yes string
Job body Job information Yes models.Job
Responses
Code Description Schema
200 OK models.Job
400 Error reading request body string
404 Could not find job string

/jobmanager/jobs/executable/{orchestrator}

GET

Summary

List Jobs to Execute

Description

Get jobs to execute

Parameters
Name Located in Description Required Schema
orchestrator path Orchestrator type [ocm | nuvla] Yes string
icos_agent_id query ICOS Agent ID No string
Responses
Code Description Schema
200 OK [ models.Job ]
400 Orchestrator type is required string
404 Cannot find executable Jobs string
500 Internal server error string

/jobmanager/jobs/promote/{job_uuid}

PATCH

Summary

Promote Job by UUID

Description

promote job by uuid

Parameters
Name Located in Description Required Schema
job_uuid path Job UUID Yes string
Responses
Code Description Schema
204 Job Promoted string
400 Job UUID is required string
404 Can not find Job to promote string

/jobmanager/jobs/{job_uuid}

GET

Summary

Get Job by UUID

Description

get job by uuid

Parameters
Name Located in Description Required Schema
job_uuid path Job UUID Yes string
Responses
Code Description Schema
200 Ok models.Job
400 Job UUID is required string
404 Can not find Job by UUID string

DELETE

Summary

Delete Job by UUID

Description

delete job by uuid

Parameters
Name Located in Description Required Schema
job_uuid path Job UUID Yes string
Responses
Code Description Schema
200 Ok string
400 Job UUID is required string
404 Can not find Job to delete string

/jobmanager/policies/incompliance

POST

Summary

Triger a new remediation

Description

Triger a new remediation.

Parameters
Name Located in Description Required Schema
application body Remediation Object Yes string
Responses
Code Description Schema
200 OK models.Remediation
400 Remediation Object is not correct string
422 Unprocessable Entity string

/jobmanager/resources/status

PUT

Summary

Update resource status by UUID

Description

update resource status by uuid

Parameters
Name Located in Description Required Schema
id path Resource UUID Yes string
resource body Resource info Yes models.Resource
Responses
Code Description Schema
200 Resource updated string
400 Resource UUID is required string
404 Can not find Resource to update string

/jobmanager/resources/status/{job_uuid}

GET

Summary

Get resource status by job UUID

Description

get resource status by job uuid

Parameters
Name Located in Description Required Schema
job_uuid path Job UUID Yes string
Responses
Code Description Schema
200 OK models.Resource
400 Job UUID is required string
404 Can not find Job by UUID string

Models

models.Condition

Name Type Description Required
lastTransitionTime string Yes
message string Yes
observedGeneration integer No
reason string Yes
status models.ConditionStatus Yes
type models.ResourceState Yes

models.ConditionStatus

Name Type Description Required
models.ConditionStatus string

models.Content

Name Type Description Required
name string Yes
yaml string Yes

models.Instruction

Name Type Description Required
componentName string No
contents [ models.Content ] No
id string No
job_id string Excluded from YAML No
policies [ models.Policy ] No
requirements models.Requirement No
type string No

models.Job

Name Type Description Required
id string No
instruction models.Instruction No
job_group_id string No
namespace string No
orchestrator models.OrchestratorType No
owner_id string No
resource models.Resource No
state models.JobState No
sub_type models.RemediationType No
targets models.Target No
type models.JobType No

models.JobGroup

Name Type Description Required
appDescription string No
appName string No
id string No
jobs [ models.Job ] Yes

models.JobState

Name Type Description Required
models.JobState string

models.JobType

Name Type Description Required
models.JobType string

models.OrchestratorType

Name Type Description Required
models.OrchestratorType string

models.Policy

Name Type Description Required
component string No
fromTemplate string No
name string No
remediation string No
spec models.PolicySpec No
variables models.PolicyVariables No

models.PolicySpec

Name Type Description Required
expr string No
thresholds models.Thresholds No

models.PolicyVariables

Name Type Description Required
compssTask string No
thresholdTimeSeconds integer No

models.Remediation

Name Type Description Required
id string No
remediationStatus models.RemediationStatus Yes
remediationTarget models.RemediationTarget No
remediationType models.RemediationType Yes
resource_id string No

models.RemediationStatus

Name Type Description Required
models.RemediationStatus string

models.RemediationTarget

Name Type Description Required
command string No
container string No
id string No
namespace string No
node string No
pod string No
pod_uid string No
remediation_id string No

models.RemediationType

Name Type Description Required
models.RemediationType string

models.Requirement

Name Type Description Required
architecture string No
cpu string No
devices string No
memory string No

models.Resource

Name Type Description Required
conditions [ models.Condition ] OriginalResourceName string gorm:"type:text" json:"-" validate:"omitempty" No
job_id string No
remediations [ models.Remediation ] No
resource_name string No
resource_uuid string we set this field manually No

models.ResourceState

Name Type Description Required
models.ResourceState string

models.Target

Name Type Description Required
cluster_name string Yes
node_name string No
orchestrator models.OrchestratorType Yes

models.Thresholds

Name Type Description Required
critical integer No
warning integer No

Docker Installation

To install and run the job-manager, follow these steps:

  1. Clone the repository:

    git clone https://production.eng.it/gitlab/icos/meta-kernel/job-manager.git
    

  2. Navigate to the project directory:

    cd job-manager
    

  3. Build the Docker image:

    docker build -t job-manager .
    

  4. Run the Docker container:

    docker run -p 8082:8082 job-manager
    

Kind Installation

Please, refer to the helm suite in ICOS Controller Repository

Usage

After running the service, you can use tools like curl, Postman, Swagger or any other API client to interact with the endpoints. Beware that you will need a Keycloak Token to perform requests to this service.

Example Request

curl --location 'http://localhost:8082/jobmanager/jobs' \
--header 'Authorization: Bearer (Token)'