Skip to content

Commit 0205147

Browse files
add server configuration for clusterManager helm chart (#1244)
Signed-off-by: Zhiwei Yin <[email protected]> Co-authored-by: Zhiwei Yin <[email protected]>
1 parent c3e33d3 commit 0205147

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

deploy/cluster-manager/chart/cluster-manager/templates/cluster_manager.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@ spec:
4141
addOnManagerConfiguration:
4242
{{- toYaml . | nindent 4 }}
4343
{{- end }}
44+
{{- with .Values.clusterManager.serverConfiguration }}
45+
serverConfiguration:
46+
{{- toYaml . | nindent 4 }}
47+
{{- end }}
4448
{{- end }}

deploy/cluster-manager/chart/cluster-manager/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,20 @@ clusterManager:
100100
mode: Enable
101101
registrationDrivers:
102102
- authType: csr
103+
# - authType: grpc
104+
# grpc:
105+
# autoApprovedIdentities:
106+
# - system:serviceaccount:open-cluster-management:agent-registration-bootstrap
103107
workConfiguration:
104108
workDriver: kube
105109
addOnManagerConfiguration: {}
106110
# featureGates:
107111
# - feature: ""
108112
# mode: ""
113+
# serverConfiguration:
114+
# endpointsExposure:
115+
# - protocol: grpc
116+
# grpc:
117+
# type: hostname
118+
# hostname:
119+
# host: grpc-server-open-cluster-management-hub.apps.server-foundation-sno-lite-w8rlq.dev04.red-chesterfield.com

pkg/operator/helpers/chart/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ type ClusterManagerConfig struct {
141141
// +optional
142142
AddOnManagerConfiguration operatorv1.AddOnManagerConfiguration `json:"addOnManagerConfiguration,omitempty"`
143143

144+
// ServerConfiguration contains the configuration of http/grpc server.
145+
// +optional
146+
ServerConfiguration operatorv1.ServerConfiguration `json:"serverConfiguration,omitempty"`
147+
144148
// ResourceRequirement specify QoS classes of deployments managed by clustermanager.
145149
// It applies to all the containers in the deployments.
146150
// +optional

pkg/operator/helpers/chart/render_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,36 @@ func TestClusterManagerConfig(t *testing.T) {
121121
},
122122
expectedObjCnt: 9,
123123
},
124+
{
125+
name: "enable grpc ",
126+
namespace: "multicluster-engine",
127+
chartConfig: func() *ClusterManagerChartConfig {
128+
config := NewDefaultClusterManagerChartConfig()
129+
config.CreateBootstrapSA = true
130+
config.ClusterManager.RegistrationConfiguration.RegistrationDrivers = append(
131+
config.ClusterManager.RegistrationConfiguration.RegistrationDrivers, operatorv1.RegistrationDriverHub{
132+
AuthType: "grpc",
133+
GRPC: &operatorv1.GRPCRegistrationConfig{AutoApprovedIdentities: []string{"user:test"}},
134+
})
135+
136+
config.ClusterManager.ServerConfiguration = operatorv1.ServerConfiguration{
137+
EndpointsExposure: []operatorv1.EndpointExposure{
138+
{
139+
Usage: "",
140+
Protocol: "grpc",
141+
GRPC: &operatorv1.Endpoint{
142+
Type: "hostname",
143+
Hostname: &operatorv1.HostnameConfig{
144+
Host: "host.com",
145+
},
146+
},
147+
},
148+
},
149+
}
150+
return config
151+
},
152+
expectedObjCnt: 8,
153+
},
124154
}
125155

126156
for _, c := range cases {
@@ -202,6 +232,14 @@ func TestClusterManagerConfig(t *testing.T) {
202232
t.Errorf("failed to render auto approve users")
203233
}
204234
}
235+
registrationDrivers := config.ClusterManager.RegistrationConfiguration.RegistrationDrivers
236+
for _, driver := range registrationDrivers {
237+
if driver.AuthType == operatorv1.GRPCAuthType {
238+
if len(config.ClusterManager.ServerConfiguration.EndpointsExposure) == 0 {
239+
t.Errorf("failed to render serverConfiguration")
240+
}
241+
}
242+
}
205243
case *corev1.Secret:
206244
switch object.Name {
207245
case "open-cluster-management-image-pull-credentials":

0 commit comments

Comments
 (0)