New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/ordering #123
Refactor/ordering #123
Conversation
b5c19d9
to
148e0ce
Compare
@cyril-corbon @AdheipSingh ping 😄 |
@itamar-marom ill check this week. Thanks |
ill take this in the next release. Will test is locally once. |
func getNodeSpecsByOrder(m *v1alpha1.Druid) []*ServiceGroup { | ||
|
||
scaledServiceSpecsByNodeType := map[string][]*ServiceGroup{} | ||
for _, t := range druidServicesOrder { | ||
scaledServiceSpecsByNodeType[t] = []*ServiceGroup{} | ||
} | ||
|
||
for key, nodeSpec := range m.Spec.Nodes { | ||
scaledServiceSpec := scaledServiceSpecsByNodeType[nodeSpec.NodeType] | ||
scaledServiceSpecsByNodeType[nodeSpec.NodeType] = append(scaledServiceSpec, &ServiceGroup{key: key, spec: nodeSpec}) | ||
} | ||
|
||
allScaledServiceSpecs := make([]*ServiceGroup, 0, len(m.Spec.Nodes)) | ||
|
||
for _, t := range druidServicesOrder { | ||
allScaledServiceSpecs = append(allScaledServiceSpecs, scaledServiceSpecsByNodeType[t]...) | ||
} | ||
|
||
return allScaledServiceSpecs | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very good refactor. We can now abstract the order in the CR but it will not be not backward compatible.
@itamar-marom if you can resolve this, we can merge it. |
I'll resolve this today/tomorrow and ping you |
ace20be
to
4d6fa37
Compare
4d6fa37
to
36614f2
Compare
@AdheipSingh ready |
Description
Code refactoring to the ordering logic. Added also tests.
This PR has:
Key changed/added files in this PR
controllers/druid/handler.go
controllers/druid/ordering.go
controllers/druid/ordering_test.go