Documentation
¶
Overview ¶
Package v1 implements the infra config with interface values.
Package v1 implements the infra config with interface values.
Package v1 implements the infra config with interface values.
Package v1 implements the infra config with interface values.
Package v1 implements the infra config with interface values.
Package v1 implements the infra config with interface values.
Package v1 implements the infra config with interface values.
Package v1 implements the infra config with interface values.
Index ¶
- Constants
- Variables
- type BuildxDriver
- type ConfigKey
- type ConfigKeyPlatformKey
- type ConfigKeyStr
- type ConfigStateType
- type ConfigurationBean
- type ConfigurationBeanAbstract
- type GenericConfigurationBean
- type InfraConfig
- func (infraConfig *InfraConfig) GetCiDefaultTimeout() float64
- func (infraConfig *InfraConfig) GetCiLimitCpu() string
- func (infraConfig *InfraConfig) GetCiLimitMem() string
- func (infraConfig *InfraConfig) GetCiReqCpu() string
- func (infraConfig *InfraConfig) GetCiReqMem() string
- func (infraConfig *InfraConfig) GetCiTimeoutInt() int64
- func (infraConfig *InfraConfig) SetCiLimitCpu(cpu string) *InfraConfig
- func (infraConfig *InfraConfig) SetCiLimitMem(mem string) *InfraConfig
- func (infraConfig *InfraConfig) SetCiReqCpu(cpu string) *InfraConfig
- func (infraConfig *InfraConfig) SetCiReqMem(mem string) *InfraConfig
- func (infraConfig *InfraConfig) SetCiTimeout(timeout float64) *InfraConfig
- func (infraConfig *InfraConfig) SetCiVariableSnapshot(value map[string]string) *InfraConfig
- type InfraConfigEnt
- type InfraConfigKeys
- func (s InfraConfigKeys) GetAllSupportedKeys() []ConfigKeyStr
- func (s InfraConfigKeys) GetUnConfiguredKeys() []ConfigKeyStr
- func (s InfraConfigKeys) IsConfigured(key ConfigKeyStr) bool
- func (s InfraConfigKeys) IsSupported(key ConfigKeyStr) bool
- func (s InfraConfigKeys) MarkConfigured(key ConfigKeyStr) InfraConfigKeys
- func (s InfraConfigKeys) MarkUnConfigured(key ConfigKeyStr) InfraConfigKeys
- type InfraConfigMetaData
- type PlatformResponse
- type ProfileBeanAbstract
- type ProfileBeanAbstractEnt
- type ProfileBeanDto
- func (profileBean *ProfileBeanDto) DeepCopy() *ProfileBeanDto
- func (profileBean *ProfileBeanDto) GetBuildxDriverType() BuildxDriver
- func (profileBean *ProfileBeanDto) GetConfigurations() map[string][]*ConfigurationBean
- func (profileBean *ProfileBeanDto) GetDescription() string
- func (profileBean *ProfileBeanDto) GetName() string
- func (profileBean *ProfileBeanDto) SetPlatformConfigurations(platform string, configurations []*ConfigurationBean) *ProfileBeanDto
- type ProfileResponse
- type ProfileType
- type Scope
- type Unit
Constants ¶
const ( // RUNNER_PLATFORM is the name of the default platform; a reserved name RUNNER_PLATFORM = "runner" // Deprecated: use RUNNER_PLATFORM instead // CI_RUNNER_PLATFORM is earlier used as the name of the default platform CI_RUNNER_PLATFORM = "ci-runner" )
internal-platforms
const BuildxK8sDriverMigrated string = "build-infra-migrated"
BuildxK8sDriverMigrated is the marker flag to check if the infra config is migrated completely.
const DEFAULT_PROFILE_NAME = "default"
const GLOBAL_PROFILE_NAME = "global"
const QualifiedDescriptionMaxLength int = 350
QualifiedDescriptionMaxLength is the maximum length of an infra profile description
const QualifiedProfileMaxLength int = 50
QualifiedProfileMaxLength is the maximum length of an infra profile name
Variables ¶
var AllConfigKeysV0 = []ConfigKeyStr{CPU_LIMIT, CPU_REQUEST, MEMORY_LIMIT, MEMORY_REQUEST, TIME_OUT}
AllConfigKeysV0 contains the list of supported configuration keys in V0
var AllConfigKeysV1 = append(AllConfigKeysV0, []ConfigKeyStr{NODE_SELECTOR, TOLERATIONS, CONFIG_MAP, SECRET}...)
AllConfigKeysV1 contains the list of supported configuration keys in V1
Functions ¶
This section is empty.
Types ¶
type BuildxDriver ¶
type BuildxDriver string
const ( // BuildxK8sDriver is the default driver for buildx BuildxK8sDriver BuildxDriver = "kubernetes" // BuildxDockerContainerDriver is the driver for docker container BuildxDockerContainerDriver BuildxDriver = "docker-container" )
func (BuildxDriver) IsDockerContainer ¶
func (b BuildxDriver) IsDockerContainer() bool
func (BuildxDriver) IsKubernetes ¶
func (b BuildxDriver) IsKubernetes() bool
func (BuildxDriver) IsPlatformSupported ¶
func (b BuildxDriver) IsPlatformSupported(platform string) bool
func (BuildxDriver) IsValid ¶
func (b BuildxDriver) IsValid() bool
func (BuildxDriver) String ¶
func (b BuildxDriver) String() string
type ConfigKeyPlatformKey ¶
type ConfigKeyStr ¶
type ConfigKeyStr string
ConfigKeyStr represents the configuration key in the API
const ( CPU_LIMIT ConfigKeyStr = "cpu_limit" CPU_REQUEST ConfigKeyStr = "cpu_request" MEMORY_LIMIT ConfigKeyStr = "memory_limit" MEMORY_REQUEST ConfigKeyStr = "memory_request" TIME_OUT ConfigKeyStr = "timeout" NODE_SELECTOR ConfigKeyStr = "node_selector" TOLERATIONS ConfigKeyStr = "tolerations" CONFIG_MAP ConfigKeyStr = "cm" SECRET ConfigKeyStr = "cs" )
type ConfigStateType ¶
type ConfigStateType string
ConfigStateType represents the derived state of the ConfigurationBean.Value
const ( // OVERRIDDEN is used when the configuration is overridden in the profile OVERRIDDEN ConfigStateType = "OVERRIDDEN" // PARTIALLY_INHERITING is used when the configuration is partially inherited from the global profile PARTIALLY_INHERITING ConfigStateType = "PARTIALLY_INHERITING" // INHERITING_GLOBAL_PROFILE is used when the configuration is inherited from the global profile INHERITING_GLOBAL_PROFILE ConfigStateType = "INHERITING_GLOBAL_PROFILE" )
type ConfigurationBean ¶
type ConfigurationBean struct {
ConfigurationBeanAbstract
Value any `json:"value,omitempty"`
Count int `json:"count,omitempty"`
ConfigState ConfigStateType `json:"configState,omitempty"`
AppliedConfigIds []int `json:"-"`
}
func (*ConfigurationBean) DeepCopy ¶
func (c *ConfigurationBean) DeepCopy() *ConfigurationBean
func (*ConfigurationBean) GetStringValue ¶
func (c *ConfigurationBean) GetStringValue() string
func (*ConfigurationBean) IsEmpty ¶
func (c *ConfigurationBean) IsEmpty() bool
type GenericConfigurationBean ¶
type GenericConfigurationBean[T any] struct { ConfigurationBeanAbstract Value T }
GenericConfigurationBean is for internal use only
- used for specific handling of configurations and to avoid type assertion
- not exposed to the API
- derived from ConfigurationBean
type InfraConfig ¶
type InfraConfig struct {
// currently only for ci
CiLimitCpu string `env:"LIMIT_CI_CPU" envDefault:"0.5"`
CiLimitMem string `env:"LIMIT_CI_MEM" envDefault:"3G"`
CiReqCpu string `env:"REQ_CI_CPU" envDefault:"0.5"`
CiReqMem string `env:"REQ_CI_MEM" envDefault:"3G"`
// CiDefaultTimeout is the default timeout for CI jobs in seconds
// Earlier it was in int64, but now it is in float64
CiDefaultTimeout float64 `env:"DEFAULT_TIMEOUT" envDefault:"3600" description:"Timeout for CI to be completed"`
// cm and cs
ConfigMaps []bean.ConfigSecretMap `env:"-"`
Secrets []bean.ConfigSecretMap `env:"-"`
InfraConfigEnt
}
InfraConfig is used for read-only purpose outside this package
func (*InfraConfig) GetCiDefaultTimeout ¶
func (infraConfig *InfraConfig) GetCiDefaultTimeout() float64
func (*InfraConfig) GetCiLimitCpu ¶
func (infraConfig *InfraConfig) GetCiLimitCpu() string
func (*InfraConfig) GetCiLimitMem ¶
func (infraConfig *InfraConfig) GetCiLimitMem() string
func (*InfraConfig) GetCiReqCpu ¶
func (infraConfig *InfraConfig) GetCiReqCpu() string
func (*InfraConfig) GetCiReqMem ¶
func (infraConfig *InfraConfig) GetCiReqMem() string
func (*InfraConfig) GetCiTimeoutInt ¶
func (infraConfig *InfraConfig) GetCiTimeoutInt() int64
func (*InfraConfig) SetCiLimitCpu ¶
func (infraConfig *InfraConfig) SetCiLimitCpu(cpu string) *InfraConfig
func (*InfraConfig) SetCiLimitMem ¶
func (infraConfig *InfraConfig) SetCiLimitMem(mem string) *InfraConfig
func (*InfraConfig) SetCiReqCpu ¶
func (infraConfig *InfraConfig) SetCiReqCpu(cpu string) *InfraConfig
func (*InfraConfig) SetCiReqMem ¶
func (infraConfig *InfraConfig) SetCiReqMem(mem string) *InfraConfig
func (*InfraConfig) SetCiTimeout ¶
func (infraConfig *InfraConfig) SetCiTimeout(timeout float64) *InfraConfig
func (*InfraConfig) SetCiVariableSnapshot ¶
func (infraConfig *InfraConfig) SetCiVariableSnapshot(value map[string]string) *InfraConfig
type InfraConfigEnt ¶
type InfraConfigEnt struct {
}
type InfraConfigKeys ¶
type InfraConfigKeys map[ConfigKeyStr]bool
func (InfraConfigKeys) GetAllSupportedKeys ¶
func (s InfraConfigKeys) GetAllSupportedKeys() []ConfigKeyStr
func (InfraConfigKeys) GetUnConfiguredKeys ¶
func (s InfraConfigKeys) GetUnConfiguredKeys() []ConfigKeyStr
func (InfraConfigKeys) IsConfigured ¶
func (s InfraConfigKeys) IsConfigured(key ConfigKeyStr) bool
func (InfraConfigKeys) IsSupported ¶
func (s InfraConfigKeys) IsSupported(key ConfigKeyStr) bool
func (InfraConfigKeys) MarkConfigured ¶
func (s InfraConfigKeys) MarkConfigured(key ConfigKeyStr) InfraConfigKeys
func (InfraConfigKeys) MarkUnConfigured ¶
func (s InfraConfigKeys) MarkUnConfigured(key ConfigKeyStr) InfraConfigKeys
type InfraConfigMetaData ¶
type InfraConfigMetaData struct {
DefaultConfigurations map[string][]*ConfigurationBean `json:"defaultConfigurations,omitempty"`
ConfigurationUnits map[ConfigKeyStr]map[string]Unit `json:"configurationUnits,omitempty"`
}
type PlatformResponse ¶
type PlatformResponse struct {
Platforms []string `json:"platforms"`
}
type ProfileBeanAbstract ¶
type ProfileBeanAbstract struct {
Id int `json:"id"`
Name string `json:"name" validate:"required,min=1,max=50,global-entity-name"`
Description string `json:"description" validate:"max=350"`
Active bool `json:"active"`
Type ProfileType `json:"type"`
AppCount int `json:"appCount"`
ProfileBeanAbstractEnt
}
func (*ProfileBeanAbstract) GetBuildxDriverType ¶
func (p *ProfileBeanAbstract) GetBuildxDriverType() BuildxDriver
func (*ProfileBeanAbstract) GetDescription ¶
func (p *ProfileBeanAbstract) GetDescription() string
func (*ProfileBeanAbstract) GetName ¶
func (p *ProfileBeanAbstract) GetName() string
type ProfileBeanAbstractEnt ¶
type ProfileBeanAbstractEnt struct {
BuildxDriverType BuildxDriver `json:"buildxDriverType" default:"kubernetes"`
}
type ProfileBeanDto ¶
type ProfileBeanDto struct {
ProfileBeanAbstract
Configurations map[string][]*ConfigurationBean `json:"configurations"`
}
func (*ProfileBeanDto) DeepCopy ¶
func (profileBean *ProfileBeanDto) DeepCopy() *ProfileBeanDto
func (*ProfileBeanDto) GetBuildxDriverType ¶
func (profileBean *ProfileBeanDto) GetBuildxDriverType() BuildxDriver
func (*ProfileBeanDto) GetConfigurations ¶
func (profileBean *ProfileBeanDto) GetConfigurations() map[string][]*ConfigurationBean
func (*ProfileBeanDto) GetDescription ¶
func (profileBean *ProfileBeanDto) GetDescription() string
func (*ProfileBeanDto) GetName ¶
func (profileBean *ProfileBeanDto) GetName() string
func (*ProfileBeanDto) SetPlatformConfigurations ¶
func (profileBean *ProfileBeanDto) SetPlatformConfigurations(platform string, configurations []*ConfigurationBean) *ProfileBeanDto
type ProfileResponse ¶
type ProfileResponse struct {
Profile ProfileBeanDto `json:"profile"`
InfraConfigMetaData
}
type ProfileType ¶
type ProfileType string
const ( GLOBAL ProfileType = "GLOBAL" DEFAULT ProfileType = "DEFAULT" NORMAL ProfileType = "NORMAL" )
type Scope ¶
type Scope struct {
AppId int
}
Scope refers to the identifier scope for the infra config
- Currently, the infra config profile is applied to a specific app only.
type Unit ¶
type Unit struct {
// Name is unitType name
Name string `json:"name"`
// ConversionFactor is used to convert this unitType to the base unitType
// if ConversionFactor is 1, then this is the base unitType
ConversionFactor float64 `json:"conversionFactor"`
}
Unit represents unitType of a configuration