Skip to content

Commit 1bc78f0

Browse files
committed
Add the POD_UID to the event so that it appears in kubectl describe
Signed-off-by: Richard Wall <[email protected]>
1 parent 0bd7e29 commit 1bc78f0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

deploy/charts/venafi-kubernetes-agent/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ spec:
9898
valueFrom:
9999
fieldRef:
100100
fieldPath: metadata.name
101+
- name: POD_UID
102+
valueFrom:
103+
fieldRef:
104+
fieldPath: metadata.uid
101105
{{- if .Values.metrics.enabled }}
102106
ports:
103107
- containerPort: 8081

pkg/agent/run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
corev1 "k8s.io/api/core/v1"
2222
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
"k8s.io/apimachinery/pkg/runtime"
24+
"k8s.io/apimachinery/pkg/types"
2425
"k8s.io/client-go/kubernetes"
2526
clientgocorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
2627
"k8s.io/client-go/tools/record"
@@ -231,7 +232,7 @@ func newEventf(installNS string) (Eventf, error) {
231232
broadcaster.StartRecordingToSink(&clientgocorev1.EventSinkImpl{Interface: eventClient.CoreV1().Events(installNS)})
232233
eventRec := broadcaster.NewRecorder(scheme, corev1.EventSource{})
233234
eventf = func(eventType, reason, msg string, args ...interface{}) {
234-
eventRec.Eventf(&corev1.Pod{ObjectMeta: v1.ObjectMeta{Name: podName, Namespace: installNS}}, eventType, reason, msg, args...)
235+
eventRec.Eventf(&corev1.Pod{ObjectMeta: v1.ObjectMeta{Name: podName, Namespace: installNS, UID: types.UID(os.Getenv("POD_UID"))}}, eventType, reason, msg, args...)
235236
}
236237
}
237238

0 commit comments

Comments
 (0)