-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 panic on empty targets for custom resources. #1029
Conversation
Hi @arturo-c , thanks for your contribution. While your fix will definitely fix the panic, I'm not sure it would be the best change. Does it make sense to even allow an empty list of target? We should probably rather add validation to make sure that this can't happen at all. |
@Raffo Added some checks for crd validation, let me know if thats what you were thinking |
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.
lgtm @Raffo wdyt?
source/crd.go
Outdated
@@ -117,7 +117,14 @@ func (cs *crdSource) Endpoints() ([]*endpoint.Endpoint, error) { | |||
} | |||
|
|||
for _, dnsEndpoint := range result.Items { | |||
endpoints = append(endpoints, dnsEndpoint.Spec.Endpoints...) | |||
// Make sure that all endpoints have targets for A or CNAME type | |||
for _, endPoint := range dnsEndpoint.Spec.Endpoints { |
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.
Nit: please use endpoint instead of endPoint
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.
done, thanks for catching
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Raffo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #1027