Skip to content

Commit

Permalink
Log version in lighthouse pods
Browse files Browse the repository at this point in the history
Log version for Lighthoue agent and coredns pods on startup.

Fixes #1279

Signed-off-by: Vishal Thapar <[email protected]>
  • Loading branch information
vthapar authored and tpantelis committed Jun 29, 2023
1 parent 30c7abb commit 6612eba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ TARGETS := $(shell ls -p scripts | grep -v -e / -e deploy)
override E2E_ARGS += cluster1 cluster2 cluster3
override UNIT_TEST_ARGS += test/e2e
export LIGHTHOUSE = true
export LDFLAGS = -X main.version=$(VERSION)

# Targets to make

Expand Down
5 changes: 4 additions & 1 deletion coredns/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import (
_ "github.com/coredns/coredns/plugin/tls"
_ "github.com/coredns/coredns/plugin/trace"
_ "github.com/coredns/coredns/plugin/whoami"
_ "github.com/submariner-io/lighthouse/coredns/plugin"
lighthouse "github.com/submariner-io/lighthouse/coredns/plugin"
)

var directives = []string{
Expand Down Expand Up @@ -105,7 +105,10 @@ var directives = []string{
"on",
}

var version = "not-compiled-properly"

func init() {
lighthouse.Version = version
dnsserver.Directives = directives
}

Expand Down
3 changes: 2 additions & 1 deletion coredns/plugin/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
var (
masterURL string
kubeconfig string
Version string
)

// Hooks for unit tests.
Expand Down Expand Up @@ -70,7 +71,7 @@ func init() {
// setup is the function that gets called when the config parser see the token "lighthouse". Setup is responsible
// for parsing any extra options the this plugin may have. The first token this function sees is "lighthouse".
func setupLighthouse(c *caddy.Controller) error {
log.Debug("In setupLighthouse")
log.Infof("submariner-lighthouse-coredns version: %v", Version)

l, err := lighthouseParse(c)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var (
kubeConfig string
help = false
logger = log.Logger{Logger: logf.Log.WithName("main")}
version = "not-compiled-properly"
)

func init() {
Expand Down Expand Up @@ -111,7 +112,7 @@ func main() {
localClient, err := dynamic.NewForConfig(cfg)
exitOnError(err, "Error creating dynamic client")

logger.Info("Starting submariner-lighthouse-agent")
logger.Infof("submariner-lighthouse-agent version: %v", version)

// set up signals so we handle the first shutdown signal gracefully
ctx := signals.SetupSignalHandler()
Expand Down

0 comments on commit 6612eba

Please sign in to comment.