Skip to content

Commit 8a6001f

Browse files
authored
install kueue by operator (open-cluster-management-io#54)
Signed-off-by: Qing Hao <qhao@redhat.com>
1 parent 9e8ad98 commit 8a6001f

12 files changed

Lines changed: 353 additions & 34 deletions

File tree

kueue-addon/README.md

Lines changed: 109 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
# Kueue Addon for Open Cluster Management
22

3-
This addon provides an integration between Kueue and Open Cluster Management (OCM) to simplify MultiKueue setup and enhance multicluster scheduling capabilities.
3+
This addon provides an integration between [Kueue](https://kueue.sigs.k8s.io/) and Open Cluster Management (OCM) to simplify MultiKueue setup and enhance multicluster scheduling capabilities.
44

55
This integration is designed for Kueue users who want to leverage OCM's capabilities to improve their multicluster workload scheduling experience.
66

7-
The Kueue addon offers two primary benefits:
7+
The Kueue addon offers below benefits:
88

99
- **Simplified MultiKueue Setup**
1010
- Automates the generation of MultiKueue specific Kubeconfig.
1111
- Streamlines the configuration of MultiKueue resources.
12+
- Eliminates manual secret management.
13+
14+
- **Centralizing Resource management**
15+
- Manage spoke resources (ResourceFlavor, ClusterQueue, LocalQueue) from a single hub.
16+
- Template-based deployment.
1217

1318
- **Enhanced Multicluster Scheduling**
1419
- Integrates with OCM's placement with MultiKueue by implementing an admission check controller.
1520
- Generate MultiKueueConfig & MultiKueueCluster dynamically based on OCM placement decision.
21+
- Supports advanced placement strategies.
1622

23+
- **Flexible Installation Options**
24+
- Standard installation for existing Kueue setups.
25+
- Operator-based installation for OpenShift/OLM environments.
26+
- Cluster proxy support for enhanced connectivity.
1727

1828
## Description
1929

@@ -109,45 +119,128 @@ This controller is running on the hub, contains a credential controller and an a
109119
### Addon chart
110120
- **Addon deployment:** Deploy [Kueue addon controllers](#kueue-addon-controller) on the hub.
111121
- **Addon Template:** To deploy `ResourceFlavor`, `ClusterQueue` and `LocalQueue` resources need by MultiKueue to spoke clusters.
112-
- **Other addon files:** `ClusterManagementAddOn`, `ClusterRole`, `ClusterRoleBinding`, `ManagedClusterSetBinding`, `Placement` etc.
122+
- **Kueue Operator Template:** Optional operator-based Kueue installation on spoke clusters.
123+
- **Other addon files:** `ClusterManagementAddOn`, `ClusterRole`, `ClusterRoleBinding`, `ManagedClusterSetBinding`, `Placement` etc.
113124

114125
## Prerequisites
115126

116127
- Open Cluster Management (OCM) installed with the following addons:
117128
- [Cluster Permission Addon](https://github.com/open-cluster-management-io/cluster-permission)
118129
- [Managed Service Account Addon](https://github.com/open-cluster-management-io/managed-serviceaccount)
119-
- Kueue already installed on the hub and spoke cluster
120-
- MultiKueue enabled on the hub
130+
- [Cluster Proxy Addon](https://github.com/open-cluster-management-io/cluster-proxy) (Optional) Enables hub-to-spoke connectivity for enhanced networking.
131+
- Kueue installed:
132+
- Hub Cluster with [Kueue](https://kueue.sigs.k8s.io/docs/installation/) installed and MultiKueue enabled.
133+
- Spoke Clusters with [Kueue](https://kueue.sigs.k8s.io/docs/installation/) pre-installed, or let this addon install Kueue via [operator](https://github.com/openshift/kueue-operator) (OpenShift/OLM environments).
121134

122135
## Quick Start
123136

124-
**_Important_**: The addon requires you already installed OCM, Cluster Permission Addon, Managed Service Account Addon and Kueue.
125-
The whole setup steps about this solution, please refer to this [Kueue Integration Solution](https://github.com/open-cluster-management-io/ocm/blob/main/solutions/kueue-admission-check).
126-
127-
## Installation
128-
129-
On the hub cluster, deploy the addon.
137+
For a complete setup including all prerequisites on Kind:
130138

131139
```bash
132-
make deploy
140+
./build/setup-env.sh
133141
```
134142

135-
You can install the addons via the helm charts.
143+
## Installation
144+
145+
### Step 1: Add Helm Repository
136146

137147
```bash
138148
$ helm repo add ocm https://open-cluster-management.io/helm-charts/
139149
$ helm repo update
140150
$ helm search repo ocm/kueue-addon
141151
NAME CHART VERSION APP VERSION DESCRIPTION
142152
ocm/kueue-addon <chart-version> <app-version> A Helm chart for Open Cluster Management Kueue ...
153+
```
154+
155+
### Step 2: Choose Your Installation Method
156+
157+
#### Option A: Standard Installation (Kueue Pre-installed)
158+
159+
For environments where Kueue is already installed:
160+
161+
```bash
143162
$ helm install \
144163
-n open-cluster-management-addon --create-namespace \
145164
kueue-addon ocm/kueue-addon
146165
# Uncomment the following lines to customize your installation:
147-
# --set skipClusterSetBinding=true \
148-
# --set image.tag=<chart-version> \
166+
# --set skipClusterSetBinding=true
167+
```
168+
169+
#### Option B: Operator-based Installation (OpenShift/OLM)
170+
171+
In operator-based environments (for example, OpenShift with OLM), the addon can install the [Kueue operator](https://github.com/openshift/kueue-operator) for you.
172+
173+
Prepare a values.operator.yaml with below content:
174+
175+
```yaml
176+
kueue:
177+
namespace: "openshift-kueue-operator"
178+
179+
# Install Kueue via Operator
180+
installKueueViaOperator: true
181+
182+
# Operator Lifecycle Manager RBAC configuration
183+
operatorLifecycleManager:
184+
clusterRoleBindingName: kueue-operator-lifecycle-manager-rolebinding
185+
clusterRoleName: system:controller:operator-lifecycle-manager
186+
187+
# Kueue Operator configuration
188+
kueueOperator:
189+
name: kueue-operator
190+
namespace: openshift-kueue-operator
191+
operatorGroupName: openshift-kueue-operator
192+
channel: stable-v1.0
193+
source: redhat-operators
194+
sourceNamespace: openshift-marketplace
195+
startingCSV: kueue-operator.v1.0.1
196+
197+
# Cert Manager Operator configuration
198+
certManagerOperator:
199+
name: openshift-cert-manager-operator
200+
namespace: cert-manager-operator
201+
operatorGroupName: cert-manager-operator
202+
channel: stable-v1
203+
source: redhat-operators
204+
sourceNamespace: openshift-marketplace
205+
startingCSV: cert-manager-operator.v1.17.0
206+
207+
# Cluster proxy configuration
208+
clusterProxy:
209+
url: "https://<cluster-proxy-url>"
210+
211+
networkPolicy:
212+
name: kueue-allow-egress-cluster-proxy-dns
213+
namespace: "openshift-kueue-operator"
214+
spec:
215+
podSelector:
216+
matchLabels:
217+
app.openshift.io/name: kueue
218+
policyTypes:
219+
- Egress
220+
egress:
221+
- ports:
222+
- port: 80
223+
protocol: TCP
224+
- ports:
225+
- port: 443
226+
protocol: TCP
227+
- to:
228+
- namespaceSelector:
229+
matchLabels:
230+
kubernetes.io/metadata.name: <cluster-proxy-namespace>
231+
```
232+
233+
```bash
234+
$ helm install \
235+
-n open-cluster-management-addon --create-namespace \
236+
kueue-addon ocm/kueue-addon \
237+
-f values.operator.yaml
238+
# Uncomment the following lines to customize your installation:
239+
# --set skipClusterSetBinding=true
149240
```
150241

242+
## Verification
243+
151244
To confirm the installation from hub:
152245

153246
```bash
@@ -182,7 +275,7 @@ default-flavor 4h28m
182275

183276
## Usage
184277

185-
The usage please refer to this [Kueue Integration Solution](https://github.com/open-cluster-management-io/ocm/blob/main/solutions/kueue-admission-check).
278+
For detailed usage examples and advanced scenarios, refer to the [Kueue Integration Solution](https://github.com/open-cluster-management-io/ocm/blob/main/solutions/kueue-admission-check).
186279

187280
## Design Details and Workflow
188281

@@ -293,4 +386,3 @@ This automation greatly reduces manual effort and ensures that MultiKueue enviro
293386
- The admission check controller watches for `AdmissionCheck` resources referencing OCM `Placement`.
294387
- The admission check controller watches the `PlacementDecision`, creates or updates `MultiKueueCluster` resources with the kubeconfig details for each cluster, and also update these clusters in the `MultiKueueConfig` resource.
295388
- Finally, admission check controller updates the `AdmissionCheck` condition to true, indicating successful generation of the `MultiKueueConfig` and `MultiKueueCluster`, readying the [MultiKueue](https://kueue.sigs.k8s.io/docs/concepts/multikueue/) environment for job scheduling.
296-

kueue-addon/build/setup-env.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ install_ocm_addons() {
123123
--set enableAddOnDeploymentConfig=true \
124124
--set hubDeployMode=AddOnTemplate
125125

126+
echo "Install cluster-proxy"
127+
helm upgrade --install \
128+
-n open-cluster-management-addon --create-namespace \
129+
cluster-proxy ocm/cluster-proxy \
130+
--set installByPlacement.placementName=global \
131+
--set installByPlacement.placementNamespace=open-cluster-management-addon
132+
126133
echo "Install cluster-permission"
127134
helm upgrade --install \
128135
-n open-cluster-management --create-namespace \

kueue-addon/charts/kueue-addon/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: kueue-addon
33
description: A Helm chart for Open Cluster Management Kueue Addon
44
type: application
5-
version: 0.1.3
5+
version: 0.1.4
66
appVersion: "0.11.9"
77
maintainers:
88
- name: haoqing0110
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{{/*
2+
Operator Resources - Single Template
3+
*/}}
4+
{{- define "kueue-addon.operatorResources" -}}
5+
{{- if and .Values.kueueOperator .Values.certManagerOperator .Values.operatorLifecycleManager }}
6+
- apiVersion: rbac.authorization.k8s.io/v1
7+
kind: ClusterRoleBinding
8+
metadata:
9+
name: {{ .Values.operatorLifecycleManager.clusterRoleBindingName }}
10+
roleRef:
11+
apiGroup: rbac.authorization.k8s.io
12+
kind: ClusterRole
13+
name: {{ .Values.operatorLifecycleManager.clusterRoleName }}
14+
subjects:
15+
- kind: ServiceAccount
16+
name: klusterlet-work-sa
17+
namespace: open-cluster-management-agent
18+
- apiVersion: v1
19+
kind: Namespace
20+
metadata:
21+
name: {{ .Values.kueueOperator.namespace }}
22+
- apiVersion: operators.coreos.com/v1
23+
kind: OperatorGroup
24+
metadata:
25+
name: {{ .Values.kueueOperator.operatorGroupName }}
26+
namespace: {{ .Values.kueueOperator.namespace }}
27+
spec:
28+
upgradeStrategy: Default
29+
- apiVersion: operators.coreos.com/v1alpha1
30+
kind: Subscription
31+
metadata:
32+
name: {{ .Values.kueueOperator.name }}
33+
namespace: {{ .Values.kueueOperator.namespace }}
34+
spec:
35+
channel: {{ .Values.kueueOperator.channel }}
36+
installPlanApproval: Automatic
37+
name: {{ .Values.kueueOperator.name }}
38+
source: {{ .Values.kueueOperator.source }}
39+
sourceNamespace: {{ .Values.kueueOperator.sourceNamespace }}
40+
startingCSV: {{ .Values.kueueOperator.startingCSV }}
41+
- apiVersion: kueue.openshift.io/v1
42+
kind: Kueue
43+
metadata:
44+
name: cluster
45+
labels:
46+
app.kubernetes.io/name: kueue-operator
47+
spec:
48+
{{- if .Values.kueueCR.spec }}
49+
{{ toYaml .Values.kueueCR.spec | indent 4 }}
50+
{{- end }}
51+
- apiVersion: v1
52+
kind: Namespace
53+
metadata:
54+
name: {{ .Values.certManagerOperator.namespace }}
55+
- apiVersion: operators.coreos.com/v1
56+
kind: OperatorGroup
57+
metadata:
58+
name: {{ .Values.certManagerOperator.operatorGroupName }}
59+
namespace: {{ .Values.certManagerOperator.namespace }}
60+
spec:
61+
upgradeStrategy: Default
62+
- apiVersion: operators.coreos.com/v1alpha1
63+
kind: Subscription
64+
metadata:
65+
name: {{ .Values.certManagerOperator.name }}
66+
namespace: {{ .Values.certManagerOperator.namespace }}
67+
spec:
68+
channel: {{ .Values.certManagerOperator.channel }}
69+
installPlanApproval: Automatic
70+
name: {{ .Values.certManagerOperator.name }}
71+
source: {{ .Values.certManagerOperator.source }}
72+
sourceNamespace: {{ .Values.certManagerOperator.sourceNamespace }}
73+
startingCSV: {{ .Values.certManagerOperator.startingCSV }}
74+
{{- end }}
75+
{{- end }}

kueue-addon/charts/kueue-addon/templates/addon-template.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@ spec:
6262
name: {{ .Values.localQueue.name}}
6363
spec:
6464
clusterQueue: {{ .Values.clusterQueue.name}}
65+
{{- if .Values.installKueueViaOperator }}
66+
{{- include "kueue-addon.operatorResources" . | nindent 8 }}
67+
{{- end }}
68+

kueue-addon/charts/kueue-addon/templates/deployment.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ spec:
2121
args:
2222
- "/kueue-addon-controller"
2323
- "hub"
24+
env:
25+
- name: KUEUE_NAMESPACE
26+
value: {{ .Values.kueue.namespace }}
27+
{{- if .Values.clusterProxy.url }}
28+
- name: CLUSTER_PROXY_URL
29+
value: {{ .Values.clusterProxy.url }}
30+
{{- end }}
2431

2532
---
2633

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{- if .Values.networkPolicy }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: {{ .Values.networkPolicy.name }}
6+
namespace: {{ .Values.networkPolicy.namespace }}
7+
spec:
8+
{{ toYaml .Values.networkPolicy.spec | indent 2 }}
9+
{{- end }}

kueue-addon/charts/kueue-addon/templates/placement.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{ if not .Values.skipClusterSetBinding }}
1+
{{- if not .Values.skipClusterSetBinding }}
22
apiVersion: cluster.open-cluster-management.io/v1beta2
33
kind: ManagedClusterSetBinding
44
metadata:

kueue-addon/charts/kueue-addon/values.yaml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Image configuration
55
image:
66
repository: quay.io/open-cluster-management/kueue-addon
7-
tag:
7+
tag: "" # defaults to chart appVersion
88
pullPolicy: IfNotPresent
99

1010
# Skip cluster set binding
@@ -38,3 +38,59 @@ clusterQueue:
3838
localQueue:
3939
name: user-queue
4040
namespace: default
41+
42+
# This is the namespace where the kueue controller is installed, will copy the multikueue secret to this namespace
43+
# Default is kueue-system
44+
kueue:
45+
namespace: "kueue-system"
46+
47+
# Cluster proxy configuration (optional)
48+
clusterProxy:
49+
# URL for the cluster proxy service, used to access managed clusters through a proxy
50+
# When set, the controller will use this URL to connect to managed clusters
51+
# Example: "https://cluster-proxy.example.com/clusters/"
52+
url: ""
53+
54+
# NetworkPolicy configuration (uncomment when installKueueViaOperator enabled)
55+
# Uncomment when using operator-based installation with network restrictions
56+
# networkPolicy:
57+
# name: kueue-allow-egress-cluster-proxy-dns
58+
# namespace: "kueue-system"
59+
# spec: {}
60+
61+
# Enable Kueue installation via operator
62+
installKueueViaOperator: false
63+
64+
# Operator Lifecycle Manager RBAC configuration (uncomment when installKueueViaOperator enabled)
65+
# operatorLifecycleManager:
66+
# clusterRoleBindingName: <cluster-role-binding-name>
67+
# clusterRoleName: <cluster-role-name>
68+
69+
# Kueue Operator configuration (uncomment when installKueueViaOperator enabled)
70+
# kueueOperator:
71+
# name: <operator-name>
72+
# namespace: <operator-namespace>
73+
# operatorGroupName: <operator-group-name>
74+
# channel: <channel-version>
75+
# source: <operator-source>
76+
# sourceNamespace: <source-namespace>
77+
# startingCSV: <starting-csv>
78+
79+
# Cert Manager Operator configuration (uncomment when installKueueViaOperator enabled)
80+
# certManagerOperator:
81+
# name: <cert-manager-operator-name>
82+
# namespace: <cert-manager-namespace>
83+
# operatorGroupName: <cert-manager-operator-group>
84+
# channel: <cert-manager-channel>
85+
# source: <cert-manager-source>
86+
# sourceNamespace: <cert-manager-source-namespace>
87+
# startingCSV: <cert-manager-starting-csv>
88+
89+
# Kueue CR customization (uncomment when installKueueViaOperator enabled)
90+
# kueueCR:
91+
# spec:
92+
# config:
93+
# integrations:
94+
# frameworks:
95+
# - BatchJob
96+
# managementState: Managed

0 commit comments

Comments
 (0)