无法将 argo workflow cron 安装为 helm chart

Unable to install argo workflow cron as a helm chart

我想安装一个 argo 工作流模板和工作流 cron 作业作为 helm chart。 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 工作流控制器实例管理的 CronWorkflows,请使用 --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