Skip to content

Commit

Permalink
fix(serviceintegration): sends empty strings (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov authored Jul 24, 2024
1 parent e4a5dda commit 75a6999
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions controllers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
12 changes: 6 additions & 6 deletions controllers/serviceintegration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
)
Expand Down

0 comments on commit 75a6999

Please sign in to comment.