-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add validation on for VSPs #369
Conversation
return errors.Errorf("validation failed, no policies defined for scale up behavior in spec") | ||
} | ||
|
||
validPolicyTypes := []UtilizationType{CPUUtilizationPercent, MemoryUtilizationPercent, NodesCountUtilizationPercent} |
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.
can you make this a constant outside this function?
if !isValidUtilizationType(validPolicyTypes, policy.Type) { | ||
return errors.Errorf("validation failed, invalid policy type %s in scale up behaviors, valid types are: %s", policy.Type, validPolicyTypes) | ||
} | ||
if policy.Type == CPUUtilizationPercent || policy.Type == MemoryUtilizationPercent { |
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.
How about something like if strings.Contains("Percent", policy.Type)
instead? To avoid changing code in future when we have more policyTypes
@@ -153,3 +154,59 @@ func (status *VerticalScalingPolicyStatus) SetCondition(igName string, condition | |||
func (status *VerticalScalingPolicyStatus) SetConditions(igName string, conditions []*UtilizationCondition) { | |||
status.TargetStatuses[igName].Conditions = conditions | |||
} | |||
|
|||
func (vsp *VerticalScalingPolicy) Validate() error { |
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.
func (vsp *VerticalScalingPolicy) Validate() error {
}
func (spec *VerticalScalingPolicySpec) Validate() error {
}
func (scalingSpec *ScalingSpec) Validate() error {
}
func (policySpec *PolicySpec) Validate() error {
}
No description provided.