Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add argo workflow example for jobset #612

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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