update klusterlet helm chart (#925)

Signed-off-by: Zhiwei Yin <zyin@redhat.com>
This commit is contained in:
Zhiwei Yin
2025-04-01 01:47:29 +00:00
committed by GitHub
parent 5d6b19cbbd
commit 485d6ea2db
3 changed files with 51 additions and 2 deletions
@@ -1,3 +1,5 @@
{{- $generatedNamespace := include "agentNamespace" . }}
{{- if ne $generatedNamespace .Release.Namespace }}
{{- if or .Values.bootstrapHubKubeConfig .Values.externalManagedKubeConfig .Values.multiHubBootstrapHubKubeConfigs }}
apiVersion: v1
kind: Namespace
@@ -6,3 +8,4 @@ metadata:
workload.openshift.io/allowed: "management"
name: "{{ template "agentNamespace" . }}"
{{- end }}
{{- end }}
@@ -1,4 +1,3 @@
{{- if not .Values.noOperator }}
{{- if .Values.images.imageCredentials.createImageCredentials }}
apiVersion: v1
kind: Secret
@@ -11,4 +10,3 @@ type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "imagePullSecret" . }}
{{- end }}
{{- end }}
+48
View File
@@ -326,6 +326,27 @@ func TestKlusterletConfig(t *testing.T) {
},
expectedObjCnt: 1,
},
{
name: "noOperator with image pull secret",
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.Images = ImagesConfig{
ImageCredentials: ImageCredentials{
CreateImageCredentials: true,
UserName: "test",
Password: "test",
},
}
return config
},
expectedObjCnt: 2,
},
{
name: "create namespace",
namespace: "open-cluster-management",
@@ -338,6 +359,33 @@ func TestKlusterletConfig(t *testing.T) {
},
expectedObjCnt: 6,
},
{
name: "create namespace with bootstrap secret",
namespace: "open-cluster-management",
chartConfig: func() *KlusterletChartConfig {
config := NewDefaultKlusterletChartConfig()
config.Klusterlet.ClusterName = "testCluster"
config.Klusterlet.Mode = operatorv1.InstallModeSingleton
config.CreateNamespace = true
config.BootstrapHubKubeConfig = "kubeconfig"
return config
},
expectedObjCnt: 8,
},
{
name: "create namespace with bootstrap secret and release.Namespace is the agent namespace",
namespace: "open-cluster-management-agent",
chartConfig: func() *KlusterletChartConfig {
config := NewDefaultKlusterletChartConfig()
config.Klusterlet.ClusterName = "testCluster"
config.Klusterlet.Mode = operatorv1.InstallModeSingleton
config.CreateNamespace = true
config.BootstrapHubKubeConfig = "kubeconfig"
return config
},
expectedObjCnt: 7,
},
}
for _, c := range cases {