Argo Workflow resouce template创建K8S job资源类型示例
k8s 创建 示例 job Template workflow Argo
2023-09-14 09:01:49 时间
# This example demonstrates the 'resource' template type, which provides a
# convenient way to create/update/delete any type of kubernetes resources
# in a workflow. The resource template type accepts any k8s manifest
# (including CRDs) and can perform any kubectl action against it (e.g. create,
# apply, delete, patch).
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: k8s-jobs-
spec:
entrypoint: pi-tmpl
templates:
- name: pi-tmpl
resource:
action: create
# successCondition and failureCondition are optional expressions which are
# evaluated upon every update of the resource. If failureCondition is ever
# evaluated to true, the step is considered failed. Likewise, if successCondition
# is ever evaluated to true the step is considered successful. It uses kubernetes
# label selection syntax and can be applied against any field of the resource
# (not just labels). Multiple AND conditions can be represented by comma
# delimited expressions. For more details, see:
# https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
#如果是创建其他资源类型,比如configmap,可以将这两行给注释
successCondition: status.succeeded > 0
failureCondition: status.failed > 3
manifest: |
apiVersion: batch/v1
kind: Job
metadata:
generateName: pi-job-
spec:
template:
metadata:
name: pi
spec:
containers:
- name: pi
image: perl
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never
backoffLimit: 4
# Resource templates can have output parameters extracted from fields of the
# resource. Two techniques are provided: jsonpath and a jq filter.
#看需要,下面的也可以注释
outputs:
parameters:
# job-name is extracted using a jsonPath expression and is equivalent to:
# `kubectl get job <jobname> -o jsonpath='{.metadata.name}'`
- name: job-name
valueFrom:
jsonPath: '{.metadata.name}'
# job-obj is extracted using a jq filter and is equivalent to:
# `kubectl get job <jobname> -o json | jq -c '.'
# which returns the entire job object in json format
- name: job-obj
valueFrom:
jqFilter: '.'
https://github.com/argoproj/argo-workflows/blob/master/examples/k8s-jobs.yaml
相关文章
- k8s系列(1)-腾讯云CVM手动部署K8S_Dashboard安装2
- k8s集群pod出现Evicted状态
- k8s 基于角色的权限控制 RBAC
- k8s安装zuul
- k8s系列(1)-腾讯云CVM手动部署K8S_Dashboard安装1
- k8s离线安装进阶版
- k8s创建pv&pvc
- 使用 kube-scheduler-simulator 模拟 K8s 调度器环境
- k8s系列(2)-Service
- K8s基本概念入门_k8s菜鸟教程
- K8s VS Docker
- K8s降本增效之成本优化篇
- 【K8S 系列】k8s 学习一,Kubernetes 基本介绍及核心组件
- 【K8S 系列】k8s 学习二,kubernetes 核心概念及初步了解安装部署方式
- K8S 暴露服务的新方法 Gateway API 详解,它有什么优势?
- [云原生]从架构看懂K8S
- 这40套文档技能点过于密集,堪称K8s、Docker的命脉,正在刷第2遍 | 极客时间
- K8s应用为中心的封装Operator与OAM
- k8s 中发现很多为状态为 Evicted 的 Pod
- k8s集群监控(十一)
- 使用K8s部署Oracle,裁剪应用复杂性(k8s 部署oracle)
- K8S上简易部署Oracle数据库(k8s上部署oracle)
- K8S和Oracle 打造高效的DevOps领域体验(k8s oracle)