Documentation
¶
Index ¶
- func Age(unixTime int64) string
- func Clear(v interface{})
- func CombineManifests(yamls []string) string
- func ComputeHmacSha256(ak string, sk string) string
- func ContainsChinese(str string) bool
- func CreateVMJobLogFile(filename string) (string, error)
- func ExtractImageName(image string) string
- func GeneReleaseName(namingRule, projectName, namespace, envName, service string) string
- func GenerateTmpFile() (string, error)
- func GetAddress(uri string) (string, error)
- func GetBoolFromPointer(source *bool) bool
- func GetBoolPointer(data bool) *bool
- func GetDailyStartTimestamps(startTimestamp, endTimestamp int64) []int64
- func GetDaysInCurrentMonth(now time.Time) int
- func GetEnvSleepCronName(projectName, envName string, isEnable bool) string
- func GetFirstOfMonthDay(now time.Time) int64
- func GetImageNameFromContainerInfo(imageName, containerName string) string
- func GetInt32Pointer(data int32) *int32
- func GetInt64Pointer(data int64) *int64
- func GetJSONData(jsonValues map[string]interface{}) map[string]string
- func GetJiraKeys(title string) (keys []string)
- func GetMidnightTimestamp(timestamp int64) int64
- func GetPinyinFromChinese(han string) (string, string)
- func GetRandomNumString(length int) string
- func GetRandomString(length int) string
- func GetStrPointer(data string) *string
- func GetURLHostName(urlAddr string) string
- func Go(fn func())
- func HasSchema(url string) bool
- func InStringArray(target string, str_array []string) bool
- func IsSameDay(timestamp1 int64, timestamp2 int64) bool
- func IsValidIPv4(address string) bool
- func JSONToYaml(json map[string]interface{}) (string, error)
- func JoinYamls(files []string) string
- func OverrideValues(currentValuesYaml, latestValuesYaml []byte) ([]byte, error)
- func ParseOwnerAndRepo(repoLink string, authType types.AuthType) (string, string)
- func PathExists(path string) (bool, error)
- func ReadFile(filename string) ([]byte, error)
- func ReadValuesYAML(chartTree fs.FS, base string, logger *zap.SugaredLogger) ([]byte, error)
- func ReadValuesYAMLFromLocal(base string, logger *zap.SugaredLogger) ([]byte, error)
- func RecursionGetKeyAndValue(jsonValues map[string]interface{}, mapKey string)
- func RecursionReplaceValue(jsonValues map[string]interface{}, replaceKeyArr []string, ...)
- func RemoveExtraSpaces(input string) string
- func ReplaceMapValue(jsonValues map[string]interface{}, replaceMap map[string]interface{}) map[string]interface{}
- func ReplaceRepo(origin, addr, namespace string) string
- func ReplaceTag(origin, newTag string) string
- func ReplaceWrapLine(script string) string
- func ReturnValidLabelValue(value string) string
- func SendRequest(url, method string, header http.Header, body []byte) ([]byte, error)deprecated
- func SplitManifests(content string) []string
- func SplitYaml(yaml string) []string
- func TrimURLScheme(urlAddr string) string
- func UUID() string
- func WriteFile(filename string, data []byte, perm os.FileMode) error
- type KVInput
- type KeyValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Age ¶
Age returns a string representing the time elapsed since unixTime in the form "1d", "2h", "3m", or "4s".
func CombineManifests ¶
func ComputeHmacSha256 ¶
ComputeHmacSha256 According to ak/sk generate secret key
func ContainsChinese ¶
func CreateVMJobLogFile ¶
func ExtractImageName ¶
Test case reference https://github.com/containers/image/blob/main/docker/reference/reference_test.go
func GeneReleaseName ¶
func GenerateTmpFile ¶
func GetAddress ¶
func GetBoolFromPointer ¶
func GetBoolPointer ¶
func GetDailyStartTimestamps ¶
GetDailyStartTimestamps returns a slice of Unix timestamps representing the start of each day between startTimestamp and endTimestamp. It is worth mentioning that we will add an additional date timestamp just to make life easier.
func GetDaysInCurrentMonth ¶
GetDaysInCurrentMonth returns the number of days in the current month.
func GetEnvSleepCronName ¶
func GetFirstOfMonthDay ¶
func GetInt32Pointer ¶
func GetInt64Pointer ¶
func GetJSONData ¶
func GetJiraKeys ¶
func GetMidnightTimestamp ¶
func GetPinyinFromChinese ¶
func GetRandomNumString ¶
func GetRandomString ¶
func GetStrPointer ¶
func InStringArray ¶
func IsValidIPv4 ¶
func JSONToYaml ¶
func OverrideValues ¶
for keys exist in both yaml, current values will override the latest values
func ParseOwnerAndRepo ¶
ParseOwnerAndRepo extracts the owner and repo info from the given link, the link must have to following format: http(s)://example.com/owner/repo
func PathExists ¶
func ReadValuesYAML ¶
func ReadValuesYAMLFromLocal ¶
func ReadValuesYAMLFromLocal(base string, logger *zap.SugaredLogger) ([]byte, error)
func RecursionGetKeyAndValue ¶
RecursionGetKeyAndValue 递归获取map中的key和value
func RecursionReplaceValue ¶
func RecursionReplaceValue(jsonValues map[string]interface{}, replaceKeyArr []string, replaceValue interface{})
RecursionReplaceValue 递归替换map中的value
func RemoveExtraSpaces ¶
func ReplaceMapValue ¶
func ReplaceMapValue(jsonValues map[string]interface{}, replaceMap map[string]interface{}) map[string]interface{}
ReplaceMapValue 拿匹配到的key和value去替换原始的map中的key和value
func ReplaceRepo ¶
func ReplaceTag ¶
func ReplaceWrapLine ¶
func ReturnValidLabelValue ¶
value may only contain underscores or underscores
func SplitManifests ¶
func TrimURLScheme ¶
Types ¶
type KeyValue ¶
type KeyValue struct { Key string `json:"key"` Value interface{} `json:"value"` }
TODO: the key field of this struct only support non-nested value e.g. the key "a.b" will not be parse as a nested value this is different from the behavior of our normal service KV parsing. How we handle the KV should be decided after further discussion.