Skip to content

Commit 77e33ff

Browse files
committed
main: log self-pod name only if exists
When running under k8s (via samba-operator), the pod's name is populated via SAMBA_POD_NAME env variable. However, when running as stand-alone application it may not be set; avoid confusing logging when this is the case. Signed-off-by: Shachar Sharon <[email protected]>
1 parent df1c424 commit 77e33ff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ func main() {
3131
vers, _ := metrics.ResolveVersions(nil)
3232
log.Info("Versions", "Versions", vers)
3333

34-
log.Info("Self", "PodID", metrics.GetSelfPodID())
34+
podid := metrics.GetSelfPodID()
35+
if len(podid.Name) > 0 {
36+
log.Info("Self", "PodID", podid)
37+
}
3538

3639
loc, err := metrics.LocateSMBStatus()
3740
if err != nil {

0 commit comments

Comments
 (0)