diff --git a/CHANGELOG.md b/CHANGELOG.md index 60779085..63eb9db9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [MAJOR.MINOR.PATCH] - YYYY-MM-DD - Fix `KafkaTopic`: fails to create a topic with the replication factor set more than running Kafka nodes +- Fix `ServiceIntegration`: sends empty source and destination projects ## v0.24.0 - 2024-07-16 diff --git a/controllers/common.go b/controllers/common.go index bf70d5a3..4e102c90 100644 --- a/controllers/common.go +++ b/controllers/common.go @@ -288,3 +288,11 @@ func isAivenError(err error, code int) bool { return false } + +func toPtr[T comparable](v T) *T { + var empty T + if empty == v { + return nil + } + return &v +} diff --git a/controllers/serviceintegration_controller.go b/controllers/serviceintegration_controller.go index 1d924aac..283e88c5 100644 --- a/controllers/serviceintegration_controller.go +++ b/controllers/serviceintegration_controller.go @@ -67,13 +67,13 @@ func (h ServiceIntegrationHandler) createOrUpdate(ctx context.Context, avn *aive ctx, si.Spec.Project, &serviceintegration.ServiceIntegrationCreateIn{ - DestEndpointId: &si.Spec.DestinationEndpointID, - DestService: &si.Spec.DestinationServiceName, - DestProject: &si.Spec.DestinationProjectName, + DestEndpointId: toPtr(si.Spec.DestinationEndpointID), + DestService: toPtr(si.Spec.DestinationServiceName), + DestProject: toPtr(si.Spec.DestinationProjectName), IntegrationType: serviceintegration.IntegrationType(si.Spec.IntegrationType), - SourceEndpointId: &si.Spec.SourceEndpointID, - SourceService: &si.Spec.SourceServiceName, - SourceProject: &si.Spec.SourceProjectName, + SourceEndpointId: toPtr(si.Spec.SourceEndpointID), + SourceService: toPtr(si.Spec.SourceServiceName), + SourceProject: toPtr(si.Spec.SourceProjectName), UserConfig: &userConfigMap, }, )