mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
Allow Kubernetes node-name to be set from env var
If we have the node-name then we can save work requesting the list of
local pods from kubelet. And the best way to get the node name is via
the "downwards api", i.e. put this in the Daemonset Yaml:
- name: KUBERNETES_NODENAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
This commit is contained in:
@@ -428,6 +428,11 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Node name may be set by environment variable, e.g. from the Kubernetes downward API
|
||||
if flags.probe.kubernetesNodeName == "" {
|
||||
flags.probe.kubernetesNodeName = os.Getenv("KUBERNETES_NODENAME")
|
||||
}
|
||||
|
||||
if flags.dryRun {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user