Skip to content

Commit 3de3fa7

Browse files
authored
Improve documentation of samples (#303)
* Improve samples + Add README to highlight podSet inference + Add LeaderWorkerSet example * fix formatting * editing pass
1 parent 640b4c0 commit 3de3fa7

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

Diff for: samples/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 one or more instances of
6+
any Kubernetes Kind that uses `PodSpecTemplate` to define its Pods.
7+
An AppWrapper must contain at least one such Pod-creating resource in addition
8+
to zero or more non-Pod-creating resources.
9+
10+
An AppWrapper contains a`components` array containing the wrapped resources.
11+
Each component has two main pieces: a `template` that defines the wrapped resource
12+
and a `podSets` array that gives the `replicas` and `path` within the template
13+
for each `PodSpecTemplate`. For correct operation of the AppWrapper, it is
14+
required that the provided `path` and `replicas` information correctly represent
15+
the Pod creating behavior of the wrapped resource. For resources that do not
16+
created Pods (eg `Services` or `Secrets`) `podSets` should be empty and thus omitted.
17+
18+
To simplify the user experience, for a selection of commonly-used Kubernetes
19+
resource Kinds, the AppWrapper controller can automatically infer the `podSets`
20+
array if it is not provided. For these same Kinds, the AppWrapper controller
21+
will validate that any explicitly provided `podSet` entries do in fact match the
22+
definitions in `template`.
23+
The current set of automatically inferred Kinds is:
24+
+ v1 Pod
25+
+ apps/v1 Deployment
26+
+ apps/v1 StatefulSet
27+
+ batch/v1 Job
28+
+ kubeflow.org/v1 PyTorchJob
29+
+ ray.io/v1 RayCluster
30+
+ ray.io/v1 RayJob
31+
32+
In all of the examples, if `podSets` inference is supported for the wrapped Kind,
33+
then `podSets` is omitted from the sample yaml.

Diff for: samples/wrapped-leader-worker-set.yaml

+44
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)