Skip to content

Commit

Permalink
Merge pull request #612 from googs1025/add_argo_workflow_example
Browse files Browse the repository at this point in the history
docs: add argo workflow example for jobset
  • Loading branch information
k8s-ci-robot authored Jul 2, 2024
2 parents 200a3a9 + 220e997 commit fb65e01
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 0 deletions.
88 changes: 88 additions & 0 deletions examples/argo-workflow/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: argo-jobset
namespace: argo
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: argo-jobset-role
namespace: argo
rules:
- apiGroups:
- batch
resources:
- jobs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- batch
resources:
- jobs/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
- pods
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- jobset.x-k8s.io
resources:
- jobsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- jobset.x-k8s.io
resources:
- jobsets/finalizers
verbs:
- update
- apiGroups:
- jobset.x-k8s.io
resources:
- jobsets/status
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: argo-jobset-binding
namespace: argo
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: argo-jobset-role
subjects:
- kind: ServiceAccount
name: argo-jobset
namespace: argo
61 changes: 61 additions & 0 deletions examples/argo-workflow/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
namespace: argo
generateName: argo-workflow-jobset-
spec:
serviceAccountName: argo-jobset
entrypoint: jobset-example
templates:
- name: jobset-example
resource: # indicates that this is a resource template
# can be any kubectl action (e.g. create, delete, apply, patch)
action: create
# The successCondition and failureCondition are optional expressions.
# If failureCondition is true, the step is considered failed.
# If successCondition is true, the step is considered successful.
# They use 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: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
successCondition: status.terminalState == Completed
failureCondition: status.terminalState == Failed
# put your kubernetes spec here
manifest: |
apiVersion: jobset.x-k8s.io/v1alpha2
kind: JobSet
metadata:
name: paralleljobs
namespace: argo
spec:
replicatedJobs:
- name: workers
template:
spec:
parallelism: 4
completions: 4
backoffLimit: 0
template:
spec:
containers:
- name: sleep
image: busybox
command:
- sleep
args:
- 100s
- name: driver
template:
spec:
parallelism: 1
completions: 1
backoffLimit: 0
template:
spec:
containers:
- name: sleep
image: busybox
command:
- sleep
args:
- 100s

0 comments on commit fb65e01

Please sign in to comment.