Documentation ¶
Index ¶
- Constants
- Variables
- func AppendErrorString(errs []string, err error) []string
- func AutoScale(dat map[string]interface{}) (bool, error)
- func BuildDeployedAppName(appName string, environmentName string) string
- func BuildDevtronBomUrl(bomUrl string, version string) string
- func CheckForMissingFiles(chartLocation string) error
- func Close(c Closer, logger *zap.SugaredLogger)
- func CompareLimitsRequests(dat map[string]interface{}, chartVersion string) (bool, error)
- func ComputeHash(template *v1.PodTemplateSpec, collisionCount *int32) string
- func ContainsString(list []string, element string) bool
- func ConvertStringSliceToMap(inputs []string) map[string]bool
- func CpuToNumber(cpu string) (int64, error)
- func DeepHashObject(hasher hash.Hash, objectToWrite interface{})
- func ExtractChartVersion(chartVersion string) (int, int, error)
- func ExtractTarGz(gzipStream io.Reader, chartDir string) error
- func Generate(size int) string
- func GetClientIP(r *http.Request) string
- func GetErrorOrNil(errs []string) error
- func GetSchemaFromType[T any](t T) (string, error)
- func HttpRequest(url string) (map[string]interface{}, error)
- func Int() int
- func Int63nRange(min, max int64) int64
- func InterfaceToFloat(resp interface{}) float64
- func InterfaceToMapAdapter(resp interface{}) map[string]interface{}
- func InterfaceToString(resp interface{}) string
- func Intn(max int) int
- func IntnRange(min, max int) int
- func IsBaseStack() bool
- func IsFullStack() bool
- func IsHelmApp(appOfferingMode string) bool
- func IsTerminalStatus(status string) bool
- func MatchRegexExpression(exp string, text string) (bool, error)
- func MemoryToNumber(memory string) (int64, error)
- func ParseFloat(str string) (float64, error)
- func ParseFloatNumber(inputVal interface{}) (float64, error)
- func Perm(n int) []int
- func ProcessAppStatuses(appStatuses []string) string
- func ReadFromUrlWithRetry(url string) ([]byte, error)
- func SafeEncodeString(s string) string
- func Seed(seed int64)
- func String(n int) string
- func Tprintf(tmpl string, data interface{}) (string, error)
- func TriggerCDMetrics(wfr CDMetrics, exposeCDMetrics bool)
- func TriggerCIMetrics(Metrics CIMetrics, exposeCIMetrics bool, PipelineName string, AppName string)
- func TriggerGitOpsMetrics(operation string, method string, startTime time.Time, err error)
- type CDMetrics
- type CIMetrics
- type Closer
- type CpuChecker
- type CustomFormatCheckers
- type DevtronSecretConfig
- type GlobalEnvVariables
- type HeaderAdder
- type HpaResourceRequest
- type MemoryChecker
- type ServerVersion
Constants ¶
const ( KubernetesSecret string = "KubernetesSecret" AWSSecretsManager string = "AWSSecretsManager" AWSSystemManager string = "AWSSystemManager" HashiCorpVault string = "HashiCorpVault" ESOGoogleSecretsManager string = "ESO_GoogleSecretsManager" ESOAWSSecretsManager string = "ESO_AWSSecretsManager" ESOAzureSecretsManager string = "ESO_AzureSecretsManager" ESOHashiCorpVault string = "ESO_HashiCorpVault" KubernetesExternalSecret string = "KubernetesExternalSecret" ConfigMapSecretUsageTypeEnvironment string = "environment" ConfigMapSecretUsageTypeVolume string = "volume" YamlSeparator string = "---\n" )
const ( WorkflowAborted = "Aborted" WorkflowFailed = "Failed" WorkflowSucceeded = "Succeeded" )
const ( CpuRegex = "(^\\d*\\.?\\d+e?\\d*)(m?)$" MemoryRegex = "(^\\d*\\.?\\d+e?\\d*)(Ei?|Pi?|Ti?|Gi?|Mi?|Ki?|$)$" )
Variables ¶
var (
CpuUnitChecker, _ = regexp.Compile(CpuRegex)
MemoryUnitChecker, _ = regexp.Compile(MemoryRegex)
)
var ( GitCommit = "" BuildTime = "" ServerMode = "" SERVER_MODE_FULL = "FULL" SERVER_MODE_HYPERION = "EA_ONLY" )
Functions ¶
func AppendErrorString ¶
func BuildDeployedAppName ¶ added in v0.4.15
func BuildDevtronBomUrl ¶ added in v0.4.1
func CheckForMissingFiles ¶ added in v0.3.22
func Close ¶
func Close(c Closer, logger *zap.SugaredLogger)
func CompareLimitsRequests ¶ added in v0.2.37
func ComputeHash ¶
func ComputeHash(template *v1.PodTemplateSpec, collisionCount *int32) string
ComputeHash returns a hash value calculated from pod template and a collisionCount to avoid hash collision. The hash will be safe encoded to avoid bad words.
func ContainsString ¶
func ConvertStringSliceToMap ¶ added in v0.6.21
func CpuToNumber ¶ added in v0.2.37
func DeepHashObject ¶
DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.
func GetClientIP ¶ added in v0.4.11
GetClientIP gets a requests IP address by reading off the forwarded-for header (for proxies) and falls back to use the remote address.
func GetErrorOrNil ¶
func GetSchemaFromType ¶ added in v0.6.23
func HttpRequest ¶ added in v0.2.18
func Int63nRange ¶
IntnRange generates an int64 integer in range [min,max). By design this should panic if input is invalid, <= 0.
func InterfaceToFloat ¶ added in v0.6.15
func InterfaceToFloat(resp interface{}) float64
func InterfaceToMapAdapter ¶ added in v0.4.14
func InterfaceToMapAdapter(resp interface{}) map[string]interface{}
InterfaceToMapAdapter it will convert any golang struct into map
func InterfaceToString ¶ added in v0.6.15
func InterfaceToString(resp interface{}) string
func Intn ¶
Intn generates an integer in range [0,max). By design this should panic if input is invalid, <= 0.
func IntnRange ¶
IntnRange generates an integer in range [min,max). By design this should panic if input is invalid, <= 0.
func IsBaseStack ¶ added in v0.5.3
func IsBaseStack() bool
func IsFullStack ¶ added in v0.5.3
func IsFullStack() bool
func IsTerminalStatus ¶ added in v0.6.4
func MatchRegexExpression ¶ added in v0.6.21
func MemoryToNumber ¶ added in v0.2.37
func ParseFloat ¶ added in v0.2.37
func ParseFloatNumber ¶ added in v0.6.13
func Perm ¶
Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n) from the default Source.
func ProcessAppStatuses ¶ added in v0.6.13
func ReadFromUrlWithRetry ¶ added in v0.4.1
func SafeEncodeString ¶
SafeEncodeString encodes s using the same characters as rand.String. This reduces the chances of bad words and ensures that strings generated from hash functions appear consistent throughout the API.
func String ¶
String generates a random alphanumeric string, without vowels, which is n characters long. This will panic if n is less than zero. How the random string is created: - we generate random int63's - from each int63, we are extracting multiple random letters by bit-shifting and masking - if some index is out of range of alphanums we neglect it (unlikely to happen multiple times in a row)
func Tprintf ¶ added in v0.4.1
Tprintf passed template string is formatted usign its operands and returns the resulting string. Spaces are added between operands when neither is a string.
func TriggerCDMetrics ¶ added in v0.6.14
func TriggerCIMetrics ¶ added in v0.6.15
Types ¶
type CIMetrics ¶ added in v0.6.15
type CIMetrics struct { CacheDownDuration float64 `json:"cacheDownDuration"` PreCiDuration float64 `json:"preCiDuration"` BuildDuration float64 `json:"buildDuration"` PostCiDuration float64 `json:"postCiDuration"` CacheUpDuration float64 `json:"cacheUpDuration"` TotalDuration float64 `json:"totalDuration"` CacheDownStartTime time.Time `json:"cacheDownStartTime"` PreCiStartTime time.Time `json:"preCiStart"` BuildStartTime time.Time `json:"buildStartTime"` PostCiStartTime time.Time `json:"postCiStartTime"` CacheUpStartTime time.Time `json:"cacheUpStartTime"` TotalStartTime time.Time `json:"totalStartTime"` }
type CpuChecker ¶ added in v0.2.37
type CpuChecker struct{}
func (CpuChecker) IsFormat ¶ added in v0.2.37
func (f CpuChecker) IsFormat(input interface{}) bool
type CustomFormatCheckers ¶ added in v0.2.37
type CustomFormatCheckers struct { }
func NewGoJsonSchemaCustomFormatChecker ¶ added in v0.2.37
func NewGoJsonSchemaCustomFormatChecker() *CustomFormatCheckers
func (CustomFormatCheckers) AddCheckers ¶ added in v0.2.37
func (c CustomFormatCheckers) AddCheckers()
type DevtronSecretConfig ¶ added in v0.5.3
type DevtronSecretConfig struct {
DevtronSecretName string `env:"DEVTRON_SECRET_NAME" envDefault:"devtron-secret"`
}
func GetDevtronSecretName ¶ added in v0.5.3
func GetDevtronSecretName() (*DevtronSecretConfig, error)
type GlobalEnvVariables ¶ added in v0.3.17
type GlobalEnvVariables struct {
GitOpsRepoPrefix string `env:"GITOPS_REPO_PREFIX" envDefault:""`
}
func GetGlobalEnvVariables ¶ added in v0.3.17
func GetGlobalEnvVariables() (*GlobalEnvVariables, error)
type HeaderAdder ¶ added in v0.6.21
type HeaderAdder struct {
Rt http.RoundTripper
}
type HpaResourceRequest ¶ added in v0.6.18
type MemoryChecker ¶ added in v0.2.37
type MemoryChecker struct{}
func (MemoryChecker) IsFormat ¶ added in v0.2.37
func (f MemoryChecker) IsFormat(input interface{}) bool
type ServerVersion ¶ added in v0.3.9
type ServerVersion struct { GitCommit string `json:"gitCommit"` BuildTime string `json:"buildTime"` ServerMode string `json:"serverMode"` }
func GetDevtronVersion ¶ added in v0.3.9
func GetDevtronVersion() *ServerVersion