无法将 argo 工作流 cron 安装为舵图

问题描述

我想安装一个 argo 工作流模板和工作流 cron 作业作为舵图。 helm install 命令表示图表已安装。但我看到只有工作流模板被部署,而 cron 作业没有。

文件夹结构:

Argo_helm
 |- templates
     |-azure-migration-cron-etl.yaml
     |-azure-migration-etl-template.yaml
 |-Chart.yaml
 |-values.yaml

执行helm install命令时,看到如下

 helm upgrade --install argo-helm-charts --values values.yaml . 

WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /Users/e192270/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /Users/e192270/.kube/config
Release "argo-helm-charts" does not exist. Installing it now.
NAME: argo-helm-charts
LAST DEPLOYED: Mon Feb  8 11:28:01 2021
NAMESPACE: argo
STATUS: deployed
REVISION: 1
TEST SUITE: None

当我列出模板时,我可以看到它

$ argo template list   
                                                                                                               
NAME
test-azure-migration

但是无法看到安装的 cron 作为图表的一部分

argo cron list -n argo 
NAME              AGE   LAST RUN   NEXT RUN   SCHEDULE      SUSPENDED

================================================ ============================

cron 代码 (azure-migration-cron-etl.yaml)

apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  name: {{ .Values.workflow_name }}
  namespace: {{ .Values.workflow_namespace }}
  labels:
    workflows.argoproj.io/controller-instanceid: fp
spec:
  schedule: "0 1 * * *"
  timezone: "America/Chicago"
  workflowSpec:
    entrypoint: sparkdatabricks-app
    metrics:
      prometheus:
        - name: dim_bud_etl_duration
          labels:
            - key: team
              value: foundational-projects-data-eng
          help: "Duration of dim_bud etl"
          gauge:
            value: "{{`{{workflow.duration}}`}}"
    serviceAccountName: argo-s3-service-account
    volumes:
      - name: bearer-token
        secret:
          secretName: databricks-bearer-token-ophie
    templates:
      - name: sparkdatabricks-app
        steps:
          - - name: create-databricks-cluster
              templateRef:
                name:  azure-migration-template
                template: databricks-api
              arguments:
                parameters:
                  - name: databricks-api-command
........
.......

模板代码(azure-migration-etl-template.yaml)

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: {{ .Values.workflow_template_name}}
  namespace: argo
spec:
  entrypoint: databricks-api
  serviceAccountName: fp-argo-workflow
  arguments:
    parameters:
      - name: databricks-api-command
        value: ""
  templates:
    - name: databricks-api
      inputs:
        parameters:
          - name: databricks-api-command
      container:
        image: basic-ubuntu:1.0.0
        imagePullPolicy: Always
        command: [sh,-c]
        args: [{{`"{{inputs.parameters.databricks-api-command}}"`}}]
        env:
          - name: BEARER
            valueFrom:
              secretKeyRef:
                name: databricks-bearer-token-ophie
                key: bearer
          - name: ACCOUNT
            valueFrom:
              secretKeyRef:
                name: databricks-bearer-token-ophie
                key: account
        volumeMounts:
          - name: bearer-token
            mountPath: "/secret/mountpath"
      outputs:
        parameters:
          - name: id       # can be any id depends on what databricks api call it is
            valueFrom:
              path: /tmp/info.txt

values.yaml

workflow_name: v-dim-bud-test
workflow_namespace: argo
workflow_template_name: test-azure-migration

解决方法

Argo 允许您scale vertically by adding multiple workflow controllers。每个控制器都有一个“实例 ID”。

您的 CronWorkflow 指定了 fp 工作流控制器实例。

apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  name: {{ .Values.workflow_name }}
  namespace: {{ .Values.workflow_namespace }}
  labels:
    workflows.argoproj.io/controller-instanceid: fp

要列出由 fp 工作流控制器实例管理的 CronWorkflow,请使用 --instanceid 参数:

$ argo cron list -n argo --instanceid fp
NAME             AGE   LAST RUN   NEXT RUN   SCHEDULE    SUSPENDED
v-dim-bud-test   3m    N/A        12h        0 1 * * *   false

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...