From 8bdf4e2abfc16d54e9b2fd84345929197f518442 Mon Sep 17 00:00:00 2001 From: Alexandre Perrin Date: Fri, 12 Mar 2021 15:14:38 +0100 Subject: [PATCH] version: report the cilium images version Signed-off-by: Alexandre Perrin --- defaults/defaults.go | 5 +++++ internal/cli/cmd/version.go | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/defaults/defaults.go b/defaults/defaults.go index a92705ada5..d14b4b0297 100644 --- a/defaults/defaults.go +++ b/defaults/defaults.go @@ -117,3 +117,8 @@ var ( // CiliumPodSelector is the pod selector to be used for the Cilium agents. CiliumPodSelector = "k8s-app=cilium" ) + +// CiliumVersion return the default Cilium version used by the cli. +func CiliumVersion() string { + return Version +} diff --git a/internal/cli/cmd/version.go b/internal/cli/cmd/version.go index d4bcae3787..dab92851b4 100644 --- a/internal/cli/cmd/version.go +++ b/internal/cli/cmd/version.go @@ -18,6 +18,8 @@ import ( "fmt" "runtime" + "github.com/cilium/cilium-cli/defaults" + "github.com/spf13/cobra" ) @@ -44,8 +46,9 @@ func newCmdVersion() *cobra.Command { case GitHash != "": gitInfo = fmt.Sprintf("@%s", GitHash) } - // TODO: add support for reporting the Cilium version - fmt.Printf("cilium-cli: v%s%s compiled with %v on %v/%v\n", Version, gitInfo, runtime.Version(), runtime.GOOS, runtime.GOARCH) + // TODO: add support for reporting the Cilium version running in + // the cluster, if any. + fmt.Printf("cilium-cli: v%s%s (%s images) compiled with %v on %v/%v\n", Version, gitInfo, defaults.CiliumVersion(), runtime.Version(), runtime.GOOS, runtime.GOARCH) }, } }