Skip to content

Commit 7d8b908

Browse files
authored
fix: print version info when starting (#1013)
1 parent 247b89e commit 7d8b908

File tree

7 files changed

+14
-5
lines changed

7 files changed

+14
-5
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
SHELL:=/bin/bash
22

3+
PACKAGE=github.com/numaproj/numaflow
34
CURRENT_DIR=$(shell pwd)
45
DIST_DIR=${CURRENT_DIR}/dist
56
BINARY_NAME:=numaflow

cmd/commands/daemon_server.go

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/spf13/cobra"
2626
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
2727

28+
"github.com/numaproj/numaflow"
2829
"github.com/numaproj/numaflow/pkg/apis/numaflow/v1alpha1"
2930
"github.com/numaproj/numaflow/pkg/daemon/server"
3031
"github.com/numaproj/numaflow/pkg/shared/logging"
@@ -44,6 +45,7 @@ func NewDaemonServerCommand() *cobra.Command {
4445
return fmt.Errorf("failed to decode the pipeline spec: %v", err)
4546
}
4647
logger := logging.NewLogger().Named("daemon-server").With("pipeline", pl.Name)
48+
logger.Infow("Starting daemon server", "version", numaflow.GetVersion())
4749
ctx := logging.WithLogger(signals.SetupSignalHandler(), logger)
4850
server := server.NewDaemonServer(pl, v1alpha1.ISBSvcType(isbSvcType))
4951
return server.Run(ctx)

cmd/commands/processor.go

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/spf13/cobra"
2727
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
2828

29+
"github.com/numaproj/numaflow"
2930
dfv1 "github.com/numaproj/numaflow/pkg/apis/numaflow/v1alpha1"
3031
"github.com/numaproj/numaflow/pkg/shared/logging"
3132
"github.com/numaproj/numaflow/pkg/sinks"
@@ -44,6 +45,7 @@ func NewProcessorCommand() *cobra.Command {
4445
Short: "Start a processor",
4546
RunE: func(cmd *cobra.Command, args []string) error {
4647
log := logging.NewLogger().Named(fmt.Sprintf("%s-processor", processorType))
48+
log.Infow("Starting vertex data processor", "version", numaflow.GetVersion())
4749
encodedVertex, defined := os.LookupEnv(dfv1.EnvVertexObject)
4850
if !defined {
4951
return fmt.Errorf("required environment variable '%s' not defined", dfv1.EnvVertexObject)

cmd/commands/side_inputs_manager.go

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/spf13/cobra"
2626
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
2727

28+
"github.com/numaproj/numaflow"
2829
dfv1 "github.com/numaproj/numaflow/pkg/apis/numaflow/v1alpha1"
2930
"github.com/numaproj/numaflow/pkg/shared/logging"
3031
"github.com/numaproj/numaflow/pkg/sideinputs/manager"
@@ -58,6 +59,7 @@ func NewSideInputsManagerCommand() *cobra.Command {
5859
}
5960

6061
logger := logging.NewLogger().Named("side-inputs-manager").With("pipeline", pipelineName)
62+
logger.Infow("Starting side inputs manager", "version", numaflow.GetVersion())
6163

6264
ctx := logging.WithLogger(signals.SetupSignalHandler(), logger)
6365
sideInputManager := manager.NewSideInputsManager(dfv1.ISBSvcType(isbSvcType), pipelineName, sideInputsStore, sideInput)

server/cmd/start.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/gin-contrib/static"
2626
"github.com/gin-gonic/gin"
2727

28+
"github.com/numaproj/numaflow"
2829
"github.com/numaproj/numaflow/pkg/shared/logging"
2930
sharedtls "github.com/numaproj/numaflow/pkg/shared/tls"
3031
"github.com/numaproj/numaflow/server/routes"
@@ -55,7 +56,7 @@ func Start(insecure bool, port int, namespaced bool, managedNamespace string, ba
5556
}
5657

5758
if insecure {
58-
logger.Infof("Starting server (TLS disabled) on %s", server.Addr)
59+
logger.Infow("Starting server (TLS disabled) on "+server.Addr, "version", numaflow.GetVersion())
5960
if err := server.ListenAndServe(); err != nil {
6061
panic(err)
6162
}
@@ -66,7 +67,7 @@ func Start(insecure bool, port int, namespaced bool, managedNamespace string, ba
6667
}
6768
server.TLSConfig = &tls.Config{Certificates: []tls.Certificate{*cert}, MinVersion: tls.VersionTLS12}
6869

69-
logger.Infof("Starting server on %s", server.Addr)
70+
logger.Infow("Starting server on "+server.Addr, "version", numaflow.GetVersion())
7071
if err := server.ListenAndServeTLS("", ""); err != nil {
7172
panic(err)
7273
}

version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type Version struct {
4545

4646
// String outputs the version as a string
4747
func (v Version) String() string {
48-
return v.Version
48+
return fmt.Sprintf(`Version: %s, BuildDate: %s, GitCommit: %s, GitTag: %s, GitTreeState: %s, GoVersion: %s, Compiler: %s, Platform: %s`, v.Version, v.BuildDate, v.GitCommit, v.GitTag, v.GitTreeState, v.GoVersion, v.Compiler, v.Platform)
4949
}
5050

5151
// GetVersion returns the version information

webhook/cmd/start.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"k8s.io/client-go/tools/clientcmd"
3030
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
3131

32+
"github.com/numaproj/numaflow"
3233
dfv1 "github.com/numaproj/numaflow/pkg/apis/numaflow/v1alpha1"
3334
"github.com/numaproj/numaflow/pkg/client/clientset/versioned"
3435
"github.com/numaproj/numaflow/pkg/shared/logging"
@@ -76,7 +77,7 @@ func Start() {
7677
portStr := sharedutil.LookupEnvStringOr(portEnvVar, "443")
7778
port, err := strconv.Atoi(portStr)
7879
if err != nil {
79-
logger.Fatal("port should be a number, not valid")
80+
logger.Fatal("Port should be a number, not valid")
8081
}
8182

8283
options := webhook.Options{
@@ -99,9 +100,9 @@ func Start() {
99100
},
100101
Logger: logger,
101102
}
103+
logger.Infow("Starting admission controller", "version", numaflow.GetVersion())
102104
ctx := logging.WithLogger(signals.SetupSignalHandler(), logger)
103105
if err := controller.Run(ctx); err != nil {
104106
logger.Fatalw("Failed to create admission controller", zap.Error(err))
105107
}
106-
107108
}

0 commit comments

Comments
 (0)