-
Notifications
You must be signed in to change notification settings - Fork 20
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
Introduce multiple service group categories and maximumMaxReplicas for each of them #428
base: main
Are you sure you want to change the base?
Conversation
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.
initial review path
pkg/hpa/service_test.go
Outdated
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.
You haven't added any tests for this enhancement. Please always make sure you add a test for every change basically. In this case, you have to add test cases at TestClient_UpdateHPAFromTortoiseRecommendation
.
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.
Yes, I am still working on the tests.
343c435
to
00134fe
Compare
d6b89b9
to
c15336c
Compare
|
||
// Ensure ServiceGroupNames in MaximumMaxReplicas match defined ServiceGroups | ||
serviceGroupMap := make(map[string]bool) | ||
for _, sg := range config.ServiceGroups { |
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.
for _, sg := range config.ServiceGroups { | |
for _, sg := range config.ServiceGroups { | |
if sg.Name == "" { | |
return fmt.Errorf("Name of the service group should not be empty") | |
} |
if seenServiceGroups[sg.Name] { | ||
return fmt.Errorf("duplicate ServiceGroupName found: %s", sg.Name) | ||
} |
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 duplicate check can be done in the above loop at L388.
|
||
// Check all entries in MaximumMaxReplicasPerService have non-nil ServiceGroupName | ||
for _, maxReplicas := range config.MaximumMaxReplicasPerService { | ||
if maxReplicas.ServiceGroupName == "" { |
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 empty check could be done in the above loop at 393.
if config.MaximumMinReplicas > minOfMaximumMaxReplicas { | ||
return fmt.Errorf("MaximumMinReplicas should be less than or equal to MaximumMaxReplicas") | ||
} | ||
if config.PreferredMaxReplicas >= int(config.MaximumMaxReplicas) { | ||
if config.PreferredMaxReplicas >= int(minOfMaximumMaxReplicas) { |
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.
I think config.MaximumMaxReplicas
and minOfMaximumMaxReplicas
should be validated with PreferredMaxReplicas
and MaximumMinReplicas
separately for better error messages.
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.
you should add test cases for all validations that you added.
klog.InfoS("Namespace matched", "serviceGroup", serviceGroup.Name, "namespace", tortoiseNamespace) | ||
return serviceGroup.Name | ||
} | ||
// TODO(avs): Add logic for matching labels in the future. |
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.
Why not within this PR? If you meant not to implement this within this PR, you should remove LabelSelector support from the config for now. (and add the one when you actually implement logic
code Implementation of this Issue: #426
Introduces:
default, fintech-service, critical-service, etc
maximumMaxReplicas
value one for each of the service-categories mentioned above