github.com/rancher/longhorn-engine@v0.6.2/meta/version.go (about)

     1  package meta
     2  
     3  const (
     4  	// CLIAPIVersion used to communicate with user e.g. longhorn-manager
     5  	CLIAPIVersion    = 2
     6  	CLIAPIMinVersion = 2
     7  
     8  	// ControllerAPIVersion used to communicate with instance-manager
     9  	ControllerAPIVersion    = 2
    10  	ControllerAPIMinVersion = 2
    11  
    12  	// DataFormatVersion used by the Replica to store data
    13  	DataFormatVersion    = 1
    14  	DataFormatMinVersion = 1
    15  )
    16  
    17  // Following variables are filled in by main.go
    18  var (
    19  	Version   string
    20  	GitCommit string
    21  	BuildDate string
    22  )
    23  
    24  type VersionOutput struct {
    25  	Version   string `json:"version"`
    26  	GitCommit string `json:"gitCommit"`
    27  	BuildDate string `json:"buildDate"`
    28  
    29  	CLIAPIVersion           int `json:"cliAPIVersion"`
    30  	CLIAPIMinVersion        int `json:"cliAPIMinVersion"`
    31  	ControllerAPIVersion    int `json:"controllerAPIVersion"`
    32  	ControllerAPIMinVersion int `json:"controllerAPIMinVersion"`
    33  	DataFormatVersion       int `json:"dataFormatVersion"`
    34  	DataFormatMinVersion    int `json:"dataFormatMinVersion"`
    35  }
    36  
    37  func GetVersion() VersionOutput {
    38  	return VersionOutput{
    39  		Version:   Version,
    40  		GitCommit: GitCommit,
    41  		BuildDate: BuildDate,
    42  
    43  		CLIAPIVersion:           CLIAPIVersion,
    44  		CLIAPIMinVersion:        CLIAPIMinVersion,
    45  		ControllerAPIVersion:    ControllerAPIVersion,
    46  		ControllerAPIMinVersion: ControllerAPIMinVersion,
    47  		DataFormatVersion:       DataFormatVersion,
    48  		DataFormatMinVersion:    DataFormatMinVersion,
    49  	}
    50  }