1 回答

TA貢獻1851條經驗 獲得超3個贊
選項1:將文件作為參數傳遞
工作流程參數通常是一小段文本或數字。但是,如果您的 yaml 文件相當小,您可以對其進行字符串編碼并將其作為參數傳遞。
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: test-
spec:
entrypoint: test
arguments:
parameters:
- name: yaml
value: "string-encoded yaml"
templates:
- name: test
container:
image: gcr.io/testproj/test:latest
command: [bash]
source: |
# In this case, the string-encoding should be BASH-compatible.
python test.py --config_file_as_string="{{inputs.parameters.message}}"
選項 2:將文件作為工件傳遞
Argo 支持多種類型的工件。對于您的用例來說,最簡單的可能是原始參數類型。
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: test-
spec:
entrypoint: test
templates:
- name: test
inputs:
artifacts:
- name: yaml
path: /path/to/config.yaml
raw:
data: |
this is
the raw file
contents
container:
image: gcr.io/testproj/test:latest
command: [bash]
source: |
python test.py --config_file_path=/path/to/config.yaml
此外raw,Argo 支持“S3、Artifactory、HTTP 和 [和] Git”工件(我認為還有其他)。
例如,如果您選擇使用 S3,您可以從您的 golang 應用程序上傳文件,然后將 S3 存儲桶和密鑰作為參數傳遞。
Golang 客戶端
我對 golang 客戶端不熟悉,但是傳遞參數肯定是支持的,我認為傳入原始參數也應該支持。
- 1 回答
- 0 關注
- 159 瀏覽
添加回答
舉報