This topic describes how to create a workflow by using the Container Service console or Ags CLI.

Background information

Based on Argo, the workflows developed by Alibaba Cloud provide containerized workflows for Alibaba Cloud Container Service for Kubernetes. Specifically, a workflow is implemented as a Kubernetes Custom Resource Definition (CRD). As such, you can use kubectl to manage workflows, and integrate them with other Kubernetes services, such as volumes, Secrets, and Role-Based Access Control (RBAC). At the backend, the workflow controller provides complete workflow features such as parameter substitution, artifacts, fixtures, loops, and recursive workflows.

Prerequisites

Procedure

  • Use the Container Service console to create a workflow named Hello World
    1. Log on to the Container Service console.
    2. In the left-side navigation pane under Container Service-Kubernetes, choose Applications > Workflow.
    3. In the upper-right corner, click Create by Template.
    4. Set the template parameters.
      • Clusters: Select the target cluster.
      • Namespaces: Select the target namespace. The default namespace is used.
      • Sample Template: Select a sample YAML template or customize a YAML template.
        Note Alibaba Cloud Container Service for Kubernetes offers you with the sample YAML templates of various resources.


      The following is a sample YAML template of the workflow named Hello World:
      apiVersion: argoproj.io/v1alpha1
      kind: Workflow                  # new type of k8s spec
      metadata:
        generateName: hello-world-    # name of the workflow spec
      spec:
        entrypoint: whalesay          # invoke the whalesay template
        templates:
        - name: whalesay              # name of the template
          container:
            image: docker/whalesay
            command: [cowsay]
            args: ["hello world"]
            resources:                # limit the resources
              limits:
                memory: 32Mi
                cpu: 100m
    5. Click DEPLOY.
    6. On the Workflow page, find the target workflow. Then, in the Action column, click Details to view the overview and container group information of the workflow.

  • Use the command line interface (CLI) to create a workflow named Parameters
    Note Ags CLI is a CLI tool customized by Alibaba Cloud. This tool is compatible to Argo. With Ags CLI, you can submit, check, modify, and delete workflows. For more information, see Introduction to AGS CLI.
    1. Create the file arguments-parameters.yaml, and then copy the following code to the file:
      apiVersion: argoproj.io/v1alpha1
      kind: Workflow
      metadata:
        generateName: hello-world-parameters-
      spec:
        # invoke the whalesay template with
        # "hello world" as the argument
        # to the message parameter
        entrypoint: whalesay
        arguments:
          parameters:
          - name: message
            value: hello world
      
        templates:
        - name: whalesay
          inputs:
            parameters:
            - name: message       # parameter declaration
          container:
            # run cowsay with that message input parameter as args
            image: docker/whalesay
            command: [cowsay]
            args: ["{{inputs.parameters.message}}"]
    2. Run the ags submit arguments-parameters.yaml -p message="goodbye world" command.

You can create more workflows by modifying the sample workflow templates. For more information, see Sample workflow templates.