Skip to content

Commit b07a4fe

Browse files
fix(core): DSPX-1944 Fix service negation for extra services (#2905)
### Proposed Changes * Allow for service negation for extra services specified via WithExtraServices and WithExtraCoreServices * WithExtraCoreServices -- service run under core and all * WithExtraServices -- services run under all and their own mode specified by their namespace (maintaining previous behavior) ### Checklist - [ ] I have added or updated unit tests - [ ] I have added or updated integration tests (if appropriate) - [ ] I have added or updated documentation ### Testing Instructions
1 parent 4f9b8b9 commit b07a4fe

File tree

4 files changed

+338
-18
lines changed

4 files changed

+338
-18
lines changed

service/pkg/server/services.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,22 @@ func getServiceConfigurations() []serviceregistry.ServiceConfiguration {
7070
}
7171
}
7272

73+
func getServiceConfigurationsFromIServices(services []serviceregistry.IService, extraModes []serviceregistry.ModeName, individualModes bool) []serviceregistry.ServiceConfiguration {
74+
configs := make([]serviceregistry.ServiceConfiguration, 0, len(services))
75+
for _, svc := range services {
76+
modes := append([]serviceregistry.ModeName{serviceregistry.ModeALL}, extraModes...)
77+
if individualModes {
78+
modes = append(modes, serviceregistry.ModeName(svc.GetNamespace()))
79+
}
80+
configs = append(configs, serviceregistry.ServiceConfiguration{
81+
Name: ServiceName(svc.GetNamespace()),
82+
Modes: modes,
83+
Services: []serviceregistry.IService{svc},
84+
})
85+
}
86+
return configs
87+
}
88+
7389
// RegisterEssentialServices registers the essential services directly
7490
func RegisterEssentialServices(reg *serviceregistry.Registry) error {
7591
essentialServices := []serviceregistry.IService{

0 commit comments

Comments
 (0)