util

package
v1.9.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignImageData added in v1.9.9

func AssignImageData(imageUrl string, matchData map[string]string) (map[string]interface{}, error)

AssignImageData assign image url data into match data matchData: image=>absolute-path repo=>absolute-path tag=>absolute-path return: absolute-image-path=>image-value absolute-repo-path=>repo-value absolute-tag-path=>tag-value

func ChartDeployed added in v1.9.9

func ChartDeployed(render *templatemodels.ServiceRender, strategyMap map[string]string) bool

func CheckDefineResourceParam

func CheckDefineResourceParam(req setting.Request, reqSpec setting.RequestSpec) error

func ClipVariableYaml added in v1.9.9

func ClipVariableYaml(variableYaml string, validKeys []string) (string, error)

func ClipVariableYamlNoErr added in v1.9.9

func ClipVariableYamlNoErr(variableYaml string, validKeys []string) string

func CopyAndUploadService added in v1.9.9

func CopyAndUploadService(projectName, serviceName, currentChartPath string, copies []string, isProductionService bool) error

func CreateEnvServiceVersion added in v1.9.9

func CreateEnvServiceVersion(env *models.Product, prodSvc *models.ProductService, createBy string, log *zap.SugaredLogger) error

func DeployStrategyChanged added in v1.9.9

func DeployStrategyChanged(serviceName string, strategyMapOld map[string]string, strategyMapNew map[string]string) bool

func DownloadProductionServiceManifests added in v1.9.9

func DownloadProductionServiceManifests(base, productName, serviceName string) error

func DownloadServiceManifests added in v1.9.9

func DownloadServiceManifests(base, projectName, serviceName string, production bool) error

func ExtractImageName added in v1.9.9

func ExtractImageName(imageURI string) string

ExtractImageName extract image name from total image uri

func FilterKV added in v1.9.9

func FilterKV(varKV *commonmodels.VariableKV, keySet sets.String) bool

func GeneHelmMergedValues added in v1.9.9

func GeneHelmMergedValues(productSvc *commonmodels.ProductService, defaultValues string, renderChart *templatemodels.ServiceRender) (string, error)

@note can be deprecated or not? may duplicate with kube.GeneMergedValues

func GeneHelmRepo added in v1.9.9

func GeneHelmRepo(chartRepo *commonmodels.HelmRepo) *repo.Entry

func GeneImageURI added in v1.9.9

func GeneImageURI(pathData map[string]string, flatMap map[string]interface{}) (string, error)

GeneImageURI generate valid image uri, legal formats: {repo} {repo}/ {namespace}/{image} {repo}/{image} {repo}/{image}:{tag} {repo}:{tag} {image}:{tag} {image}

func GenerateEnvServiceNextRevision added in v1.9.9

func GenerateEnvServiceNextRevision(projectName, envName, serviceName string, isHelmChart bool) (int64, error)

func GenerateServiceNextRevision added in v1.9.9

func GenerateServiceNextRevision(isProductionService bool, serviceName, projectName string) (int64, error)

GenerateServiceNextRevision is used to generate the next revision of the service

func GetPresetRules added in v1.9.9

func GetPresetRules() []*templatemodels.ImageSearchingRule

func GetProductUsedTemplateSvcs added in v1.9.9

func GetProductUsedTemplateSvcs(prod *models.Product) ([]*models.Service, error)

func GetReleaseDeployStrategy added in v1.9.9

func GetReleaseDeployStrategy(releaseName string, strategyMap map[string]string) string

func GetReleaseDeployStrategyKey added in v1.9.9

func GetReleaseDeployStrategyKey(releaseName string) string

func GetReleaseNameToChartNameMap added in v1.9.9

func GetReleaseNameToChartNameMap(prod *models.Product) (map[string]string, error)

func GetReleaseNameToServiceNameMap added in v1.9.9

func GetReleaseNameToServiceNameMap(prod *models.Product) (map[string]string, error)

GetReleaseNameToServiceNameMap generates mapping relationship: releaseName=>serviceName

func GetServiceDeployStrategy added in v1.9.9

func GetServiceDeployStrategy(serviceName string, strategyMap map[string]string) string

func GetServiceNameToReleaseNameMap added in v1.9.9

func GetServiceNameToReleaseNameMap(prod *models.Product) (map[string]string, error)

