继续研究使用Argo;
Argo基本概念
再熟悉下 Argo
的核心概念:
Workflow
Template
,可以看作是function
,Argo
中的Template
有两类:- 定义
Template
container
,最常见的,也是Argo
的优势script
,基于container
,你可以写点什么resouce
,直接操作k8s的任何resourcesuspend
,暂停一段时间,等同于Thread.wait(int time)
- 调用
Template
steps
,直接调用其他Template
DAG
,以DAG
的方式调用其他Template
- 定义
Entrypoint
,main function
,第一个执行的Template
Artifact
,Argo
更perfer使用S3来存储artifact
Argo配置Minio
还记得Argo会默认在Argo
的namespace下安装一个全新的Minio么?现在来干掉它,复用其他已有的Minio;
kubectl delete pod/minio -n argo
kubectl delete service/minio -n argo
需要修改两个configmap
,artifact-repositories
+ workflow-controller-configmap
;同时还需要修改 my-minio-cred
s3:
bucket: my-bucket
endpoint: minio:9000
insecure: true
accessKeySecret:
name: my-minio-cred
key: accesskey
secretKeySecret:
name: my-minio-cred
key: secretkey
kubectl edit
并kubectl apply
后,跑个DAG
,看看是否能成功连接Minio
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: artifact-passing-
spec:
entrypoint: artifact-example
templates:
- name: artifact-example
steps:
- - name: generate-artifact
template: whalesay
- - name: consume-artifact
template: print-message
arguments:
artifacts:
# bind message to the hello-art artifact
# generated by the generate-artifact step
- name: message
from: "{{steps.generate-artifact.outputs.artifacts.hello-art}}"
- name: whalesay
container:
image: docker/whalesay:latest
command: [sh, -c]
args: ["cowsay hello world | tee /tmp/hello_world.txt"]
outputs:
artifacts:
# generate hello-art artifact from /tmp/hello_world.txt
# artifacts can be directories as well as files
- name: hello-art
path: /tmp/hello_world.txt
- name: print-message
inputs:
artifacts:
# unpack the message input artifact
# and put it at /tmp/message
- name: message
path: /tmp/message
container:
image: alpine:latest
command: [sh, -c]
args: ["cat /tmp/message"]
Argo submit
后
同时,登陆Minio
看一眼,artifact
是否upload成功
Okey,没问题!