Skip to content

Commit

Permalink
Merge pull request #245 from yevgeny-shnaidman/yevgeny/pod-name-pod-u…
Browse files Browse the repository at this point in the history
…id-env

Adding POD_NAME and POD_UID env variable to daemonsets
  • Loading branch information
k8s-ci-robot authored Jul 15, 2024
2 parents a424671 + 823d723 commit f3b2307
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/daemonset/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ func getWorkerEnvs() []corev1.EnvVar {
},
},
},
{
Name: "POD_NAME",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "metadata.name",
},
},
},
{
Name: "POD_UID",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "metadata.uid",
},
},
},
}
}

Expand Down
8 changes: 8 additions & 0 deletions internal/daemonset/testdata/test_topology_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: NODE_ADDRESS
valueFrom:
fieldRef:
Expand Down
8 changes: 8 additions & 0 deletions internal/daemonset/testdata/test_worker_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
image: test-image
imagePullPolicy: Always
name: nfd-worker
Expand Down

0 comments on commit f3b2307

Please sign in to comment.