Skip to content
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

Merged
merged 3 commits into from
Apr 29, 2022
Merged

Add validation on for VSPs #369

merged 3 commits into from
Apr 29, 2022

Conversation

nrosenberg1
Copy link

No description provided.

@nrosenberg1 nrosenberg1 requested review from a team as code owners April 29, 2022 18:39
@nrosenberg1 nrosenberg1 requested review from eytan-avisror and nvandanapu and removed request for a team April 29, 2022 18:39
return errors.Errorf("validation failed, no policies defined for scale up behavior in spec")
}

validPolicyTypes := []UtilizationType{CPUUtilizationPercent, MemoryUtilizationPercent, NodesCountUtilizationPercent}
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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 {
}

@nrosenberg1 nrosenberg1 merged commit 545830c into vna Apr 29, 2022
@nrosenberg1 nrosenberg1 deleted the vna-validate branch April 29, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants