-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
fix auto_allocate validation message to account for v2 ip auto allocation #52422
Conversation
…roller is enabled and service entry did not opt out Signed-off-by: ilrudie <ian.rudie@solo.io>
@@ -2777,6 +2777,15 @@ var ValidateServiceEntry = RegisterValidateFunc("ValidateServiceEntry", | |||
} | |||
} | |||
|
|||
// check for v2 auto IP allocation or opt-out by user |
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'm assuming we have identical logic elsewhere. Can we rely on a util function?
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.
very good point. such a function does already exist
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.
ooof, that produces a cyclic import so I'll need to circle back on that
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 moved the location of the helper functions to a new location in order to resolve the cyclic imports. @stevenctl, Can you take a look at if where I landed it is appropriate?
6c122a6
to
1b2160f
Compare
pkg/config/validation/validation.go
Outdated
if features.EnableIPAutoallocate { | ||
v, ok := cfg.Meta.Labels[constants.EnableV2AutoAllocationLabel] | ||
if !ok || !strings.EqualFold(v, "false") { | ||
autoAllocation = true |
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.
Just to make sure I'm clear on the logic, if EnableV2AutoAllocationLabel label is false
, then autoAllocation is true
? Why would it not be if EnableV2AutoAllocationLabel label is true
, then autoAllocation is true
?
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.
there is a !
before the EqualFold so the logic is labelValue != false
.
Generally Steven's comment to re-use the logic used elsewhere probably makes the most sense whenever I have time to resolve the cyclic import issue.
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.
Oh duh, I overlooked that. Makes sense then. Thank you for clarifying!
Signed-off-by: ilrudie <ian.rudie@solo.io>
17a4a05
to
f4c9e43
Compare
Signed-off-by: ilrudie <ian.rudie@solo.io>
f4c9e43
to
2c63baf
Compare
/retest |
In response to a cherrypick label: new pull request created: #52460 |
Please provide a description of this PR:
suppress auto_allocate message in validation if auto-allocate ip controller is enabled and service entry did not opt out
fixes #52420