add grpc config into the bootstrap secret (#1194)
Some checks failed
Post / coverage (push) Failing after 27s
Post / images (amd64, addon-manager) (push) Failing after 21s
Post / images (amd64, placement) (push) Failing after 23s
Post / images (amd64, registration) (push) Failing after 18s
Post / images (amd64, registration-operator) (push) Failing after 22s
Post / images (amd64, work) (push) Failing after 23s
Post / images (arm64, addon-manager) (push) Failing after 25s
Post / images (arm64, placement) (push) Failing after 21s
Post / images (arm64, registration) (push) Failing after 27s
Post / images (arm64, registration-operator) (push) Failing after 28s
Post / images (arm64, work) (push) Failing after 21s
Post / image manifest (addon-manager) (push) Has been skipped
Post / image manifest (placement) (push) Has been skipped
Post / image manifest (registration) (push) Has been skipped
Post / image manifest (registration-operator) (push) Has been skipped
Post / image manifest (work) (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Scorecard supply-chain security / Scorecard analysis (push) Failing after 33s
Close stale issues and PRs / stale (push) Failing after 31s

Signed-off-by: Zhiwei Yin <zyin@redhat.com>
This commit is contained in:
Zhiwei Yin
2025-09-24 11:35:31 +08:00
committed by GitHub
parent 010f5efe6d
commit 35bab4476a
4 changed files with 33 additions and 0 deletions

View File

@@ -65,6 +65,10 @@ type KlusterletChartConfig struct {
// BootstrapHubKubeConfig should be the kubeConfig file of the hub cluster via setting --set-file=<the kubeConfig file of hub cluster> optional
BootstrapHubKubeConfig string `json:"bootstrapHubKubeConfig,omitempty"`
// GRPCConfig includes the information needed to build connect to gRPC server in the bootstrap secret for
// cluster importing via setting --set-file=<the grpc config file> optional.
GRPCConfig string `json:"grpcConfig,omitempty"`
// when MultipleHubs feature gate in klusterlet.registrationConfiguration is enabled, need to set multiple bootstrap hub kubeConfigs here.
MultiHubBootstrapHubKubeConfigs []BootStrapKubeConfig `json:"multiHubBootstrapHubKubeConfigs,omitempty"`
@@ -81,6 +85,7 @@ type BootStrapKubeConfig struct {
Name string `json:"name,omitempty"`
// the kubeConfig file of the hub cluster
KubeConfig string `json:"kubeConfig,omitempty"`
// TODO: add grpcConfig to support multiHubBootstrapHubKubeConfigs
}
type ImagesConfig struct {

View File

@@ -411,6 +411,20 @@ func TestKlusterletConfig(t *testing.T) {
},
expectedObjCnt: 7,
},
{
name: "create namespace with bootstrap secret and grpc config",
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"
config.GRPCConfig = "grpcconfig"
return config
},
expectedObjCnt: 7,
},
}
for _, c := range cases {
@@ -569,6 +583,13 @@ func TestKlusterletConfig(t *testing.T) {
if base64.StdEncoding.EncodeToString(data) == "" {
t.Errorf("failed to render kubeconfig")
}
if config.GRPCConfig != "" {
grpcConfig := object.Data["config.yaml"]
if base64.StdEncoding.EncodeToString(grpcConfig) == "" {
t.Errorf("failed to render grpc config")
}
}
}
}
}