Skip to content

Commit ac48eba

Browse files
author
Bojan
authored
Dataplane Roles API (#1750)
* backend: initial add of v1 dataplane api proto and setup for security roles API * backend: update permissions for viewer roles API * backend: update permissions for viewer roles API * backend: register cloud storage service and security service into gateway mux * backend: register cloud storage service and security service into gateway mux * frontend, proto: make console security service embed the dataplane security service * backend: add nolint comments * frontend: fix roles query to use new embedded structure * frontend: fix newRole in RoleForm * proto: pin buf.build/redpandadata/common * frontend: remove unused imports * proto: make all security api permissions admin, fix proto taskfile * proto: make all security api permissions admin in console service
1 parent 19500f8 commit ac48eba

17 files changed

Lines changed: 4497 additions & 1137 deletions

File tree

backend/pkg/api/routes.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ func (api *API) setupConnectWithGRPCGateway(r chi.Router) {
175175
dataplanev1connect.TransformServiceName: transformSvcV1,
176176
dataplanev1connect.KafkaConnectServiceName: kafkaConnectSvcV1,
177177
dataplanev1connect.CloudStorageServiceName: dataplanev1connect.UnimplementedCloudStorageServiceHandler{},
178+
dataplanev1connect.SecurityServiceName: dataplanev1connect.UnimplementedSecurityServiceHandler{},
178179
},
179180
})
180181

@@ -260,8 +261,9 @@ func (api *API) setupConnectWithGRPCGateway(r chi.Router) {
260261
kafkaConnectSvcPathV1Alpha2, kafkaConnectSvcHandlerV1Alpha2 := dataplanev1alpha2connect.NewKafkaConnectServiceHandler(
261262
hookOutput.Services[dataplanev1alpha2connect.KafkaConnectServiceName].(dataplanev1alpha2connect.KafkaConnectServiceHandler),
262263
connect.WithInterceptors(hookOutput.Interceptors...))
264+
cloudStorageSvcV1Alpha2 := hookOutput.Services[dataplanev1alpha2connect.CloudStorageServiceName].(dataplanev1alpha2connect.CloudStorageServiceHandler) //nolint:revive // we control the map
263265
cloudStorageSvcPathV1Alpha2, cloudStorageSvcHandlerV1Alpha2 := dataplanev1alpha2connect.NewCloudStorageServiceHandler(
264-
hookOutput.Services[dataplanev1alpha2connect.CloudStorageServiceName].(dataplanev1alpha2connect.CloudStorageServiceHandler),
266+
cloudStorageSvcV1Alpha2,
265267
connect.WithInterceptors(hookOutput.Interceptors...))
266268

267269
// v1
@@ -281,8 +283,13 @@ func (api *API) setupConnectWithGRPCGateway(r chi.Router) {
281283
kafkaConnectSvcPathV1, kafkaConnectSvcHandlerV1 := dataplanev1connect.NewKafkaConnectServiceHandler(
282284
hookOutput.Services[dataplanev1connect.KafkaConnectServiceName].(dataplanev1connect.KafkaConnectServiceHandler),
283285
connect.WithInterceptors(hookOutput.Interceptors...))
286+
cloudStorageSvcV1 := hookOutput.Services[dataplanev1connect.CloudStorageServiceName].(dataplanev1connect.CloudStorageServiceHandler) //nolint:revive // we control the map
284287
cloudStorageSvcPathV1, cloudStorageSvcHandlerV1 := dataplanev1connect.NewCloudStorageServiceHandler(
285-
hookOutput.Services[dataplanev1connect.CloudStorageServiceName].(dataplanev1connect.CloudStorageServiceHandler),
288+
cloudStorageSvcV1,
289+
connect.WithInterceptors(hookOutput.Interceptors...))
290+
securitySvcV1 := hookOutput.Services[dataplanev1connect.SecurityServiceName].(dataplanev1connect.SecurityServiceHandler) //nolint:revive // we control the map
291+
securitySvcPathV1, securitySvcHandlerV1 := dataplanev1connect.NewSecurityServiceHandler(
292+
securitySvcV1,
286293
connect.WithInterceptors(hookOutput.Interceptors...))
287294

288295
ossServices := []ConnectService{
@@ -406,6 +413,11 @@ func (api *API) setupConnectWithGRPCGateway(r chi.Router) {
406413
MountPath: consoleSecretsServicePath,
407414
Handler: consoleSecretsServiceHandler,
408415
},
416+
{
417+
ServiceName: dataplanev1connect.SecurityServiceName,
418+
MountPath: securitySvcPathV1,
419+
Handler: securitySvcHandlerV1,
420+
},
409421
}
410422

411423
// Order matters. OSS services first, so Enterprise handlers override OSS.
@@ -434,6 +446,7 @@ func (api *API) setupConnectWithGRPCGateway(r chi.Router) {
434446
dataplanev1alpha2connect.RegisterUserServiceHandlerGatewayServer(gwMux, userSvcV1alpha2, connectgateway.WithInterceptors(hookOutput.Interceptors...))
435447
dataplanev1alpha2connect.RegisterTransformServiceHandlerGatewayServer(gwMux, transformSvcV1alpha2, connectgateway.WithInterceptors(hookOutput.Interceptors...))
436448
dataplanev1alpha2connect.RegisterKafkaConnectServiceHandlerGatewayServer(gwMux, kafkaConnectSvcV1alpha2, connectgateway.WithInterceptors(hookOutput.Interceptors...))
449+
dataplanev1alpha2connect.RegisterCloudStorageServiceHandlerGatewayServer(gwMux, cloudStorageSvcV1Alpha2, connectgateway.WithInterceptors(hookOutput.Interceptors...))
437450

438451
// v1
439452

@@ -442,6 +455,8 @@ func (api *API) setupConnectWithGRPCGateway(r chi.Router) {
442455
dataplanev1connect.RegisterUserServiceHandlerGatewayServer(gwMux, userSvcV1, connectgateway.WithInterceptors(hookOutput.Interceptors...))
443456
dataplanev1connect.RegisterTransformServiceHandlerGatewayServer(gwMux, transformSvcV1, connectgateway.WithInterceptors(hookOutput.Interceptors...))
444457
dataplanev1connect.RegisterKafkaConnectServiceHandlerGatewayServer(gwMux, kafkaConnectSvcV1, connectgateway.WithInterceptors(hookOutput.Interceptors...))
458+
dataplanev1connect.RegisterCloudStorageServiceHandlerGatewayServer(gwMux, cloudStorageSvcV1, connectgateway.WithInterceptors(hookOutput.Interceptors...))
459+
dataplanev1connect.RegisterSecurityServiceHandlerGatewayServer(gwMux, securitySvcV1, connectgateway.WithInterceptors(hookOutput.Interceptors...))
445460

446461
// mount
447462

0 commit comments

Comments
 (0)