-
Notifications
You must be signed in to change notification settings - Fork 11
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
[Discovery.KubernetesApi] add option to query pods in all namespaces #2421
[Discovery.KubernetesApi] add option to query pods in all namespaces #2421
Conversation
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 - nice work
# Enable to query pods in all namespaces | ||
# | ||
# If this is set to true, the pod-namespace configuration is ignored. | ||
all-namespaces = 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.
LGTM
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
|
||
var cts = new CancellationTokenSource(resolveTimeout); | ||
V1PodList podList; | ||
try | ||
{ | ||
#if !NET6_0_OR_GREATER |
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.
So we moved the ifdefs down into these individual methods - got it
@@ -89,27 +89,17 @@ public override async Task<Resolved> Lookup(Lookup lookup, TimeSpan resolveTimeo | |||
var labelSelector = _settings.PodLabelSelector(lookup.ServiceName); | |||
|
|||
if(_log.IsInfoEnabled) | |||
_log.Info("Querying for pods with label selector: [{0}]. Namespace: [{1}]. Port: [{2}]", | |||
labelSelector, PodNamespace, lookup.PortName); | |||
_log.Info("Querying for pods with label selector: [{0}]. Namespace: [{1}]. AllNamespaces: [{2}]. Port: [{3}]", |
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
@@ -177,7 +167,45 @@ public override async Task<Resolved> Lookup(Lookup lookup, TimeSpan resolveTimeo | |||
|
|||
return new Resolved(serviceName: lookup.ServiceName, addresses: addresses); | |||
} | |||
|
|||
private async Task<V1PodList> ListNamespacedPod(string labelSelector, CancellationTokenSource cts) |
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 - basically what we had before
|
||
private async Task<V1PodList> ListPodForAllNamespaces(string labelSelector, CancellationTokenSource cts) |
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
Changes
Adds a new option to query K8s Pods in all namespaces instead of querying in a specific namespace. It still supports to filter by
podSelector
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):