diff --git a/deploy/cluster-manager/chart/cluster-manager/templates/cluster_manager.yaml b/deploy/cluster-manager/chart/cluster-manager/templates/cluster_manager.yaml index ecee98daa3..1c5763ca50 100644 --- a/deploy/cluster-manager/chart/cluster-manager/templates/cluster_manager.yaml +++ b/deploy/cluster-manager/chart/cluster-manager/templates/cluster_manager.yaml @@ -41,4 +41,8 @@ spec: addOnManagerConfiguration: {{- toYaml . | nindent 4 }} {{- end }} + {{- with .Values.clusterManager.serverConfiguration }} + serverConfiguration: + {{- toYaml . | nindent 4 }} + {{- end }} {{- end }} diff --git a/deploy/cluster-manager/chart/cluster-manager/values.yaml b/deploy/cluster-manager/chart/cluster-manager/values.yaml index c9bc078f98..738d093ad8 100644 --- a/deploy/cluster-manager/chart/cluster-manager/values.yaml +++ b/deploy/cluster-manager/chart/cluster-manager/values.yaml @@ -100,9 +100,20 @@ clusterManager: mode: Enable registrationDrivers: - authType: csr +# - authType: grpc +# grpc: +# autoApprovedIdentities: +# - system:serviceaccount:open-cluster-management:agent-registration-bootstrap workConfiguration: workDriver: kube addOnManagerConfiguration: {} # featureGates: # - feature: "" # mode: "" +# serverConfiguration: +# endpointsExposure: +# - protocol: grpc +# grpc: +# type: hostname +# hostname: +# host: grpc-server-open-cluster-management-hub.apps.server-foundation-sno-lite-w8rlq.dev04.red-chesterfield.com diff --git a/pkg/operator/helpers/chart/config.go b/pkg/operator/helpers/chart/config.go index 40fe67daf2..0f6f732d35 100644 --- a/pkg/operator/helpers/chart/config.go +++ b/pkg/operator/helpers/chart/config.go @@ -141,6 +141,10 @@ type ClusterManagerConfig struct { // +optional AddOnManagerConfiguration operatorv1.AddOnManagerConfiguration `json:"addOnManagerConfiguration,omitempty"` + // ServerConfiguration contains the configuration of http/grpc server. + // +optional + ServerConfiguration operatorv1.ServerConfiguration `json:"serverConfiguration,omitempty"` + // ResourceRequirement specify QoS classes of deployments managed by clustermanager. // It applies to all the containers in the deployments. // +optional diff --git a/pkg/operator/helpers/chart/render_test.go b/pkg/operator/helpers/chart/render_test.go index 56a57ffe14..c22b17621e 100644 --- a/pkg/operator/helpers/chart/render_test.go +++ b/pkg/operator/helpers/chart/render_test.go @@ -121,6 +121,36 @@ func TestClusterManagerConfig(t *testing.T) { }, expectedObjCnt: 9, }, + { + name: "enable grpc ", + namespace: "multicluster-engine", + chartConfig: func() *ClusterManagerChartConfig { + config := NewDefaultClusterManagerChartConfig() + config.CreateBootstrapSA = true + config.ClusterManager.RegistrationConfiguration.RegistrationDrivers = append( + config.ClusterManager.RegistrationConfiguration.RegistrationDrivers, operatorv1.RegistrationDriverHub{ + AuthType: "grpc", + GRPC: &operatorv1.GRPCRegistrationConfig{AutoApprovedIdentities: []string{"user:test"}}, + }) + + config.ClusterManager.ServerConfiguration = operatorv1.ServerConfiguration{ + EndpointsExposure: []operatorv1.EndpointExposure{ + { + Usage: "", + Protocol: "grpc", + GRPC: &operatorv1.Endpoint{ + Type: "hostname", + Hostname: &operatorv1.HostnameConfig{ + Host: "host.com", + }, + }, + }, + }, + } + return config + }, + expectedObjCnt: 8, + }, } for _, c := range cases { @@ -202,6 +232,14 @@ func TestClusterManagerConfig(t *testing.T) { t.Errorf("failed to render auto approve users") } } + registrationDrivers := config.ClusterManager.RegistrationConfiguration.RegistrationDrivers + for _, driver := range registrationDrivers { + if driver.AuthType == operatorv1.GRPCAuthType { + if len(config.ClusterManager.ServerConfiguration.EndpointsExposure) == 0 { + t.Errorf("failed to render serverConfiguration") + } + } + } case *corev1.Secret: switch object.Name { case "open-cluster-management-image-pull-credentials":