1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-28 10:47:23 +00:00

Merge pull request #1218 from marquiz/devel/configz-uri

topology-updater: use node IP in the default configz URI
This commit is contained in:
Kubernetes Prow Robot 2023-05-05 04:05:12 -07:00 committed by GitHub
commit ef92b2f606
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 5 deletions

View file

@ -112,12 +112,13 @@ func parseArgs(flags *flag.FlagSet, osArgs ...string) (*topology.Args, *resource
}
if len(resourcemonitorArgs.KubeletConfigURI) == 0 {
if len(utils.NodeName()) == 0 {
fmt.Fprintf(flags.Output(), "unable to determine the default kubelet config endpoint 'https://${NODE_NAME}:%d/configz' due to empty NODE_NAME environment, "+
"please either define the NODE_NAME environment variable or specify endpoint with the -kubelet-config-uri flag\n", kubeletSecurePort)
nodeAddress := os.Getenv("NODE_ADDRESS")
if len(nodeAddress) == 0 {
fmt.Fprintf(flags.Output(), "unable to determine the default kubelet config endpoint 'https://${NODE_ADDRESS}:%d/configz' due to empty NODE_ADDRESS environment, "+
"please either define the NODE_ADDRESS environment variable or specify endpoint with the -kubelet-config-uri flag\n", kubeletSecurePort)
os.Exit(1)
}
resourcemonitorArgs.KubeletConfigURI = fmt.Sprintf("https://%s:%d/configz", utils.NodeName(), kubeletSecurePort)
resourcemonitorArgs.KubeletConfigURI = fmt.Sprintf("https://%s:%d/configz", nodeAddress, kubeletSecurePort)
}
return args, resourcemonitorArgs

View file

@ -0,0 +1,7 @@
- op: add
path: "/spec/template/spec/containers/0/env/-"
value:
name: NODE_ADDRESS
valueFrom:
fieldRef:
fieldPath: status.hostIP

View file

@ -14,3 +14,7 @@ patches:
target:
labelSelector: app=nfd
name: nfd-topology-updater
- path: env.yaml
target:
labelSelector: app=nfd
name: nfd-topology-updater

View file

@ -37,6 +37,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: NODE_ADDRESS
valueFrom:
fieldRef:
fieldPath: status.hostIP
command:
- "nfd-topology-updater"
args:

View file

@ -109,7 +109,7 @@ nfd-topology-updater -watch-namespace=rte
The `-kubelet-config-uri` specifies the path to the Kubelet's configuration.
Note that the URi could either be a local host file or an HTTP endpoint.
Default: `https://${NODE_NAME}:10250/configz`
Default: `https://${NODE_ADDRESS}:10250/configz`
Example: