Skip to content

Commit eda73d5

Browse files
committed
Past node name to labeller via env var
1 parent 2113ab2 commit eda73d5

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

cmd/k8s-node-labeller/main.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,7 @@ func main() {
293293
}
294294

295295
// laballer only respond to event about the node it is on by matching hostname
296-
b, err := ioutil.ReadFile("/labeller/hostname")
297-
if err != nil {
298-
entryLog.Error(err, "Cannot read hostname")
299-
}
300-
hostname := strings.TrimSpace(string(b))
296+
hostname := os.Getenv("DS_NODE_NAME")
301297

302298
pred := predicate.Funcs{
303299
// Create returns true if the Create event should be processed

k8s-ds-amdgpu-labeller.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ spec:
4949
containers:
5050
- image: rocm/k8s-device-plugin:labeller-latest
5151
name: amdgpu-lr-cntr
52+
imagePullPolicy: Always
5253
workingDir: /root
5354
command: ["./k8s-node-labeller"]
5455
args: ["-vram", "-cu-count", "-simd-count", "-device-id", "-family"]
56+
env:
57+
- name: DS_NODE_NAME
58+
valueFrom:
59+
fieldRef:
60+
fieldPath: spec.nodeName
5561
securityContext:
5662
privileged: true #Needed for /dev
5763
capabilities:
@@ -61,15 +67,10 @@ spec:
6167
mountPath: /sys
6268
- name: dev
6369
mountPath: /dev
64-
- name: etc
65-
mountPath: /labeller
6670
volumes:
6771
- name: sys
6872
hostPath:
6973
path: /sys
7074
- name: dev
7175
hostPath:
7276
path: /dev
73-
- name: etc
74-
hostPath:
75-
path: /etc

0 commit comments

Comments
 (0)