Skip to content

Commit 2940e13

Browse files
committed
Improve samples
+ Add README to highlight podSet inference + Add LeaderWorkerSet example
1 parent 640b4c0 commit 2940e13

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

samples/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Sample AppWrappers
2+
3+
This directory contains a number of example yamls showing how to wrap
4+
different Pod-creating Kubernetes resources in an AppWrapper.
5+
AppWrappers can be used to wrap any Kubernetes Kind that uses `PodSpecTemplate`
6+
to express its Pods.
7+
8+
An AppWrapper contains a `component` array of `AppWrapperComponents`.
9+
Each component has two main pieces: a `template` that defines the wrapped resource
10+
and a `podSets` array that gives the `replicas` and `path` within the template
11+
for each `PodSpecTemplate`. For correct operation of the AppWrapper, it is
12+
required that the provided `path` and `replicas` information correctly represent
13+
the Pod creating behavior of the wrapped resource.
14+
15+
To simplify the user experience, for a selection of commonly-used Kubernetes
16+
resource Kinds, the AppWrapper controller can automatically infer the `podSets`
17+
array if it is not provided. For these same kinds, the AppWrapper controller
18+
will validate that any explicitly provided `podSet` entries match the definitions in
19+
`template`. The current set of automatically inferred Kinds is:
20+
+ v1 Pod
21+
+ apps/v1 Deployment
22+
+ apps/v1 StatefulSet
23+
+ batch/v1 Job
24+
+ kubeflow.org/v1 PyTorchJob
25+
+ ray.io/v1 RayCluster
26+
+ ray.io/v1 RayJob
27+
In all the examples, if the Kind supports automatic inference the `podSets`
28+
are elided.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiVersion: workload.codeflare.dev/v1beta2
2+
kind: AppWrapper
3+
metadata:
4+
name: sample-lws
5+
labels:
6+
kueue.x-k8s.io/queue-name: default-queue
7+
spec:
8+
components:
9+
- podSets:
10+
- path: "template.spec.leaderWorkerTemplate.leaderTemplate"
11+
replicas: 2
12+
- path: "template.spec.leaderWorkerTemplate.workerTemplate"
13+
replicas: 3
14+
template:
15+
apiVersion: leaderworkerset.x-k8s.io/v1
16+
kind: LeaderWorkerSet
17+
metadata:
18+
name: nginx-leaderworkerset
19+
labels:
20+
app: nginx
21+
spec:
22+
replicas: 2
23+
leaderWorkerTemplate:
24+
leaderTemplate:
25+
spec:
26+
containers:
27+
- name: nginx-leader
28+
image: registry.k8s.io/nginx-slim:0.27
29+
resources:
30+
requests:
31+
cpu: "100m"
32+
ports:
33+
- containerPort: 80
34+
size: 3
35+
workerTemplate:
36+
spec:
37+
containers:
38+
- name: nginx-worker
39+
image: nginx:1.14.2
40+
resources:
41+
requests:
42+
cpu: "200m"
43+
ports:
44+
- containerPort: 80

0 commit comments

Comments
 (0)