Documentation ¶
Index ¶
- Constants
- func AsLocallySupportedParameter(param string) (string, bool)
- func FormatLocallySupportedParameters() (result string)
- func GetLocallySupportedParameters() []string
- type ComponentSettings
- type ComponentStorageSettings
- type ConfigURL
- type EnvVar
- type EnvVarList
- type LocalConfig
- func (lc *LocalConfig) GetApplication() string
- func (lc *LocalConfig) GetDebugPort() int
- func (lc *LocalConfig) GetEnvs() EnvVarList
- func (lc *LocalConfig) GetIgnore() bool
- func (lc *LocalConfig) GetMaxCPU() string
- func (lc *LocalConfig) GetMaxMemory() string
- func (lc *LocalConfig) GetMinCPU() string
- func (lc *LocalConfig) GetMinMemory() string
- func (lc *LocalConfig) GetName() string
- func (lc *LocalConfig) GetPorts() []string
- func (lc *LocalConfig) GetProject() string
- func (lc *LocalConfig) GetRef() string
- func (lc *LocalConfig) GetSourceLocation() string
- func (lc *LocalConfig) GetSourceType() SrcType
- func (lc *LocalConfig) GetStorage() []ComponentStorageSettings
- func (lc *LocalConfig) GetType() string
- func (lc *LocalConfig) GetURL() []ConfigURL
- type LocalConfigInfo
- func GetOneExistingConfigInfo(componentName, applicationName, projectName string) LocalConfigInfo
- func GetOneExistingConfigInfoStorage(...) LocalConfigInfo
- func GetOneGitExistingConfigInfo(componentName, applicationName, projectName string) LocalConfigInfo
- func GetOneNonExistingConfigInfo() LocalConfigInfo
- func New() (*LocalConfigInfo, error)
- func NewLocalConfigInfo(cfgDir string) (*LocalConfigInfo, error)
- func (lci *LocalConfigInfo) ConfigFileExists() bool
- func (lci *LocalConfigInfo) DeleteConfigDirIfEmpty() error
- func (lci *LocalConfigInfo) DeleteConfigFile() error
- func (lci *LocalConfigInfo) DeleteConfiguration(parameter string) error
- func (lci *LocalConfigInfo) DeleteFromConfigurationList(parameter string, value string) error
- func (lci *LocalConfigInfo) DeleteURL(parameter string) error
- func (lci *LocalConfigInfo) GetComponentSettings() ComponentSettings
- func (lci *LocalConfigInfo) GetEnvVars() EnvVarList
- func (lci *LocalConfigInfo) GetMountPath(storageName string) string
- func (lci *LocalConfigInfo) GetOSSourcePath() (path string, err error)
- func (lci *LocalConfigInfo) IsSet(parameter string) bool
- func (lci *LocalConfigInfo) SetComponentSettings(cs ComponentSettings) error
- func (lci *LocalConfigInfo) SetConfiguration(parameter string, value interface{}) (err error)
- func (lci *LocalConfigInfo) SetEnvVars(envVars EnvVarList) error
- func (lci *LocalConfigInfo) StorageCreate(name, size, path string) (ComponentStorageSettings, error)
- func (lci *LocalConfigInfo) StorageDelete(name string) error
- func (lci *LocalConfigInfo) StorageExists(storageName string) bool
- func (lci *LocalConfigInfo) StorageList() ([]ComponentStorageSettings, error)
- func (lci *LocalConfigInfo) ValidateStorage(storageName, storagePath string) error
- type SrcType
Constants ¶
const ( // Type is the name of the setting controlling the component type i.e. builder image Type = "Type" // TypeDescription is human-readable description of the Type setting TypeDescription = "The type of component" // Name is the name of the setting controlling the component name Name = "Name" // NameDescription is human-readable description of the Name setting NameDescription = "The name of the component" // MinMemory is the name of the setting controlling the min memory a component consumes MinMemory = "MinMemory" // MinMemoryDescription is the description of the setting controlling the minimum memory MinMemoryDescription = "The minimum memory a component is provided" // MaxMemory is the name of the setting controlling the min memory a component consumes MaxMemory = "MaxMemory" // MaxMemoryDescription is the description of the setting controlling the maximum memory MaxMemoryDescription = "The maximum memory a component can consume" // Memory is the name of the setting controlling the memory a component consumes Memory = "Memory" // MemoryDescription is the description of the setting controlling the min and max memory to same value MemoryDescription = "The minimum and maximum memory a component can consume" // DebugPort is the port where the application is set to listen for debugger DebugPort = "DebugPort" // DebugPortDescription is the description for debug port DebugPortDescription = "The port on which the debugger will listen on the component" // Ignore is the name of the setting controlling the min memory a component consumes Ignore = "Ignore" // IgnoreDescription is the description of the setting controlling the use of .odoignore file IgnoreDescription = "Consider the .odoignore file for push and watch" // MinCPU is the name of the setting controlling minimum cpu MinCPU = "MinCPU" // MinCPUDescription is the description of the setting controlling the min CPU value MinCPUDescription = "The minimum CPU a component can consume" // MaxCPU is the name of the setting controlling the use of .odoignore file MaxCPU = "MaxCPU" //MaxCPUDescription is the description of the setting controlling the max CPU value MaxCPUDescription = "The maximum CPU a component can consume" // CPU is the name of the setting controlling the cpu a component consumes CPU = "CPU" // CPUDescription is the description of the setting controlling the min and max CPU to same value CPUDescription = "The minimum and maximum CPU a component can consume" // SourceLocation indicates path of the source e.g. location of the git repo SourceLocation = "SourceLocation" // SourceType indicates type of component source -- git/binary/local SourceType = "SourceType" // Ref indicates git ref for the component source Ref = "Ref" // Ports is the space separated list of user specified ports to be opened in the component Ports = "Ports" // Application indicates application of which component is part of Application = "Application" // Project indicates project the component is part of Project = "Project" // ProjectDescription is the description of project component setting ProjectDescription = "Project is the name of the project the component is part of" // ApplicationDescription is the description of app component setting ApplicationDescription = "Application is the name of application the component needs to be part of" // PortsDescription is the desctription of the ports component setting PortsDescription = "Ports to be opened in the component" // RefDescription is the description of ref setting RefDescription = "Git ref to use for creating component from git source" // SourceTypeDescription is the description of type setting SourceTypeDescription = "Type of component source - git/binary/local" // Storage is the name of the setting controlling storage Storage = "Storage" // StorageDescription is the description of the storage StorageDescription = "Storage of the component" // SourceLocationDescription is the human-readable description of path setting SourceLocationDescription = "The path indicates the location of binary file or git source" // URL URL = "URL" // URLDescription is the description of URL URLDescription = "URL to access the component" )
const (
// DefaultDebugPort is the default port used for debugging on remote pod
DefaultDebugPort = 5858
)
Variables ¶
This section is empty.
Functions ¶
func AsLocallySupportedParameter ¶ added in v1.2.4
AsLocallySupportedParameter returns the parameter in lower case and a boolean indicating if it is a supported parameter
func FormatLocallySupportedParameters ¶ added in v0.0.19
func FormatLocallySupportedParameters() (result string)
FormatLocallySupportedParameters outputs supported parameters and their description
func GetLocallySupportedParameters ¶ added in v0.0.19
func GetLocallySupportedParameters() []string
GetLocallySupportedParameters returns the name of the supported global parameters
Types ¶
type ComponentSettings ¶ added in v0.0.19
type ComponentSettings struct { // The builder image to use Type *string `yaml:"Type,omitempty"` // SourceLocation is path to binary in current/context dir, it can be the // git url in case of source type being git SourceLocation *string `yaml:"SourceLocation,omitempty"` // Ref is component source git ref but can be levaraged for more in future Ref *string `yaml:"Ref,omitempty"` // Type is type of component source: git/local/binary SourceType *SrcType `yaml:"SourceType,omitempty"` // Ports is a slice of ports to be exposed when a component is created // the format of the port is "PORT/PROTOCOL" e.g. "8080/TCP" Ports *[]string `yaml:"Ports,omitempty"` Application *string `yaml:"Application,omitempty"` Project *string `yaml:"Project,omitempty"` Name *string `yaml:"Name,omitempty"` MinMemory *string `yaml:"MinMemory,omitempty"` MaxMemory *string `yaml:"MaxMemory,omitempty"` // DebugPort controls the port used by the pod to run the debugging agent on DebugPort *int `yaml:"DebugPort,omitempty"` Storage *[]ComponentStorageSettings `yaml:"Storage,omitempty"` // Ignore if set to true then odoignore file should be considered Ignore *bool `yaml:"Ignore,omitempty"` MinCPU *string `yaml:"MinCPU,omitempty"` MaxCPU *string `yaml:"MaxCPU,omitempty"` Envs EnvVarList `yaml:"Envs,omitempty"` URL *[]ConfigURL `yaml:"Url,omitempty"` }
ComponentSettings holds all component related information
type ComponentStorageSettings ¶ added in v1.0.0
type ConfigURL ¶ added in v1.0.2
type ConfigURL struct { // Name of the URL Name string `yaml:"Name,omitempty"` // Port number for the url of the component, required in case of components which expose more than one service port Port int `yaml:"Port,omitempty"` // Indicates if the URL should be a secure https one Secure bool `yaml:"Secure,omitempty"` }
ConfigURL holds URL related information
type EnvVar ¶ added in v1.0.0
EnvVar represents an enviroment variable
func NewEnvVarFromString ¶ added in v1.0.0
NewEnvVarFromString takes a string of format "name=value" and returns an Env variable struct
type EnvVarList ¶ added in v1.0.0
type EnvVarList []EnvVar
EnvVarList represents a list of environment variables
func NewEnvVarListFromDevfileEnv ¶ added in v1.2.6
func NewEnvVarListFromDevfileEnv(envList []common.Env) EnvVarList
NewEnvVarListFromDevfileEnv creates an EnvVarList from the list of envs present in a devfile.
func NewEnvVarListFromSlice ¶ added in v1.0.0
func NewEnvVarListFromSlice(envList []string) (EnvVarList, error)
NewEnvVarListFromSlice takes multiple env variables with format "name=value" and returns an EnvVarList
func RemoveEnvVarsFromList ¶ added in v1.0.0
func RemoveEnvVarsFromList(envVarList EnvVarList, keys []string) (EnvVarList, error)
RemoveEnvVarsFromList removes the env variables based on the keys provided and returns a new EnvVarList
func (EnvVarList) Merge ¶ added in v1.0.0
func (evl EnvVarList) Merge(other EnvVarList) EnvVarList
Merge merges the other EnvVarlist with keeping last value for duplicate EnvVars and returns a new EnvVarList
func (EnvVarList) ToDevfileEnv ¶ added in v1.2.6
func (evl EnvVarList) ToDevfileEnv() []common.Env
ToDevfileEnv converts the EnvVarList to the list of Envs supported by devfile
func (EnvVarList) ToStringSlice ¶ added in v1.0.0
func (evl EnvVarList) ToStringSlice() []string
ToStringSlice converts the EnvVarList into a slice of env var of kind "key=value"
type LocalConfig ¶ added in v0.0.19
type LocalConfig struct {
// contains filtered or unexported fields
}
LocalConfig holds all the config relavent to a specific Component.
func NewLocalConfig ¶ added in v0.0.19
func NewLocalConfig() LocalConfig
NewLocalConfig creates an empty LocalConfig struct with typeMeta populated
func (*LocalConfig) GetApplication ¶ added in v1.0.0
func (lc *LocalConfig) GetApplication() string
GetApplication returns the app, returns default if nil
func (*LocalConfig) GetDebugPort ¶ added in v1.0.0
func (lc *LocalConfig) GetDebugPort() int
GetDebugPort returns the DebugPort, returns default if nil
func (*LocalConfig) GetEnvs ¶ added in v1.0.0
func (lc *LocalConfig) GetEnvs() EnvVarList
GetEnvs returns the Envs, returns empty if nil
func (*LocalConfig) GetIgnore ¶ added in v1.0.0
func (lc *LocalConfig) GetIgnore() bool
GetIgnore returns the Ignore, returns default if nil
func (*LocalConfig) GetMaxCPU ¶ added in v1.0.0
func (lc *LocalConfig) GetMaxCPU() string
GetMaxCPU returns the MaxCPU, returns default if nil
func (*LocalConfig) GetMaxMemory ¶ added in v1.0.0
func (lc *LocalConfig) GetMaxMemory() string
GetMaxMemory returns the MaxMemory, returns default if nil
func (*LocalConfig) GetMinCPU ¶ added in v1.0.0
func (lc *LocalConfig) GetMinCPU() string
GetMinCPU returns the MinCPU, returns default if nil
func (*LocalConfig) GetMinMemory ¶ added in v1.0.0
func (lc *LocalConfig) GetMinMemory() string
GetMinMemory returns the MinMemory, returns default if nil
func (*LocalConfig) GetName ¶ added in v1.0.0
func (lc *LocalConfig) GetName() string
GetName returns the Name, returns default if nil
func (*LocalConfig) GetPorts ¶ added in v1.0.0
func (lc *LocalConfig) GetPorts() []string
GetPorts returns the ports, returns default if nil
func (*LocalConfig) GetProject ¶ added in v1.0.0
func (lc *LocalConfig) GetProject() string
GetProject returns the project, returns default if nil
func (*LocalConfig) GetRef ¶ added in v1.0.0
func (lc *LocalConfig) GetRef() string
GetRef returns the ref, returns default if nil
func (*LocalConfig) GetSourceLocation ¶ added in v1.0.0
func (lc *LocalConfig) GetSourceLocation() string
GetSourceLocation returns the sourcelocation, returns default if nil
func (*LocalConfig) GetSourceType ¶ added in v1.0.0
func (lc *LocalConfig) GetSourceType() SrcType
GetSourceType returns the source type, returns default if nil
func (*LocalConfig) GetStorage ¶ added in v1.0.0
func (lc *LocalConfig) GetStorage() []ComponentStorageSettings
GetStorage returns the Storage, returns empty if nil
func (*LocalConfig) GetType ¶ added in v1.0.0
func (lc *LocalConfig) GetType() string
GetType returns type of component (builder image name) in the config
func (*LocalConfig) GetURL ¶ added in v1.0.2
func (lc *LocalConfig) GetURL() []ConfigURL
GetURL returns the ConfigURL, returns default if nil
type LocalConfigInfo ¶ added in v0.0.19
type LocalConfigInfo struct { Filename string `yaml:"FileName,omitempty"` LocalConfig `yaml:",omitempty"` // contains filtered or unexported fields }
LocalConfigInfo wraps the local config and provides helpers to serialize it.
func GetOneExistingConfigInfo ¶ added in v1.0.0
func GetOneExistingConfigInfo(componentName, applicationName, projectName string) LocalConfigInfo
func GetOneExistingConfigInfoStorage ¶ added in v1.1.1
func GetOneExistingConfigInfoStorage(componentName, applicationName, projectName, storeName, storeSize, storePath string) LocalConfigInfo
func GetOneGitExistingConfigInfo ¶ added in v1.0.2
func GetOneGitExistingConfigInfo(componentName, applicationName, projectName string) LocalConfigInfo
func GetOneNonExistingConfigInfo ¶ added in v1.0.0
func GetOneNonExistingConfigInfo() LocalConfigInfo
func NewLocalConfigInfo ¶ added in v1.0.0
func NewLocalConfigInfo(cfgDir string) (*LocalConfigInfo, error)
NewLocalConfigInfo gets the LocalConfigInfo from local config file and creates the local config file in case it's not present then it
func (*LocalConfigInfo) ConfigFileExists ¶ added in v1.0.0
func (lci *LocalConfigInfo) ConfigFileExists() bool
ConfigFileExists if a config file exists or not
func (*LocalConfigInfo) DeleteConfigDirIfEmpty ¶ added in v1.0.2
func (lci *LocalConfigInfo) DeleteConfigDirIfEmpty() error
DeleteConfigDirIfEmpty Deletes the config directory if its empty
func (*LocalConfigInfo) DeleteConfigFile ¶ added in v1.0.2
func (lci *LocalConfigInfo) DeleteConfigFile() error
DeleteConfigFile deletes the odo-config.yaml file if it exists
func (*LocalConfigInfo) DeleteConfiguration ¶ added in v0.0.19
func (lci *LocalConfigInfo) DeleteConfiguration(parameter string) error
DeleteConfiguration is used to delete config from local odo config
func (*LocalConfigInfo) DeleteFromConfigurationList ¶ added in v1.0.0
func (lci *LocalConfigInfo) DeleteFromConfigurationList(parameter string, value string) error
DeleteFromConfigurationList is used to delete a value from a list from the local odo config parameter is the name of the config parameter value is the value to be deleted
func (*LocalConfigInfo) DeleteURL ¶ added in v1.0.2
func (lci *LocalConfigInfo) DeleteURL(parameter string) error
DeleteURL is used to delete config from local odo config
func (*LocalConfigInfo) GetComponentSettings ¶ added in v1.0.0
func (lci *LocalConfigInfo) GetComponentSettings() ComponentSettings
GetComponentSettings returns the componentSettings from local config
func (*LocalConfigInfo) GetEnvVars ¶ added in v1.0.0
func (lci *LocalConfigInfo) GetEnvVars() EnvVarList
GetEnvVars gets the env variables from the component settings
func (*LocalConfigInfo) GetMountPath ¶ added in v1.0.0
func (lci *LocalConfigInfo) GetMountPath(storageName string) string
func (*LocalConfigInfo) GetOSSourcePath ¶ added in v1.0.0
func (lci *LocalConfigInfo) GetOSSourcePath() (path string, err error)
GetOSSourcePath corrects the current sourcePath depending on local or binary configuration, if Git has been passed, we simply return the source location from LocalConfig this will get the correct source path whether on Windows, macOS or Linux.
This function also takes in the current working directory + context directory in order to correctly retrieve WHERE the source is located..
func (*LocalConfigInfo) IsSet ¶ added in v1.0.0
func (lci *LocalConfigInfo) IsSet(parameter string) bool
IsSet uses reflection to get the parameter from the localconfig struct, currently it only searches the componentSettings
func (*LocalConfigInfo) SetComponentSettings ¶ added in v1.0.0
func (lci *LocalConfigInfo) SetComponentSettings(cs ComponentSettings) error
SetComponentSettings sets the componentSettings from to the local config and writes to the file
func (*LocalConfigInfo) SetConfiguration ¶ added in v0.0.19
func (lci *LocalConfigInfo) SetConfiguration(parameter string, value interface{}) (err error)
SetConfiguration sets the common config settings like component type, min memory max memory etc. TODO: Use reflect to set parameters
func (*LocalConfigInfo) SetEnvVars ¶ added in v1.0.0
func (lci *LocalConfigInfo) SetEnvVars(envVars EnvVarList) error
SetEnvVars sets the env variables on the component settings
func (*LocalConfigInfo) StorageCreate ¶ added in v1.0.0
func (lci *LocalConfigInfo) StorageCreate(name, size, path string) (ComponentStorageSettings, error)
StorageCreate sets the storage related information in the local configuration
func (*LocalConfigInfo) StorageDelete ¶ added in v1.0.0
func (lci *LocalConfigInfo) StorageDelete(name string) error
func (*LocalConfigInfo) StorageExists ¶ added in v1.0.0
func (lci *LocalConfigInfo) StorageExists(storageName string) bool
func (*LocalConfigInfo) StorageList ¶ added in v1.0.0
func (lci *LocalConfigInfo) StorageList() ([]ComponentStorageSettings, error)
func (*LocalConfigInfo) ValidateStorage ¶ added in v1.0.0
func (lci *LocalConfigInfo) ValidateStorage(storageName, storagePath string) error
type SrcType ¶ added in v1.0.0
type SrcType string
SrcType is an enum to indicate the type of source of component -- local source/binary or git for the generation of app/component names
const ( // GIT as source of component GIT SrcType = "git" // LOCAL Local source path as source of component LOCAL SrcType = "local" // BINARY Local Binary as source of component BINARY SrcType = "binary" // NONE indicates there's no information about the type of source of the component NONE SrcType = "" )
func GetSrcType ¶ added in v1.0.0
GetSrcType returns enum equivalent of passed component source type or error if unsupported type passed