Skip to content

Commit 6926f1b

Browse files
committed
install kueue by operator
Signed-off-by: Qing Hao <qhao@redhat.com>
1 parent 9d5d575 commit 6926f1b

4 files changed

Lines changed: 119 additions & 3 deletions

File tree

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

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,77 @@ spec:
6262
name: {{ .Values.localQueue.name}}
6363
spec:
6464
clusterQueue: {{ .Values.clusterQueue.name}}
65+
{{ if .Values.installKueueViaOperator }}
66+
- apiVersion: rbac.authorization.k8s.io/v1
67+
kind: ClusterRoleBinding
68+
metadata:
69+
name: kueue-operator-lifecycle-manager-rolebinding
70+
roleRef:
71+
apiGroup: rbac.authorization.k8s.io
72+
kind: ClusterRole
73+
name: system:controller:operator-lifecycle-manager
74+
subjects:
75+
- kind: ServiceAccount
76+
name: klusterlet-work-sa
77+
namespace: open-cluster-management-agent
78+
- apiVersion: v1
79+
kind: Namespace
80+
metadata:
81+
name: {{ .Values.kueueOperator.namespace }}
82+
- apiVersion: operators.coreos.com/v1
83+
kind: OperatorGroup
84+
metadata:
85+
name: {{ .Values.kueueOperator.operatorGroupName }}
86+
namespace: {{ .Values.kueueOperator.namespace }}
87+
spec:
88+
upgradeStrategy: Default
89+
- apiVersion: operators.coreos.com/v1alpha1
90+
kind: Subscription
91+
metadata:
92+
name: {{ .Values.kueueOperator.name }}
93+
namespace: {{ .Values.kueueOperator.namespace }}
94+
spec:
95+
channel: {{ .Values.kueueOperator.channel }}
96+
installPlanApproval: Automatic
97+
name: {{ .Values.kueueOperator.name }}
98+
source: {{ .Values.kueueOperator.source }}
99+
sourceNamespace: {{ .Values.kueueOperator.sourceNamespace }}
100+
startingCSV: {{ .Values.kueueOperator.startingCSV }}
101+
- apiVersion: kueue.openshift.io/v1
102+
kind: Kueue
103+
metadata:
104+
name: cluster
105+
labels:
106+
app.kubernetes.io/managed-by: kustomize
107+
app.kubernetes.io/name: kueue-operator
108+
spec:
109+
config:
110+
integrations:
111+
frameworks:
112+
- BatchJob
113+
managementState: Managed
114+
- apiVersion: v1
115+
kind: Namespace
116+
metadata:
117+
name: {{ .Values.certManagerOperator.namespace }}
118+
- apiVersion: operators.coreos.com/v1
119+
kind: OperatorGroup
120+
metadata:
121+
name: {{ .Values.certManagerOperator.operatorGroupName }}
122+
namespace: {{ .Values.certManagerOperator.namespace }}
123+
spec:
124+
upgradeStrategy: Default
125+
- apiVersion: operators.coreos.com/v1alpha1
126+
kind: Subscription
127+
metadata:
128+
name: {{ .Values.certManagerOperator.name }}
129+
namespace: {{ .Values.certManagerOperator.namespace }}
130+
spec:
131+
channel: {{ .Values.certManagerOperator.channel }}
132+
installPlanApproval: Automatic
133+
name: {{ .Values.certManagerOperator.name }}
134+
source: {{ .Values.certManagerOperator.source }}
135+
sourceNamespace: {{ .Values.certManagerOperator.sourceNamespace }}
136+
startingCSV: {{ .Values.certManagerOperator.startingCSV }}
137+
{{- end }}
138+

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ spec:
2121
args:
2222
- "/kueue-addon-controller"
2323
- "hub"
24+
env:
25+
- name: KUEUE_NAMESPACE
26+
value: {{ .Values.kueue.namespace }}
2427

2528
---
2629

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,31 @@ clusterQueue:
3737
localQueue:
3838
name: user-queue
3939
namespace: default
40+
41+
# This is the namespace where the kueue controller is installed, will copy the multikueue secret to this namespace
42+
# Default is kueue-system
43+
kueue:
44+
namespace: "kueue-system"
45+
46+
# Install Kueue via Operator
47+
installKueueViaOperator: false
48+
49+
# Kueue Operator configuration
50+
kueueOperator:
51+
name: kueue-operator
52+
namespace: openshift-kueue-operator
53+
operatorGroupName: openshift-kueue-operator
54+
channel: stable-v1.0
55+
source: redhat-operators
56+
sourceNamespace: openshift-marketplace
57+
startingCSV: kueue-operator.v1.0.0
58+
59+
# Cert Manager Operator configuration
60+
certManagerOperator:
61+
name: openshift-cert-manager-operator
62+
namespace: cert-manager-operator
63+
operatorGroupName: cert-manager-operator
64+
channel: stable-v1
65+
source: redhat-operators
66+
sourceNamespace: openshift-marketplace
67+
startingCSV: cert-manager-operator.v1.16.1

kueue-addon/pkg/hub/controllers/common/value.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
package common
22

3-
import "fmt"
3+
import (
4+
"fmt"
5+
"os"
6+
)
47

5-
const (
8+
var (
69
// MultiKueueResourceName is the name used for MultiKueue-related secrets
710
MultiKueueResourceName = "multikueue"
811

912
// KueueNamespace is the namespace where Kueue components are deployed
10-
KueueNamespace = "kueue-system"
13+
KueueNamespace = getKueueNamespace()
1114

1215
// AdmissionCheckControllerName is the name of the admission check controller
1316
AdmissionCheckControllerName = "open-cluster-management.io/placement"
1417
)
1518

19+
func getKueueNamespace() string {
20+
ns := os.Getenv("KUEUE_NAMESPACE")
21+
if ns == "" {
22+
return "kueue-system"
23+
}
24+
return ns
25+
}
26+
1627
// Get MultiKueue Kubeconfig Secret name
1728
func GetMultiKueueSecretName(clusterName string) string {
1829
return fmt.Sprintf("%s-%s", MultiKueueResourceName, clusterName)

0 commit comments

Comments
 (0)