mirror of
https://github.com/malarinv/iperf3-monitor.git
synced 2026-03-08 05:22:35 +00:00
Compare commits
2 Commits
v0.2.2
...
fix/iperf3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
229f5bd8c3 | ||
| 966985dc3e |
@@ -77,7 +77,7 @@ Proceed with modifications only if the exporter controller is defined.
|
||||
{{- if $exporterContainerCfg -}}
|
||||
{{- if not $exporterContainerCfg.image.tag -}}
|
||||
{{- if $chart.AppVersion -}}
|
||||
{{- $_ := set $exporterContainerCfg.image "tag" $chart.AppVersion -}}
|
||||
{{- $_ := set $exporterContainerCfg.image "tag" (printf "v%s" $chart.AppVersion) -}}
|
||||
{{- else -}}
|
||||
{{- fail (printf "Error: Container image tag is not specified for controller '%s', container '%s', and Chart.AppVersion is also empty." $exporterControllerKey "exporter") -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -92,16 +92,18 @@ def discover_iperf_servers():
|
||||
|
||||
logging.info(f"Discovering iperf3 servers with label '{label_selector}' in namespace '{namespace}'")
|
||||
|
||||
ret = v1.list_pod_for_all_namespaces(label_selector=label_selector, watch=False)
|
||||
# Use list_namespaced_pod to query only the specified namespace
|
||||
ret = v1.list_namespaced_pod(namespace=namespace, label_selector=label_selector, watch=False)
|
||||
|
||||
servers = []
|
||||
for item in ret.items:
|
||||
# No need to filter by namespace here as the API call is already namespaced
|
||||
if item.status.pod_ip and item.status.phase == 'Running':
|
||||
servers.append({
|
||||
'ip': item.status.pod_ip,
|
||||
'node_name': item.spec.node_name # Node where the iperf server pod is running
|
||||
})
|
||||
logging.info(f"Discovered {len(servers)} iperf3 server pods.")
|
||||
logging.info(f"Discovered {len(servers)} iperf3 server pods in namespace '{namespace}'.")
|
||||
return servers
|
||||
except config.ConfigException as e:
|
||||
logging.error(f"Kubernetes config error: {e}. Is the exporter running in a cluster with RBAC permissions?")
|
||||
|
||||
Reference in New Issue
Block a user