generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
document using AppWrappers to run wrapped custom Jobs (#3978)
* document using AppWrappers to run wrapped custom Jobs * address review comments
- Loading branch information
1 parent
ae8d9a8
commit d289679
Showing
3 changed files
with
107 additions
and
3 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
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,58 @@ | ||
--- | ||
title: "Run A Wrapped Custom Workload" | ||
linkTitle: "Custom Workload" | ||
date: 2025-01-14 | ||
weight: 7 | ||
description: > | ||
Use an AppWrapper to Run a Custom Workload on Kueue. | ||
--- | ||
|
||
This page shows how to use [AppWrappers](https://project-codeflare.github.io/appwrapper/) to make | ||
Kueue's scheduling and resource management capabilities available to Workload types that do not have a dedicated | ||
Kueue integration. For Workloads that use `PodSpecTemplates` in their definition, this can provide | ||
a significantly easier approach than [building a custom integration](/docs/tasks/dev/integrate_a_custom_job) | ||
to enable the use of Kueue with a custom Workload type. | ||
|
||
This guide is for [batch users](/docs/tasks#batch-user) that have a basic understanding of Kueue. For more information, see [Kueue's overview](/docs/overview). | ||
|
||
## Before you begin | ||
|
||
1. Make sure you are using Kueue v0.11.0 version or newer and AppWrapper v1.0.0 or newer. | ||
|
||
2. Follow the steps in [Run AppWrappers](/docs/tasks/run/appwrappers/#before-you-begin) | ||
to learn how to enable and configure the `codeflare.dev/appwrapper` integration. | ||
|
||
## Example using LeaderWorkerSets as the Custom Workload | ||
|
||
We use [LeaderWorkerSets](https://github.com/kubernetes-sigs/lws) to explain how to | ||
run a workload of a custom type inside an AppWrapper. | ||
|
||
1. Follow the [install](https://github.com/kubernetes-sigs/lws/blob/main/docs/setup/install.md) | ||
instructions for LeaderWorkerSets. | ||
|
||
2. Edit the `appwrapper-manager-role` `ClusterRole` to add the stanza below to allow | ||
the appwrapper controller to manipulate LeaderWorketSets. | ||
```yaml | ||
- apiGroups: | ||
- leaderworkerset.x-k8s.io | ||
resources: | ||
- leaderworkersets | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
``` | ||
3. The AppWrapper containing the LeaderWorkerSet is shown below. | ||
In particular, notice how the `replicas` and `path` of each element of the `podSets` array | ||
corresponds to a `PodSpecTemplate` and replica count within `template`. | ||
This gives the AppWrapper controller enough information to enable | ||
it to "understand" the wrapped resource and provide Kueue the information it needs to | ||
manage it. | ||
|
||
{{< include "examples/jobs/appwrapper-leaderworkerset-sample.yaml" "yaml" >}} | ||
|
44 changes: 44 additions & 0 deletions
44
site/static/examples/jobs/appwrapper-leaderworkerset-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: user-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 |