-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve documentation of samples (#303)
* Improve samples + Add README to highlight podSet inference + Add LeaderWorkerSet example * fix formatting * editing pass
- Loading branch information
1 parent
640b4c0
commit 3de3fa7
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Sample AppWrappers | ||
|
||
This directory contains a number of example yamls showing how to wrap | ||
different Pod-creating Kubernetes resources in an AppWrapper. | ||
AppWrappers can be used to wrap one or more instances of | ||
any Kubernetes Kind that uses `PodSpecTemplate` to define its Pods. | ||
An AppWrapper must contain at least one such Pod-creating resource in addition | ||
to zero or more non-Pod-creating resources. | ||
|
||
An AppWrapper contains a`components` array containing the wrapped resources. | ||
Each component has two main pieces: a `template` that defines the wrapped resource | ||
and a `podSets` array that gives the `replicas` and `path` within the template | ||
for each `PodSpecTemplate`. For correct operation of the AppWrapper, it is | ||
required that the provided `path` and `replicas` information correctly represent | ||
the Pod creating behavior of the wrapped resource. For resources that do not | ||
created Pods (eg `Services` or `Secrets`) `podSets` should be empty and thus omitted. | ||
|
||
To simplify the user experience, for a selection of commonly-used Kubernetes | ||
resource Kinds, the AppWrapper controller can automatically infer the `podSets` | ||
array if it is not provided. For these same Kinds, the AppWrapper controller | ||
will validate that any explicitly provided `podSet` entries do in fact match the | ||
definitions in `template`. | ||
The current set of automatically inferred Kinds is: | ||
+ v1 Pod | ||
+ apps/v1 Deployment | ||
+ apps/v1 StatefulSet | ||
+ batch/v1 Job | ||
+ kubeflow.org/v1 PyTorchJob | ||
+ ray.io/v1 RayCluster | ||
+ ray.io/v1 RayJob | ||
|
||
In all of the examples, if `podSets` inference is supported for the wrapped Kind, | ||
then `podSets` is omitted from the sample yaml. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: workload.codeflare.dev/v1beta2 | ||
kind: AppWrapper | ||
metadata: | ||
name: sample-lws | ||
labels: | ||
kueue.x-k8s.io/queue-name: default-queue | ||
spec: | ||
components: | ||
- podSets: | ||
- path: "template.spec.leaderWorkerTemplate.leaderTemplate" | ||
replicas: 2 | ||
- path: "template.spec.leaderWorkerTemplate.workerTemplate" | ||
replicas: 3 | ||
template: | ||
apiVersion: leaderworkerset.x-k8s.io/v1 | ||
kind: LeaderWorkerSet | ||
metadata: | ||
name: nginx-leaderworkerset | ||
labels: | ||
app: nginx | ||
spec: | ||
replicas: 2 | ||
leaderWorkerTemplate: | ||
leaderTemplate: | ||
spec: | ||
containers: | ||
- name: nginx-leader | ||
image: registry.k8s.io/nginx-slim:0.27 | ||
resources: | ||
requests: | ||
cpu: "100m" | ||
ports: | ||
- containerPort: 80 | ||
size: 3 | ||
workerTemplate: | ||
spec: | ||
containers: | ||
- name: nginx-worker | ||
image: nginx:1.14.2 | ||
resources: | ||
requests: | ||
cpu: "200m" | ||
ports: | ||
- containerPort: 80 |