Skip to content

Commit 9392eb9

Browse files
committed
operator: include version information in the router too
1 parent 096b27a commit 9392eb9

File tree

5 files changed

+20
-33
lines changed

5 files changed

+20
-33
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ RUN --mount=type=cache,target=/opt/app-root/src/go/pkg/mod,sharing=locked,uid=10
3434
-o manager cmd/main.go
3535
RUN --mount=type=cache,target=/opt/app-root/src/go/pkg/mod,sharing=locked,uid=1001,gid=0 \
3636
--mount=type=cache,target=/opt/app-root/src/.cache/go-build,sharing=locked,uid=1001,gid=0 \
37-
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o router cmd/router/main.go
37+
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} \
38+
go build -a \
39+
-ldflags "-X main.version=${GIT_VERSION} -X main.gitCommit=${GIT_COMMIT} -X main.buildDate=${BUILD_DATE}" \
40+
-o router cmd/router/main.go
3841

3942
FROM registry.access.redhat.com/ubi9/ubi-micro:9.5
4043
WORKDIR /

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ build-operator:
102102
.PHONY: build
103103
build: manifests generate fmt vet ## Build manager binary.
104104
go build -ldflags "$(LDFLAGS)" -o bin/manager cmd/main.go
105-
go build -o bin/router cmd/router/main.go
105+
go build -ldflags "$(LDFLAGS)" -o bin/router cmd/router/main.go
106106

107107
.PHONY: run
108108
run: manifests generate fmt vet ## Run a controller from your host.

cmd/router/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ import (
3434
_ "google.golang.org/grpc/encoding/gzip"
3535
)
3636

37+
var (
38+
// Version information - set via ldflags at build time
39+
version = "dev"
40+
gitCommit = "unknown"
41+
buildDate = "unknown"
42+
)
43+
3744
func main() {
3845
opts := zap.Options{}
3946
opts.BindFlags(flag.CommandLine)
@@ -44,6 +51,13 @@ func main() {
4451
logger := ctrl.Log.WithName("router")
4552
ctx := logr.NewContext(context.Background(), logger)
4653

54+
// Print version information
55+
logger.Info("Jumpstarter Router starting",
56+
"version", version,
57+
"gitCommit", gitCommit,
58+
"buildDate", buildDate,
59+
)
60+
4761
cfg := ctrl.GetConfigOrDie()
4862
client, err := kclient.New(cfg, kclient.Options{})
4963
if err != nil {

deploy/operator/internal/utils/maps.go

Lines changed: 0 additions & 30 deletions
This file was deleted.

hack/deploy_with_operator.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source "${SCRIPT_DIR}/deploy_vars"
1111
kubectl config use-context kind-jumpstarter
1212

1313
# Install nginx ingress if in ingress mode
14-
if [ "${INGRESS_ENABLED}" == "true" ]; then
14+
if [ "${NETWORKING_MODE}" = "ingress" ]; then
1515
install_nginx_ingress
1616
else
1717
echo -e "${GREEN}Deploying with nodeport ...${NC}"

0 commit comments

Comments
 (0)