Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Compatible Kubernetes to Version Printout #2446

Merged
merged 14 commits into from
Mar 27, 2020
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ endif

VERSION = $(shell git describe --dirty --tags --always)
GIT_COMMIT = $(shell git rev-parse HEAD)
K8S_VERSION = v1.16.3
joelanford marked this conversation as resolved.
Show resolved Hide resolved
REPO = github.com/operator-framework/operator-sdk
BUILD_PATH = $(REPO)/cmd/operator-sdk
estroz marked this conversation as resolved.
Show resolved Hide resolved
PKGS = $(shell go list ./... | grep -v /vendor/)
Expand Down Expand Up @@ -54,6 +55,7 @@ install: ## Build & install the Operator SDK CLI binary
-ldflags " \
-X '${REPO}/version.GitVersion=${VERSION}' \
-X '${REPO}/version.GitCommit=${GIT_COMMIT}' \
-X '${REPO}/version.KubernetesVendorVersion=${K8S_VERSION}' \
theishshah marked this conversation as resolved.
Show resolved Hide resolved
" \
$(BUILD_PATH)

Expand Down
2 changes: 1 addition & 1 deletion cmd/operator-sdk/version/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewCmd() *cobra.Command {
if version == "unknown" {
version = ver.Version
}
fmt.Printf("operator-sdk version: %q, commit: %q, go version: %q\n", version, ver.GitCommit, ver.GoVersion)
fmt.Printf("operator-sdk version: %q, commit: %q, kubernetes version: %q, go version: %q\n", version, ver.GitCommit, ver.KubernetesVersion, ver.GoVersion)
},
}
return versionCmd
Expand Down
10 changes: 6 additions & 4 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import (
"runtime"
)

//var needs to be used instead of const for ldflags
var (
Version = "v0.15.0+git"
GitVersion = "unknown"
GitCommit = "unknown"
GoVersion = fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH)
Version = "v0.14.0+git"
GitVersion = "unknown"
GitCommit = "unknown"
KubernetesVersion = "unknown"
GoVersion = fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH)
)