Documentation

Overview

Package version provides build version information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CobraCommand

func CobraCommand() *cobra.Command

CobraCommand returns a command used to print version information.

func CobraCommandWithOptions

func CobraCommandWithOptions(options CobraOptions) *cobra.Command

CobraCommandWithOptions returns a command used to print version information. It accepts an CobraOptions argument that might modify its behavior

Types

type BuildInfo

type BuildInfo struct {
	Version       string `json:"version"`
	GitRevision   string `json:"revision"`
	User          string `json:"user"`
	Host          string `json:"host"`
	GolangVersion string `json:"golang_version"`
	DockerHub     string `json:"hub"`
	BuildStatus   string `json:"status"`
	GitTag        string `json:"tag"`
}

BuildInfo describes version information about the binary build.

var (
	// Info exports the build version information.
	Info BuildInfo
)

func NewBuildInfoFromOldString

func NewBuildInfoFromOldString(oldOutput string) (BuildInfo, error)

NewBuildInfoFromOldString creates a BuildInfo struct based on the output of previous Istio components '-- version' output

func (BuildInfo) LongForm

func (b BuildInfo) LongForm() string

LongForm returns a dump of the Info struct This looks like:

func (BuildInfo) RecordComponentBuildTag

func (b BuildInfo) RecordComponentBuildTag(component string)

RecordComponentBuildTag sets the value for a metric that will be used to track component build tags for tracking rollouts, etc.

func (BuildInfo) String

func (b BuildInfo) String() string

String produces a single-line version info

This looks like:

``` user@host-<docker hub>-<version>-<git revision>-<build status> ```

type CobraOptions

type CobraOptions struct {
	// GetRemoteVersion is the function to be invoked to retrieve remote versions for
	// Istio components. Optional. If not set, the 'version' subcommand will not attempt
	// to connect to a remote side, and CLI flags such as '--remote' will be hidden.
	GetRemoteVersion GetRemoteVersionFunc
}

CobraOptions holds options to be passed to `CobraCommandWithOptions`

type GetRemoteVersionFunc

type GetRemoteVersionFunc func() (*MeshInfo, error)

GetRemoteVersionFunc is the function protoype to be passed to CobraOptions so that it is called when invoking `cmd version`

type MeshInfo

type MeshInfo []ServerInfo

MeshInfo contains the versions for all Istio control plane components

type ServerInfo

type ServerInfo struct {
	Component string
	Info      BuildInfo
}

ServerInfo contains the version for a single control plane component

type Version

type Version struct {
	ClientVersion *BuildInfo `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"`
	MeshVersion   *MeshInfo  `json:"meshVersion,omitempty" yaml:"meshVersion,omitempty"`
}

Version holds info for client and control plane versions