Updated on 2023-12-13 GMT+08:00

CCI.Job

Element Description

The CCI.Job element is used to create a job.

Element Properties

Table 1 Property Description

Property

Required

Descripiton

k8sManifest

Yes

Native manifest of the job object of the Kubernetes

Type: dict

Value Description: Supports customization. You are advised to use a public image (which is uploaded to the image repository and whose type is set to public), and not to change the name and labels under the metadata during an update.

Value Constraint: This field cannot be empty.

Suggestion: Customize the value. For details, visit https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/.

namespace

Yes

Namespace in a cluster where a job is located

Type: HuaweiCloud.CCI.Namespace.Name

Value Description: Supports customization.

Value Constraint: The value must start with a letter. Only lowercase letters, digits, and hyphens (-) are allowed. The length of namespace can't be over 63.

Suggestion: Log in to the CCI console. In the navigation pane on the left, choose Namespaces. View and select the target namespace.

Relationships Between Elements

Table 2 Relationship description

Description

Target

DependsOn

RDS.MySQL

DependsOn

CCI.Secret

DependsOn

CCI.Job

DependsOn

CCI.StatefulSet

DependsOn

CCI.Storage.EVS

DependsOn

DCS.Redis

DependsOn

CCI.Service

DependsOn

CCI.Deployment

DependsOn

CCI.Storage.SFS

DependsOn

CCI.ConfigMap

DependsOn

RDS.PostgreSQL

DependsOn

CCI.Ingress

DependsOn

AOS.Batch

DependsOn

OBS.Bucket

ContainedIn

CCI.Namespace

Return Value

Property

Type

Description

refID

string

ID of CCI job

refName

string

Name of CCI Job

Blueprint Example

tosca_definitions_version: huaweicloud_tosca_version_1_0
inputs:
  cci_namespace:
    default: cci-ns
    description: Namespace where the job locates
  command:
    default: sleep 10;
    description: Command for using the image to execute the job
    type: string
  containername:
    default: cci-job-123
    description: Name of the container to be started when the job is executed using the image
    type: string
  cpu:
    default: 500m
    description: Number of CPU cores required for using the image to execute the job
    type: string
  image:
    default: 'redis:latest'
    description: 'Name and tag of the image used by the job'
    type: string
  jobname:
    default: cci-job
    description: 'Job name'
    type: string
  memory:
    default: 1Gi
    description: Memory amount required for using the image to execute the job
    type: string
node_templates:
  my-job:
    properties:
      k8sManifest:
        apiVersion: 'batch/v1'
        kind: Job
        metadata:
          name:
            get_input: jobname
        spec:
          template:
            metadata:
              name:
                get_input: jobname
            spec:
              containers:
                - command:
                    - sh
                    - '-c'
                    - get_input: command
                  image:
                    get_input: image
                  name:
                    get_input: containername
                  resources:
                    limits:
                      cpu:
                        get_input: cpu
                      memory:
                        get_input: memory
                    requests:
                      cpu:
                        get_input: cpu
                      memory:
                        get_input: memory
              imagePullPolicy: IfNotPresent
              restartPolicy: OnFailure
      namespace:
        get_input: cci_namespace
    type: HuaweiCloud.CCI.Job