blob: 8c8350d13b77c410a65a30174a39d2e332b6e925 [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
2Copyright 2014 The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17package version
18
19import (
20 "fmt"
21 "runtime"
22
23 apimachineryversion "k8s.io/apimachinery/pkg/version"
24)
25
26// Get returns the overall codebase version. It's for detecting
27// what code a binary was built from.
28func Get() apimachineryversion.Info {
29 // These variables typically come from -ldflags settings and in
30 // their absence fallback to the settings in pkg/version/base.go
31 return apimachineryversion.Info{
32 Major: gitMajor,
33 Minor: gitMinor,
34 GitVersion: gitVersion,
35 GitCommit: gitCommit,
36 GitTreeState: gitTreeState,
37 BuildDate: buildDate,
38 GoVersion: runtime.Version(),
39 Compiler: runtime.Compiler,
40 Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
41 }
42}