@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package version
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
@@ -45,14 +46,20 @@ type Info struct {
|
||||
Kubernetes *apimachineryversion.Info `json:"kubernetes,omitempty"`
|
||||
}
|
||||
|
||||
func (info Info) String() string {
|
||||
jsonString, _ := json.Marshal(info)
|
||||
return string(jsonString)
|
||||
}
|
||||
|
||||
// Get returns the overall codebase version. It's for
|
||||
// detecting what code a binary was built from.
|
||||
func Get() Info {
|
||||
// These variables typically come from -ldflags settings and
|
||||
// in their absence fallback to the default settings
|
||||
return Info{
|
||||
GitVersion: gitVersion,
|
||||
|
||||
GitVersion: gitVersion,
|
||||
GitMajor: gitMajor,
|
||||
GitMinor: gitMinor,
|
||||
GitCommit: gitCommit,
|
||||
GitTreeState: gitTreeState,
|
||||
BuildDate: buildDate,
|
||||
|
||||
Reference in New Issue
Block a user