-
Notifications
You must be signed in to change notification settings - Fork 332
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(hostnamegenerator): selectors validation and matching #10688
fix(hostnamegenerator): selectors validation and matching #10688
Conversation
Signed-off-by: Jakub Dyszkiewicz <[email protected]>
pkg/core/resources/apis/hostnamegenerator/api/v1alpha1/hostnamegenerator.go
Outdated
Show resolved
Hide resolved
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 assume we use merge release to master
to sync the change?
Signed-off-by: Jakub Dyszkiewicz <[email protected]>
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 nits
selectorsDefined++ | ||
} | ||
if selectorsDefined != 1 { | ||
verr.AddViolationAt(path, "exact one selector (meshService, meshExternalService) must be defined") |
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.
nitpick:
verr.AddViolationAt(path, "exact one selector (meshService, meshExternalService) must be defined") | |
verr.AddViolationAt(path, "exactly one selector (meshService, meshExternalService) must be defined") |
ErrorCase("spec.selector empty", | ||
validators.Violation{ | ||
Field: `spec.selector`, | ||
Message: `exact one selector (meshService, meshExternalService) must be defined`, |
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.
Message: `exact one selector (meshService, meshExternalService) must be defined`, | |
Message: `exactly one selector (meshService, meshExternalService) must be defined`, |
ErrorCase("spec.selector has too many selectors", | ||
validators.Violation{ | ||
Field: `spec.selector`, | ||
Message: `exact one selector (meshService, meshExternalService) must be defined`, |
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.
Message: `exact one selector (meshService, meshExternalService) must be defined`, | |
Message: `exactly one selector (meshService, meshExternalService) must be defined`, |
Checklist prior to review
I noticed a bug when implementing hostnames for MeshMultiZoneService.
If we define this HostnameGenerator
It also selects MeshExternalServices.
It does not make sense to have one HostnameGenerator for MeshExternalService, MeshService, so we should require exact one field in Selectors.
Additionally,
MeshService
andMeshExternalService
fields were not pointers so it was impossible to distinguishfrom
I also added builders, but not samples because we are still unsure what good default values are.
syscall.Mkfifo
have equivalent implementation on the other OS --ci/
labels to run additional/fewer testsUPGRADE.md
? --