GetServiceNameToReleaseNameMap generates mapping relationship: serviceName=>releaseName

func GetValidMatchData added in v1.9.9

func GetValidMatchData(spec *commonmodels.ImagePathSpec) map[string]string

func ImproveTemplateExecuteErrReadability added in v1.9.9

func ImproveTemplateExecuteErrReadability(err error) error

func IsServiceVarsWildcard added in v1.9.9

func IsServiceVarsWildcard(serviceVars []string) bool

func KVs2Set added in v1.9.9

func KVs2Set(kvs []*commonmodels.ServiceKeyVal) sets.String

func MergeServiceVariableKVsAndKVInput added in v1.9.9

func MergeServiceVariableKVsAndKVInput(serviceKVs []*commontypes.ServiceVariableKV, kvinput util.KVInput) (string, []*commontypes.ServiceVariableKV, error)

func ParseImagesByPresetRules added in v1.9.9

func ParseImagesByPresetRules(flatMap map[string]interface{}) ([]map[string]string, error)

ParseImagesByPresetRules parse images from flat yaml map with preset rules

func ParseImagesByRules added in v1.9.9

func ParseImagesByRules(nested map[string]interface{}, matchRules []*templatemodels.ImageSearchingRule) ([]*commonmodels.Container, error)

func ParseImagesForProductService added in v1.9.9

func ParseImagesForProductService(nested map[string]interface{}, serviceName, productName string) ([]*commonmodels.Container, error)

ParseImagesForProductService for product service

func PreLoadProductionServiceManifests added in v1.9.9

func PreLoadProductionServiceManifests(base string, svc *commonmodels.Service) error

func PreLoadServiceManifests added in v1.9.9

func PreLoadServiceManifests(base string, svc *commonmodels.Service, production bool) error

func PreloadProductionServiceManifestsByRevision added in v1.9.9

func PreloadProductionServiceManifestsByRevision(base string, svc *commonmodels.Service) error

func PreloadServiceManifestsByRevision added in v1.9.9

func PreloadServiceManifestsByRevision(base string, svc *commonmodels.Service, production bool) error

func ReleaseDeployed added in v1.9.9

func ReleaseDeployed(releaseName string, strategyMap map[string]string) bool

func RenderK8sSvcYaml added in v1.9.9

func RenderK8sSvcYaml(originYaml, productName, serviceName string, variableYamls ...string) (string, error)

@fixme MAY NOT support multi variableYamls, need to check won't return error if template key is missing values

func RenderK8sSvcYamlStrict added in v1.9.9

func RenderK8sSvcYamlStrict(originYaml, productName, serviceName string, variableYamls ...string) (string, error)

@fixme MAY NOT support multi variableYamls, need to check will return error if template key is missing values

func ReplaceImage added in v1.9.9

func ReplaceImage(sourceYaml string, imageValuesMap ...map[string]interface{}) (string, error)

ReplaceImage replace image defines in yaml by new version

func SaveAndUploadService added in v1.9.9

func SaveAndUploadService(projectName, serviceName string, copies []string, fileTree fs.FS, isProductionService bool) error

func ServiceDeployed added in v1.9.9

func ServiceDeployed(serviceName string, strategyMap map[string]string) bool

func SetChartDeployed added in v1.9.9

func SetChartDeployed(render *templatemodels.ServiceRender, strategyMap map[string]string)

func SetChartServiceDeployStrategyDepoly added in v1.9.9

func SetChartServiceDeployStrategyDepoly(strategyMap map[string]string, releaseName string) map[string]string

func SetChartServiceDeployStrategyImport added in v1.9.9

func SetChartServiceDeployStrategyImport(strategyMap map[string]string, releaseName string) map[string]string

func SetCurrentContainerImages added in v1.9.9

func SetCurrentContainerImages(args *commonmodels.Service) error

func SetServiceDeployStrategyDepoly added in v1.9.9

func SetServiceDeployStrategyDepoly(strategyMap map[string]string, serviceName string) map[string]string

func SetServiceDeployStrategyImport added in v1.9.9

func SetServiceDeployStrategyImport(strategyMap map[string]string, serviceName string) map[string]string

func UpdateProductImage added in v1.9.9

func UpdateProductImage(envName, productName, serviceName string, targets map[string]string, userName string, logger *zap.SugaredLogger) error

update product image info

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL