Skip to content

Latest commit

 

History

History
166 lines (135 loc) · 4.75 KB

File metadata and controls

166 lines (135 loc) · 4.75 KB

Getting Started with Roiergasias workflow

Workflow YAML file syntax

version: 0.1

environment: # global environment
  - <variable name>: <variable value>

task:
  - node: <node label> # node is optional and is used to match with kubernetes node having label - node.roiergasias=<node label>
    sequential:
      - <step type 1>:  # currently supported types - print, execute or environment
          - <step 1 argument 1> # can contain {{env:<variable name>}} to resolve environment variables
          - <step 1 argument 2>
          - <step 1 argument 3>
          - ...
      - <step type 2>:
          - <step 2 argument 1>
          - ...
      - ...
  - ...

NOTE:

  1. Global environment variables are available to all the tasks.
  2. If "node" is specified in one task, then it must be specified in all the tasks for split workflow to run properly.
  3. Environment variables defined as a step are available to subsequent steps and tasks, even in split node workflow where, they get added to the global environment list for subsequent splits.
  4. Label the specific kubernetes node to run tasks with "<node label>" by running the kubectl command:
kubectl label nodes <kubernetes node> node.roiergasias="<node label>" --overwrite

For details on an example, follow this README

Command line syntax

# clone to a local git directory, if not already done so
git clone https://github.com/ankursoni/kubernetes-operator-roiergasias.git

# change to the local git directory
cd kubernetes-operator-roiergasias

# set execute permissions to roiergasias cli
chmod +x cmd/linux/roiergasias cmd/osx/roiergasias


# run the roiergasias cli help
./cmd/linux/roiergasias --help
# or, for mac osx
./cmd/osx/roiergasias --help

<<output
---
Usage:
  roiergasias [OPTIONS] <command>

Application Options:
  -d, --debug  enable debug level for logs

Help Options:
  -h, --help   Show this help message

Available commands:
  run       run a workflow
  split     split a workflow yaml file
  validate  validate a workflow yaml file
  version   display version
---
output


# to get help on a specific command:
./cmd/linux/roiergasias run --help
# or, for mac osx
./cmd/osx/roiergasias run --help

<<output
---
Usage:
  roiergasias [OPTIONS] run [run-OPTIONS]

run a workflow yaml file

Application Options:
  -d, --debug     enable debug level for logs

Help Options:
  -h, --help      Show this help message

[run command options]
      -f, --file= workflow yaml file
---
output

Workflow custom resource (against CRD) syntax in Kubernetes

apiVersion: batch.ankursoni.github.io/v1
kind: Workflow
metadata:
  name: roiergasias-demo
spec:
  workflowYAML:
    name: <workflow-name>
    yaml: |
      version: 0.1
      
      environment: # global environment
        - <variable name>: <variable value>
      
      task:
        - node: <node label> # node is optional and is used to match with kubernetes node having label - node.roiergasias=<node label>
          sequential:
            - <step type 1>:  # currently supported types - print, execute or environment
                - <step 1 argument 1> # can contain {{env:<variable name>}} to resolve environment variables
                - <step 1 argument 2>
                - <step 1 argument 3>
                - ...
            - <step type 2>:
                - <step 2 argument 1>
                - ...
            - ...
        - ...

  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never
          containers:
            - name: roiergasias
              image: docker.io/ankursoni/roiergasias-operator:workflow # or your own custom docker image
              command: ["/root/roiergasias", "run", "--file=/root/<workflow-name>/<workflow-name>.yaml"]
              volumeMounts:
                # volume - 'yaml' is automatically created by the operator using a generated configMap
                - name: yaml
                  mountPath: /root/<workflow-name>

For details on an example, follow this README

Install Roiergasias operator in Kubernetes

# install the operator
helm install --repo https://github.com/ankursoni/kubernetes-operator-roiergasias/raw/main/operator/helm/ \
  --version v0.1.2 \
  roiergasias-operator roiergasias-operator

# uninstall the operator
helm uninstall roiergasias-operator

Repository map

┬ 
├── ...
│   📌 --------------------> you are here
├── cmd    ----------------> contains go main starting point for roiergasias workflow cli
│   ├── linux   -----------> contains linux amd64 executable for roiergasias workflow cli
│   └── osx   -------------> contains mac-osx amd64 executable for roiergasias workflow cli
├── ...