Skip to content

Commit

Permalink
main: log self-pod name only if exists
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
synarete committed May 22, 2024
1 parent df1c424 commit 77e33ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func main() {
vers, _ := metrics.ResolveVersions(nil)
log.Info("Versions", "Versions", vers)

log.Info("Self", "PodID", metrics.GetSelfPodID())
podid := metrics.GetSelfPodID()
if len(podid.Name) > 0 {
log.Info("Self", "PodID", podid)
}

loc, err := metrics.LocateSMBStatus()
if err != nil {
Expand Down

0 comments on commit 77e33ff

Please sign in to comment.