feat(source/pod): add support for fqdn templating#5512
feat(source/pod): add support for fqdn templating#5512k8s-ci-robot merged 11 commits intokubernetes-sigs:masterfrom
Conversation
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
|
Hi @vflaux wdyt to review this feature? Probably worth to have a look, there is one test, and it seems bit flakey #5470 (comment) Never seen it before the refactoring. |
possibly flaky test is fixed #5514, we will see it |
source/pod_test.go
Outdated
| // if tc.expectedDebugMsgs != nil { | ||
| // for _, expectedMsg := range tc.expectedDebugMsgs { | ||
| // testutils.TestHelperLogContains(expectedMsg, hook, t) | ||
| // } | ||
| // } else { | ||
| // require.Empty(t, hook.AllEntries(), "Expected no debug messages") | ||
| // } |
There was a problem hiding this comment.
Should this still be commented?
There was a problem hiding this comment.
Nice one. Need to uncomment this
There was a problem hiding this comment.
Yeah. There were a bug, fixed in this pr #5514. Merged with master
source/pod_test.go
Outdated
|
|
||
| // for _, ep := range endpoints { | ||
| // // TODO: source should always set the resource label key. currently not supported by the pod source. | ||
| // assert.Empty(t, ep.Labels, "Labels should not be empty for endpoint %s", ep.DNSName) | ||
| // assert.NotContains(t, ep.Labels, endpoint.ResourceLabelKey) | ||
| // } |
There was a problem hiding this comment.
Should this still be commented?
Maybe use require instead of assert?
There was a problem hiding this comment.
changed to require
| } | ||
|
|
||
| func (*podSource) AddEventHandler(ctx context.Context, handler func()) { | ||
| func (*podSource) AddEventHandler(_ context.Context, _ func()) { |
There was a problem hiding this comment.
Out of curiosity, do you know why this function does nothing? (Other sources often add the handler to informers)
There was a problem hiding this comment.
Yeah. We need to fix that as well. Related PR #5274
We need to review and fix all the handlers. It's a useful feature. I'm not too sure how it differ from adding handlers in constructur, that the only gotcha
source/pod.go
Outdated
| } | ||
|
|
||
| endpointMap := make(map[endpoint.EndpointKey][]string) | ||
| fqdnEndpointMap := make(map[endpoint.EndpointKey][]string) |
There was a problem hiding this comment.
Is this map there to ensure the fqdn endpoints get priority over pod endpoints by adding them to endpointMap at the end? Or we could copy directly into endpointMap without it?
There was a problem hiding this comment.
I can try to copy. The code could be slightly more complex. As currently we could merge them at the end. Do you want me try to re-use single map?
The main challange I experience, is that ps.addPodEndpointsToEndpointMap(endpointMap, pod) actually modify same map. But still possible
There was a problem hiding this comment.
done. removed fqdn map, and we are using single map
source/pod.go
Outdated
| if ps.fqdnTemplate != nil { | ||
| fqdnHosts, err := ps.hostsFromTemplate(pod) | ||
| if err != nil { | ||
| log.Debug(err) |
There was a problem hiding this comment.
Shouldn't this be a warning at least? Or this is expected to "silently" ignore errors?
There was a problem hiding this comment.
Someone may decide to use FQDN with {{ .PodSpec.PodDNSConfig }}, one pod could have it, the other pod not necessary. We may have too many warnings. No prference, shell I change it to warn?
There was a problem hiding this comment.
I've looked at other Sources and they return the error directly.
I'm not sure what is the best thing to do here.
There was a problem hiding this comment.
Make sense. I'll do the same then
There was a problem hiding this comment.
Changed to return error directly as in others.
|
@vflaux: changing LGTM is restricted to collaborators DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
* master: test(source): fix flaky test (kubernetes-sigs#5514) chore(source/node): added resouce labels for nodes (kubernetes-sigs#5509) chore(deps): bump the dev-dependencies group across 1 directory with 14 updates (kubernetes-sigs#5511) fix(ovh): correct handling of records deletion (kubernetes-sigs#5450)
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Co-authored-by: vflaux <38909103+vflaux@users.noreply.github.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
|
@vflaux: changing LGTM is restricted to collaborators DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/assign @mloiseleur |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mloiseleur, vflaux The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Co-authored-by: Michel Loiseleur <97035654+mloiseleur@users.noreply.github.com>
|
/lgtm |
|
@ivankatliarchuk: you cannot LGTM your own PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
…t-for-fqdn' into feat-pod-add-support-for-fqdn * refs/remotes/origin/feat-pod-add-support-for-fqdn: feat(source/pod): add support for fqdn templating
|
/lgtm |
What does it do ?
Motivation
Worth to add support for FQDN templating for pods. Similar to nodes
Quite useful for debugging and create on the fly DNS records based on different pod spec or annotations without the need to restart/reboot them or apply any other sources.
What else I found, pod source does not support
external-dns/source/pod.go
Line 167 in 3e0c509
More