util

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignImageData

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

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

func CheckDefineResourceParam

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

func CheckZadigEnterpriseLicense added in v2.3.0

func CheckZadigEnterpriseLicense() error

func CheckZadigProfessionalLicense added in v2.3.0

func CheckZadigProfessionalLicense() error

func ClipVariableYaml

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

func ClipVariableYamlNoErr

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

func CopyAndUploadService

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

func CreateEnvServiceVersion

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

func DeployStrategyChanged

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

func DownloadProductionServiceManifests

func DownloadProductionServiceManifests(base, productName, serviceName string) error

func DownloadServiceManifests

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

func EnsureIstioGrayConfig

func EnsureIstioGrayConfig(ctx context.Context, baseEnv *commonmodels.Product) error

func ExtractImageName

func ExtractImageName(imageURI string) string

ExtractImageName extract image name from total image uri

func FetchGrayEnvs

func FetchGrayEnvs(ctx context.Context, productName, clusterID, baseEnvName string) ([]*commonmodels.Product, error)

func FilterKV

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

func GenIstioGatewayName

func GenIstioGatewayName(serviceName string) string

func GeneHelmMergedValues

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

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

func GeneImageURI

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

func GenerateEnvServiceNextRevision(projectName, envName, serviceName string, isHelmChart bool, session mongo.Session) (int64, error)

func GenerateServiceNextRevision

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

GenerateServiceNextRevision is used to generate the next revision of the service

func GetAWSRegistryCredential

func GetAWSRegistryCredential(id, ak, sk, region string) (realAK string, realSK string, err error)

func GetPresetRules

func GetPresetRules() []*templatemodels.ImageSearchingRule

func GetProductUsedTemplateSvcs

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

func GetReleaseDeployStrategy

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

func GetReleaseDeployStrategyKey

func GetReleaseDeployStrategyKey(releaseName string) string

func GetReleaseNameToChartNameMap

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

func GetReleaseNameToServiceNameMap

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

GetReleaseNameToServiceNameMap generates mapping relationship: releaseName=>serviceName

func GetServiceDeployStrategy

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

func GetServiceNameToReleaseNameMap

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

GetServiceNameToReleaseNameMap generates mapping relationship: serviceName=>releaseName

func GetValidMatchData

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

func ImproveTemplateExecuteErrReadability

func ImproveTemplateExecuteErrReadability(err error) error

func IsServiceVarsWildcard

func IsServiceVarsWildcard(serviceVars []string) bool

func KVs2Set

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

func MergeServiceVariableKVsAndKVInput

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

func ParseImagesByPresetRules

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

ParseImagesByPresetRules parse images from flat yaml map with preset rules

func ParseImagesByRules

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

func ParseImagesForProductService

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

ParseImagesForProductService for product service

func PreLoadProductionServiceManifests

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

func PreLoadServiceManifests

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

func PreloadProductionServiceManifestsByRevision

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

func PreloadServiceManifestsByRevision

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

func ReleaseDeployed

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

func RenderK8sSvcYaml

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

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

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

ReplaceImage replace image defines in yaml by new version

func SaveAndUploadService

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

func ServiceDeployed

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

func SetChartDeployed

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

func SetChartServiceDeployStrategyDepoly

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

func SetChartServiceDeployStrategyImport

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

func SetCurrentContainerImages

func SetCurrentContainerImages(args *commonmodels.Service) error

func SetServiceDeployStrategyDepoly

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

func SetServiceDeployStrategyImport

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

func UpdateProductImage

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

update product image info

func ValidateZadigEnterpriseLicense added in v2.3.0

func ValidateZadigEnterpriseLicense(licenseStatus *plutusvendor.ZadigXLicenseStatus) bool

func ValidateZadigProfessionalLicense added in v2.3.0

func ValidateZadigProfessionalLicense(licenseStatus *plutusvendor.ZadigXLicenseStatus) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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