do not install priority class if noOpoerator is true (#928)

Signed-off-by: Zhiwei Yin <zyin@redhat.com>
This commit is contained in:
Zhiwei Yin
2025-04-01 21:59:43 +08:00
committed by GitHub
parent 1a33f10347
commit 1c4f49a4e4
2 changed files with 20 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
{{- if not .Values.noOperator }}
{{- if .Values.priorityClassName }}
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
@@ -8,3 +9,4 @@ globalDefault: false
description: "This priority class should be used for klusterlet agents only."
preemptionPolicy: PreemptLowerPriority
{{- end }}
{{- end }}

View File

@@ -326,6 +326,20 @@ func TestKlusterletConfig(t *testing.T) {
},
expectedObjCnt: 1,
},
{
name: "noOperator with priority cluster",
namespace: "ocm",
chartConfig: func() *KlusterletChartConfig {
config := NewDefaultKlusterletChartConfig()
config.NoOperator = true
config.Klusterlet.Name = "klusterlet2"
config.Klusterlet.Namespace = "open-cluster-management-test"
config.Klusterlet.ClusterName = "testCluster"
config.PriorityClassName = "klusterlet-critical"
return config
},
expectedObjCnt: 1,
},
{
name: "noOperator with image pull secret",
namespace: "ocm",
@@ -335,6 +349,7 @@ func TestKlusterletConfig(t *testing.T) {
config.Klusterlet.Name = "klusterlet2"
config.Klusterlet.Namespace = "open-cluster-management-test"
config.Klusterlet.ClusterName = "testCluster"
config.PriorityClassName = "klusterlet-critical"
config.Images = ImagesConfig{
ImageCredentials: ImageCredentials{
CreateImageCredentials: true,
@@ -453,6 +468,9 @@ func TestKlusterletConfig(t *testing.T) {
if object.Spec.ClusterName != config.Klusterlet.ClusterName {
t.Errorf(" expected %s, got %s", config.Klusterlet.ClusterName, object.Spec.ClusterName)
}
if object.Spec.PriorityClassName != config.PriorityClassName {
t.Errorf(" expected %s, got %s", config.PriorityClassName, object.Spec.PriorityClassName)
}
switch config.Klusterlet.Mode {
case "", operatorv1.InstallModeSingleton, operatorv1.InstallModeDefault:
if config.Klusterlet.Mode == "" && object.Spec.DeployOption.Mode != operatorv1.InstallModeSingleton {