service

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: 113 Imported by: 0

Documentation

Index

Constants

View Source
const K8sBetaVersionForEphemeralContainer = "v1.23"
View Source
const (
	Timeout = 60
)
View Source
const ZadigDebugContainerName = "zadig-debug"

Variables

View Source
var ClusterInformersMap sync.Map
View Source
var ClusterStopChanMap sync.Map
View Source
var DefaultCleanWhiteList = []string{"spockadmin"}
View Source
var ErrUnsupportedService = errors.New("unsupported workload type (only support Deployment/StatefulSet) or workload number is not 1")

Functions

func AutoDeployHelmServiceToEnvs

func AutoDeployHelmServiceToEnvs(userName, requestID, projectName string, serviceTemplates []*commonmodels.Service, log *zap.SugaredLogger) error

func AutoDeployYamlServiceToEnvs

func AutoDeployYamlServiceToEnvs(userName, requestID string, serviceTemplate *commonmodels.Service, production bool, log *zap.SugaredLogger) error

func BulkCopyHelmProduct

func BulkCopyHelmProduct(projectName, user, requestID string, arg CopyHelmProductArg, log *zap.SugaredLogger) error

func BulkCopyYamlProduct

func BulkCopyYamlProduct(projectName, user, requestID string, arg CopyYamlProductArg, log *zap.SugaredLogger) error

func CalculateK8sProductStatus

func CalculateK8sProductStatus(productInfo *commonmodels.Product, log *zap.SugaredLogger) (string, error)

func CalculateNonK8sProductStatus

func CalculateNonK8sProductStatus(productInfo *commonmodels.Product, log *zap.SugaredLogger) (string, error)

CalculateNonK8sProductStatus calculate product status for non k8s product: Helm

func CheckServicesDeployedInSubEnvs

func CheckServicesDeployedInSubEnvs(ctx context.Context, productName, envName string, services []string) (map[string][]string, error)

Map of map[ServiceName][]string{EnvName} is returned.

func CheckWorkloadsK8sServices

func CheckWorkloadsK8sServices(ctx context.Context, envName, productName string, production bool) ([]string, error)

Slice of `<workload name>.<workload type>` and error are returned.

func CleanProductCronJob

func CleanProductCronJob(requestID string, log *zap.SugaredLogger)

func CleanProducts

func CleanProducts()

func ConnectSshPmExec

func ConnectSshPmExec(c *gin.Context, username, envName, productName, ip, hostId string, cols, rows int, log *zap.SugaredLogger) error

func CopyHelmProduct

func CopyHelmProduct(productName, userName, requestID string, args []*CreateSingleProductArg, log *zap.SugaredLogger) error

CopyHelmProduct copy product from source product, only works in test product

func CopyYamlProduct

func CopyYamlProduct(user, requestID, projectName string, args []*CreateSingleProductArg, log *zap.SugaredLogger) (err error)

CopyYamlProduct copy product from source product

func CreateCommonEnvCfg

func CreateCommonEnvCfg(args *models.CreateUpdateCommonEnvCfgArgs, userName string, log *zap.SugaredLogger) error

func CreateHelmProduct

func CreateHelmProduct(productName, userName, requestID string, args []*CreateSingleProductArg, log *zap.SugaredLogger) error

CreateHelmProduct create helm product, only works in test product

func CreateHostProductionProduct

func CreateHostProductionProduct(productName, userName, requestID string, args []*CreateSingleProductArg, log *zap.SugaredLogger) error

CreateHostProductionProduct creates environment for host project, this function only creates production environment

func CreateProduct

func CreateProduct(user, requestID string, args *ProductCreateArg, log *zap.SugaredLogger) (err error)

CreateProduct create a new product with its dependent stacks

func CreateYamlProduct

func CreateYamlProduct(productName, userName, requestID string, args []*CreateSingleProductArg, log *zap.SugaredLogger) error

func DeleteClusterInformer

func DeleteClusterInformer(clusterID string)

func DeleteCommonEnvCfg

func DeleteCommonEnvCfg(envName, productName, objectName string, commonEnvCfgType config.CommonEnvCfgType, production bool, log *zap.SugaredLogger) error

func DeletePod

func DeletePod(envName, productName, podName string, production bool, log *zap.SugaredLogger) error

func DeleteProduct

func DeleteProduct(username, envName, productName, requestID string, isDelete bool, log *zap.SugaredLogger) (err error)

func DeleteProductHelmReleases

func DeleteProductHelmReleases(userName, requestID, envName, productName string, releases []string, production bool, log *zap.SugaredLogger) (err error)

func DeleteProductServices

func DeleteProductServices(userName, requestID, envName, productName string, serviceNames []string, production bool, log *zap.SugaredLogger) (err error)

func DeleteProductionProduct

func DeleteProductionProduct(username, envName, productName, requestID string, log *zap.SugaredLogger) (err error)

func DisableBaseEnv

func DisableBaseEnv(ctx context.Context, envName, productName string) error

func DisableIstioGrayscale

func DisableIstioGrayscale(ctx context.Context, envName, productName string) error

func DownloadFile

func DownloadFile(envName, productName, podName, container, path string, production bool, log *zap.SugaredLogger) ([]byte, string, error)

func EnableBaseEnv

func EnableBaseEnv(ctx context.Context, envName, productName string) error

func EnableIstioGrayscale

func EnableIstioGrayscale(ctx context.Context, envName, productName string) error

func EnsureDeleteShareEnvConfig

func EnsureDeleteShareEnvConfig(ctx context.Context, env *commonmodels.Product, istioClient versionedclient.Interface) error

func EnsureDeleteZadigService

func EnsureDeleteZadigService(ctx context.Context, env *commonmodels.Product, svcName string, kclient client.Client, istioClient versionedclient.Interface) error

func EnsureProductionNamespace

func EnsureProductionNamespace(createArgs []*CreateSingleProductArg) error

func EnsureUpdateZadigService

func EnsureUpdateZadigService(ctx context.Context, env *commonmodels.Product, svcName string, kclient client.Client, istioClient versionedclient.Interface) error

func EnvAnalysisNotification

func EnvAnalysisNotification(projectName, envName, result string, configs []*commonmodels.NotificationConfig) error

func EnvSleep

func EnvSleep(productName, envName string, isEnable, isProduction bool, log *zap.SugaredLogger) error

func ExportYaml

func ExportYaml(envName, productName, serviceName, source string, production bool, log *zap.SugaredLogger) []string

ExportYaml 查询使用到服务模板的服务组模板 source determines where the request comes from, can be "wd" or "nil"

func FetchServiceYaml

func FetchServiceYaml(productName, envName, serviceName string, _ *zap.SugaredLogger) (string, error)

func GeneEstimatedValues

func GeneEstimatedValues(productName, envName, serviceOrReleaseName, scene, format string, arg *EstimateValuesArg, isHelmChartDeploy bool, log *zap.SugaredLogger) (interface{}, error)

func GetAffectedServices

func GetAffectedServices(productName, envName string, arg *K8sRendersetArg, log *zap.SugaredLogger) (map[string][]string, error)

func GetBundleResources

func GetBundleResources(logger *zap.SugaredLogger) ([]*resourceSpec, error)

func GetEnvAnalysisHistory

func GetEnvAnalysisHistory(projectName string, production bool, envName string, pageNum, pageSize int, log *zap.SugaredLogger) ([]*ai.EnvAIAnalysis, int64, error)

GetEnvAnalysisHistory get env AI analysis history

func GetEnvServiceList

func GetEnvServiceList(ctx context.Context, productName, baseEnvName string) ([][]string, error)

func GetEstimatedRenderCharts

func GetEstimatedRenderCharts(productName, envName string, getSvcRenderArgs []*commonservice.GetSvcRenderArg, production bool, log *zap.SugaredLogger) ([]*commonservice.HelmSvcRenderArg, error)

func GetGlobalVariableCandidate

func GetGlobalVariableCandidate(productName, envName string, log *zap.SugaredLogger) ([]*commontypes.ServiceVariableKV, error)

func GetGlobalVariables

func GetGlobalVariables(productName, envName string, production bool, log *zap.SugaredLogger) ([]*commontypes.GlobalVariableKV, int64, error)

func GetInitProduct

func GetInitProduct(productTmplName string, envType types.EnvType, isBaseEnv bool, baseEnvName string, production bool, log *zap.SugaredLogger) (*commonmodels.Product, error)

func GetIstioGrayscaleConfig

func GetIstioGrayscaleConfig(ctx context.Context, envName, productName string) (commonmodels.IstioGrayscale, error)

func GetK8sResourceYaml

func GetK8sResourceYaml(args *FetchResourceArgs, log *zap.SugaredLogger) (string, error)

func GetMergedYamlContent

func GetMergedYamlContent(arg *YamlContentRequestArg, paths []string) (string, error)

func GetPodDetailInfo

func GetPodDetailInfo(projectName, envName, podName string, production bool, log *zap.SugaredLogger) (*resource.Pod, error)

func GetProductAndFilterNs

func GetProductAndFilterNs(namespace, workloadName, svcName string) (*models.Product, bool)

func GetProductDeployType

func GetProductDeployType(projectName string) (string, error)

func GetService

func GetService(envName, productName, serviceName string, production bool, workLoadType string, log *zap.SugaredLogger) (ret *commonservice.SvcResp, err error)

func GetZadigReleaseServiceImpl

func GetZadigReleaseServiceImpl(releaseType, serviceName string, _ string, env *commonmodels.Product, kubeClient client.Client, _ *kubernetes.Clientset, inf informers.SharedInformerFactory, log *zap.SugaredLogger) (ret *commonservice.SvcResp, err error)

func InitializeEnvironment

func InitializeEnvironment(projectKey string, envArgs []*commonmodels.Product, envType string, log *zap.SugaredLogger) error

func InstallService

func InstallService(helmClient *helmtool.HelmClient, param *kube.ReleaseInstallParam) error

func ListDeploymentNames

func ListDeploymentNames(clusterID, namespace string, log *zap.SugaredLogger) ([]string, error)

func ListGroups

func ListGroups(serviceName, envName, productName string, perPage, page int, production bool, log *zap.SugaredLogger) ([]*commonservice.ServiceResp, int, error)

func ListKubeEvents

func ListKubeEvents(env string, productName string, name string, rtype string, log *zap.SugaredLogger) ([]*resource.Event, error)

func ListNamespace

func ListNamespace(clusterID string, log *zap.SugaredLogger) ([]string, error)

func ListPodEvents

func ListPodEvents(envName, productName, podName string, production bool, log *zap.SugaredLogger) ([]*resource.Event, error)

func ListProductionGroups

func ListProductionGroups(serviceName, envName, productName string, perPage, page int, log *zap.SugaredLogger) ([]*commonservice.ServiceResp, int, error)

func MigrateHistoryConfigMaps

func MigrateHistoryConfigMaps(envName, productName string, production bool, log *zap.SugaredLogger) ([]*models.EnvResource, error)

func NewClusterInformerFactory

func NewClusterInformerFactory(clusterID string, cls *kubernetes.Clientset) (informers.SharedInformerFactory, error)

func OpenAPICreateCommonEnvCfg

func OpenAPICreateCommonEnvCfg(projectName string, args *OpenAPIEnvCfgArgs, userName string, logger *zap.SugaredLogger) error

func OpenAPICreateK8sEnv

func OpenAPICreateK8sEnv(args *OpenAPICreateEnvArgs, userName, requestID string, logger *zap.SugaredLogger) error

func OpenAPICreateProductionEnv

func OpenAPICreateProductionEnv(args *OpenAPICreateEnvArgs, userName, requestID string, logger *zap.SugaredLogger) error

func OpenAPIDeleteCommonEnvCfg

func OpenAPIDeleteCommonEnvCfg(projectName, envName, cfgType, name string, logger *zap.SugaredLogger) error

func OpenAPIDeleteProductionEnvCommonEnvCfg

func OpenAPIDeleteProductionEnvCommonEnvCfg(projectName, envName, cfgType, name string, logger *zap.SugaredLogger) error

func OpenAPIGetGlobalVariables

func OpenAPIGetGlobalVariables(projectName, envName string, production bool, logger *zap.SugaredLogger) ([]*commontypes.GlobalVariableKV, error)

func OpenAPIRestartService

func OpenAPIRestartService(projectName, envName, serviceName string, production bool, logger *zap.SugaredLogger) error

func OpenAPIScale

func OpenAPIScale(req *OpenAPIScaleServiceReq, logger *zap.SugaredLogger) error

func OpenAPIUpdateCommonEnvCfg

func OpenAPIUpdateCommonEnvCfg(projectName string, args *OpenAPIEnvCfgArgs, userName string, logger *zap.SugaredLogger) error

func OpenAPIUpdateEnvBasicInfo

func OpenAPIUpdateEnvBasicInfo(args *EnvBasicInfoArgs, userName, projectName, envName string, production bool, logger *zap.SugaredLogger) error

func OpenAPIUpdateGlobalVariables

func OpenAPIUpdateGlobalVariables(args *OpenAPIEnvGlobalVariables, userName, requestID, projectName, envName string, production bool, logger *zap.SugaredLogger) error

func OpenAPIUpdateYamlService

func OpenAPIUpdateYamlService(req *OpenAPIServiceVariablesReq, userName, requestID, projectName, envName string, production bool, logger *zap.SugaredLogger) error

func PatchDebugContainer

func PatchDebugContainer(ctx context.Context, projectName, envName, podName, debugImage string, production bool) error

func PatchWorkload

func PatchWorkload(ctx context.Context, projectName, envName, serviceName, devImage string) (*types.WorkloadInfo, error)

func ReInstallHelmSvcInAllEnvs

func ReInstallHelmSvcInAllEnvs(productName string, templateSvc *commonmodels.Service, production bool) error

ReInstallHelmSvcInAllEnvs reinstall svc in all envs in which the svc is already installed

func RecoverWorkload

func RecoverWorkload(ctx context.Context, projectName, envName, serviceName string) error

func ResetProductsStatus

func ResetProductsStatus()

func RestartScale

func RestartScale(args *RestartScaleArgs, production bool, _ *zap.SugaredLogger) error

func RestartService

func RestartService(envName string, args *SvcOptArgs, production bool, log *zap.SugaredLogger) (err error)

RestartService 在kube中, 如果资源存在就更新不存在就创建

func RollBackConfigMap

func RollBackConfigMap(envName string, args *RollBackConfigMapArgs, userName, userID string, log *zap.SugaredLogger) error

func RollbackEnvServiceVersion

func RollbackEnvServiceVersion(ctx *internalhandler.Context, projectName, envName, serviceName string, revision int64, isHelmChart, isProduction bool, log *zap.SugaredLogger) error

func Scale

func Scale(args *ScaleArgs, logger *zap.SugaredLogger) error

func SetIstioGrayscaleConfig

func SetIstioGrayscaleConfig(ctx context.Context, envName, productName string, req kube.SetIstioGrayscaleConfigRequest) error

func SetupIstioGrayscalePortalService

func SetupIstioGrayscalePortalService(ctx context.Context, productName, envName, serviceName string, servers []SetupPortalServiceRequest) error

func SetupPortalService

func SetupPortalService(ctx context.Context, productName, envName, serviceName string, servers []SetupPortalServiceRequest) error

func StartClusterInformer

func StartClusterInformer()

func SyncEnvResource

func SyncEnvResource(args *SyncEnvResourceArg, log *zap.SugaredLogger) error

func SyncHelmProductEnvironment

func SyncHelmProductEnvironment(productName, envName, requestID string, log *zap.SugaredLogger) error

func SyncYamlFromSource

func SyncYamlFromSource(yamlData *templatemodels.CustomYaml, curValue string) (bool, string, error)

SyncYamlFromSource sync values.yaml from source NOTE for git source currently only support gitHub and gitlab

func UpdateCVMProduct

func UpdateCVMProduct(envName, productName, user, requestID string, log *zap.SugaredLogger) error

func UpdateCommonEnvCfg

func UpdateCommonEnvCfg(args *models.CreateUpdateCommonEnvCfgArgs, userName string, updateContentOnly bool, log *zap.SugaredLogger) error

func UpdateConfigMap

func UpdateConfigMap(args *models.CreateUpdateCommonEnvCfgArgs, userName string, log *zap.SugaredLogger) error

func UpdateContainerImage

func UpdateContainerImage(requestID, username string, args *UpdateContainerImageArgs, log *zap.SugaredLogger) error

func UpdateEnvConfigs

func UpdateEnvConfigs(projectName, envName string, arg *EnvConfigsArgs, production *bool, logger *zap.SugaredLogger) error

func UpdateHelmProductCharts

func UpdateHelmProductCharts(productName, envName, userName, requestID string, production bool, args *EnvRendersetArg, log *zap.SugaredLogger) error

func UpdateOrCreateIngress

func UpdateOrCreateIngress(args *models.CreateUpdateCommonEnvCfgArgs, userName string, isCreate bool, log *zap.SugaredLogger) error

func UpdateProductAlias

func UpdateProductAlias(envName, productName, alias string, production bool) error

func UpdateProductDefaultValues

func UpdateProductDefaultValues(productName, envName, userName, requestID string, args *EnvRendersetArg, production bool, log *zap.SugaredLogger) error

func UpdateProductDefaultValuesWithRender

func UpdateProductDefaultValuesWithRender(product *commonmodels.Product, _ *models.RenderSet, userName, requestID string, args *EnvRendersetArg, production bool, log *zap.SugaredLogger) error

func UpdateProductGlobalVariables

func UpdateProductGlobalVariables(productName, envName, userName, requestID string, currentRevision int64, arg []*commontypes.GlobalVariableKV, production bool, log *zap.SugaredLogger) error

func UpdateProductGlobalVariablesWithRender

func UpdateProductGlobalVariablesWithRender(product *commonmodels.Product, productRenderset *models.RenderSet, userName, requestID string, args []*commontypes.GlobalVariableKV, log *zap.SugaredLogger) error

func UpdateProductRecycleDay

func UpdateProductRecycleDay(envName, productName string, recycleDay int) error

func UpdateProductRegistry

func UpdateProductRegistry(envName, productName, registryID string, production bool, log *zap.SugaredLogger) (err error)

func UpdateProductVariable

func UpdateProductVariable(productName, envName, username, requestID string, updatedSvcs []*templatemodels.ServiceRender,
	_ []*commontypes.GlobalVariableKV, defaultValue string, yamlData *templatemodels.CustomYaml, log *zap.SugaredLogger) error

func UpdateProductionEnvConfigs

func UpdateProductionEnvConfigs(projectName, envName string, arg *EnvConfigsArgs, logger *zap.SugaredLogger) error

func UpdatePvc

func UpdatePvc(args *models.CreateUpdateCommonEnvCfgArgs, userName string, log *zap.SugaredLogger) error

func UpdateSecret

func UpdateSecret(args *models.CreateUpdateCommonEnvCfgArgs, userName string, log *zap.SugaredLogger) error

func UpdateService

func UpdateService(args *SvcOptArgs, log *zap.SugaredLogger) error

func UpsertEnvAnalysisCron

func UpsertEnvAnalysisCron(projectName, envName string, production *bool, req *EnvAnalysisCronArg, logger *zap.SugaredLogger) error

func UpsertEnvSleepCron

func UpsertEnvSleepCron(projectName, envName string, production *bool, req *EnvSleepCronArg, logger *zap.SugaredLogger) error

func VersionLessThan121

func VersionLessThan121(ver *k8sversion.Info) bool

func VisitDeployment

func VisitDeployment(deployment *appsv1.Deployment) (sets.String, sets.String, sets.String)

func VisitStatefulSet

func VisitStatefulSet(sts *appsv1.StatefulSet) (sets.String, sets.String, sets.String)

Types

type AutoCreateProductParam

type AutoCreateProductParam struct {
	UserName    string
	RequestId   string
	ProductName string
	EnvType     string

	RegistryID string
	// contains filtered or unexported fields
}

type AutoCreator

type AutoCreator struct {
	Param *AutoCreateProductParam
}

func (*AutoCreator) Create

func (autoCreator *AutoCreator) Create(envName string) (string, error)

type AvailableNamespace

type AvailableNamespace struct {
	*resource.Namespace
	Used bool `json:"used_by_other_env"`
}

func ListAvailableNamespaces

func ListAvailableNamespaces(clusterID, listType string, log *zap.SugaredLogger) ([]*AvailableNamespace, error)

ListAvailableNamespaces lists available namespaces created by non-koderover

type CfgRepoInfo

type CfgRepoInfo struct {
	GitRepoConfig *GitRepoConfig `bson:"git_repo_config,omitempty"      json:"git_repo_config,omitempty"`
	LoadPath      string         `bson:"load_path,omitempty"            json:"load_path,omitempty"`
}

type ChartImagesResp

type ChartImagesResp struct {
	ServiceImages []*ServiceImages `json:"serviceImages"`
}

func GetImageInfos

func GetImageInfos(productName, envName, serviceNames string, production bool, log *zap.SugaredLogger) (*ChartImagesResp, error)

type ChartInfo

type ChartInfo struct {
	ServiceName string `json:"serviceName"`
	Revision    int64  `json:"revision"`
}

type ConfigTmplData

type ConfigTmplData struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type ContainerNotFound

type ContainerNotFound struct {
	ServiceName string
	Container   string
	EnvName     string
	ProductName string
}

func (*ContainerNotFound) Error

func (c *ContainerNotFound) Error() string

type CopyHelmProductArg

type CopyHelmProductArg struct {
	Items []HelmProductItem
}

type CopyYamlProductArg

type CopyYamlProductArg struct {
	Items []YamlProductItem `json:"items"`
}

type CreateEnvRequest

type CreateEnvRequest struct {
	Scene       string `form:"scene"`
	Type        string `form:"type"`
	ProjectName string `form:"projectName"`
	Auto        bool   `form:"auto"`
	EnvType     string `form:"envType"`
}

type CreateSingleProductArg

type CreateSingleProductArg struct {
	ProductName string `json:"product_name"`
	EnvName     string `json:"env_name"`
	Namespace   string `json:"namespace"`
	ClusterID   string `json:"cluster_id"`
	RegistryID  string `json:"registry_id"`
	Production  bool   `json:"production"`
	Alias       string `json:"alias"`
	BaseEnvName string `json:"base_env_name"`
	BaseName    string `json:"base_name,omitempty"` // for collaboration mode

	DefaultValues string `json:"default_values"`
	// TODO fix me
	HelmDefaultValues string `json:"defaultValues"`
	// for helm products
	ValuesData  *commonservice.ValuesDataArgs     `json:"valuesData"`
	ChartValues []*ProductHelmServiceCreationInfo `json:"chartValues"`

	// for k8s products
	GlobalVariables []*commontypes.GlobalVariableKV    `json:"global_variables"`
	Services        [][]*ProductK8sServiceCreationInfo `json:"services"`

	IsExisted bool `json:"is_existed"`

	// New Since v1.12.0
	ShareEnv commonmodels.ProductShareEnv `json:"share_env"`
	// New Since v1.13.0
	EnvConfigs []*commonmodels.CreateUpdateCommonEnvCfgArgs `json:"env_configs"`
	// New Since v2.1.0
	IstioGrayscale commonmodels.IstioGrayscale `json:"istio_grayscale"`
}

type DefaultValuesResp

type DefaultValuesResp struct {
	DefaultVariable string                     `json:"default_variable"`
	YamlData        *templatemodels.CustomYaml `json:"yaml_data,omitempty"`
}

func GetDefaultValues

func GetDefaultValues(productName, envName string, production bool, log *zap.SugaredLogger) (*DefaultValuesResp, error)

type DeployStatus

type DeployStatus string
const (
	StatusDeployed   DeployStatus = "deployed"
	StatusUnDeployed DeployStatus = "undeployed"
)

type DiffEnvServiceVersionsResponse

type DiffEnvServiceVersionsResponse struct {
	Type          string `json:"type"`
	YamlA         string `json:"yaml_a"`
	YamlB         string `json:"yaml_b"`
	VariableYamlA string `json:"variable_yaml_a"`
	VariableYamlB string `json:"variable_yaml_b"`
}

func DiffEnvServiceVersions

func DiffEnvServiceVersions(ctx *internalhandler.Context, projectName, envName, serviceName string, revisionA, revisionB int64, isHelmChart, isProduction bool, log *zap.SugaredLogger) (DiffEnvServiceVersionsResponse, error)

type EnvAnalysisCronArg

type EnvAnalysisCronArg struct {
	Enable bool   `json:"enable"`
	Cron   string `json:"cron"`
}

func GetEnvAnalysisCron

func GetEnvAnalysisCron(projectName, envName string, production *bool, logger *zap.SugaredLogger) (*EnvAnalysisCronArg, error)

type EnvAnalysisRespone

type EnvAnalysisRespone struct {
	Result string `json:"result"`
}

func EnvAnalysis

func EnvAnalysis(projectName, envName string, production *bool, triggerName string, userName string, logger *zap.SugaredLogger) (*EnvAnalysisRespone, error)

type EnvBasicInfoArgs

type EnvBasicInfoArgs struct {
	RegistryID string `json:"registry_id"`
	Alias      string `json:"env_name"`
}

type EnvCfgArgs

type EnvCfgArgs struct {
	Name             string                  `json:"name"`
	AutoSync         bool                    `json:"auto_sync"`
	CommonEnvCfgType string                  `json:"common_env_cfg_type"`
	YamlData         string                  `json:"yaml_data"`
	GitRepoConfig    *template.GitRepoConfig `json:"git_repo_config"`
}

type EnvConfigsArgs

type EnvConfigsArgs struct {
	AnalysisConfig      *models.AnalysisConfig       `json:"analysis_config"`
	NotificationConfigs []*models.NotificationConfig `json:"notification_configs"`
}

func GetEnvConfigs

func GetEnvConfigs(projectName, envName string, production *bool, logger *zap.SugaredLogger) (*EnvConfigsArgs, error)

func GetProductionEnvConfigs

func GetProductionEnvConfigs(projectName, envName string, logger *zap.SugaredLogger) (*EnvConfigsArgs, error)

type EnvGroupRequest

type EnvGroupRequest struct {
	ProjectName string `form:"projectName"`
	Page        int    `form:"page"`
	PerPage     int    `form:"perPage"`
	ServiceName string `form:"serviceName"`
}

type EnvRenderChartArg

type EnvRenderChartArg struct {
	ChartValues []*commonservice.HelmSvcRenderArg `json:"chartValues"`
}

type EnvRendersetArg

type EnvRendersetArg struct {
	DeployType        string                            `json:"deployType"`
	DefaultValues     string                            `json:"defaultValues"`
	ValuesData        *commonservice.ValuesDataArgs     `json:"valuesData"`
	ChartValues       []*commonservice.HelmSvcRenderArg `json:"chartValues"`
	UpdateServiceTmpl bool                              `json:"updateServiceTmpl"`
}

type EnvResp

type EnvResp struct {
	ProjectName string   `json:"projectName"`
	Status      string   `json:"status"`
	Error       string   `json:"error"`
	Name        string   `json:"name"`
	UpdateBy    string   `json:"updateBy"`
	UpdateTime  int64    `json:"updateTime"`
	IsPublic    bool     `json:"isPublic"`
	ClusterName string   `json:"clusterName"`
	ClusterID   string   `json:"cluster_id"`
	Namespace   string   `json:"namespace"`
	Alias       string   `json:"alias"`
	Production  bool     `json:"production"`
	Source      string   `json:"source"`
	RegistryID  string   `json:"registry_id"`
	BaseRefs    []string `json:"base_refs"`
	BaseName    string   `json:"base_name"`
	IsExisted   bool     `json:"is_existed"`
	IsFavorite  bool     `json:"is_favorite"`
	SharedNS    bool     `json:"shared_ns"`

	// New Since v1.11.0
	ShareEnvEnable  bool   `json:"share_env_enable"`
	ShareEnvIsBase  bool   `json:"share_env_is_base"`
	ShareEnvBaseEnv string `json:"share_env_base_env"`

	// New Since v2.1.0
	IstioGrayscaleEnable  bool   `json:"istio_grayscale_enable"`
	IstioGrayscaleIsBase  bool   `json:"istio_grayscale_is_base"`
	IstioGrayscaleBaseEnv string `json:"istio_grayscale_base_env"`
}

func ListProductionEnvs

func ListProductionEnvs(userId string, projectName string, envNames []string, log *zap.SugaredLogger) ([]*EnvResp, error)

func ListProducts

func ListProducts(userID, projectName string, envNames []string, production bool, log *zap.SugaredLogger) ([]*EnvResp, error)

type EnvSleepCronArg

type EnvSleepCronArg struct {
	SleepCronEnable bool   `json:"sleep_cron_enable"`
	SleepCron       string `json:"sleep_cron"`
	AwakeCronEnable bool   `json:"awake_cron_enable"`
	AwakeCron       string `json:"awake_cron"`
}

func GetEnvSleepCron

func GetEnvSleepCron(projectName, envName string, production *bool, logger *zap.SugaredLogger) (*EnvSleepCronArg, error)

type EnvStatus

type EnvStatus struct {
	EnvName    string `json:"env_name,omitempty"`
	Status     string `json:"status"`
	ErrMessage string `json:"err_message"`
}

func AutoCreateProduct

func AutoCreateProduct(productName, envType, requestID string, log *zap.SugaredLogger) []*EnvStatus

AutoCreateProduct happens in onboarding progress of pm project

func OpenAPIApplyYamlService

func OpenAPIApplyYamlService(projectKey string, req *OpenAPIApplyYamlServiceReq, production bool, requestID string, logger *zap.SugaredLogger) ([]*EnvStatus, error)

func UpdateMultiCVMProducts

func UpdateMultiCVMProducts(envNames []string, productName, user, requestID string, log *zap.SugaredLogger) ([]*EnvStatus, error)

func UpdateMultipleHelmChartEnv

func UpdateMultipleHelmChartEnv(requestID, userName string, args *UpdateMultiHelmProductArg, production bool, log *zap.SugaredLogger) ([]*EnvStatus, error)

func UpdateMultipleHelmEnv

func UpdateMultipleHelmEnv(requestID, userName string, args *UpdateMultiHelmProductArg, production bool, log *zap.SugaredLogger) ([]*EnvStatus, error)

func UpdateMultipleK8sEnv

func UpdateMultipleK8sEnv(args []*UpdateEnv, envNames []string, productName, requestID string, force, production bool, log *zap.SugaredLogger) ([]*EnvStatus, error)

type EnvoyAddress

type EnvoyAddress struct {
	SocketAddress EnvoySocketAddress `json:"socket_address"`
}

type EnvoyClusterConfigLoadAssignment

type EnvoyClusterConfigLoadAssignment struct {
	ClusterName string             `json:"cluster_name"`
	Endpoints   []EnvoyLBEndpoints `json:"endpoints"`
}

type EnvoyEndpoint

type EnvoyEndpoint struct {
	Address EnvoyAddress `json:"address"`
}

type EnvoyEndpoints

type EnvoyEndpoints struct {
	Endpoint EnvoyEndpoint `json:"endpoint"`
}

type EnvoyLBEndpoints

type EnvoyLBEndpoints struct {
	LBEndpoints []EnvoyEndpoints `json:"lb_endpoints"`
}

type EnvoySocketAddress

type EnvoySocketAddress struct {
	Protocol  string `json:"protocol"`
	Address   string `json:"address"`
	PortValue int    `json:"port_value"`
}

type EstimateValuesArg

type EstimateValuesArg struct {
	ChartRepo      string                  `json:"chartRepo,omitempty"`
	ChartName      string                  `json:"chartName,omitempty"`
	ChartVersion   string                  `json:"chartVersion,omitempty"`
	DefaultValues  string                  `json:"defaultValues"`
	OverrideYaml   string                  `json:"overrideYaml"`
	OverrideValues []*commonservice.KVPair `json:"overrideValues,omitempty"`
	Production     bool                    `json:"-"`
}

type ExternalProductCreator

type ExternalProductCreator struct {
}

func (*ExternalProductCreator) Create

func (creator *ExternalProductCreator) Create(user, requestID string, args *ProductCreateArg, log *zap.SugaredLogger) error

type FetchResourceArgs

type FetchResourceArgs struct {
	EnvName       string `form:"envName"`
	Page          int    `form:"page"`
	PageSize      int    `form:"pageSize"`
	ProjectName   string `form:"projectName"`
	ResourceTypes string `form:"-"`
	Type          string `form:"type"`
	Name          string `form:"name"`
	Production    bool   `form:"-"`
}

type GetEnvServiceVersionYamlResponse

type GetEnvServiceVersionYamlResponse struct {
	Type         string `json:"type"`
	Yaml         string `json:"yaml"`
	VariableYaml string `json:"variable_yaml"`
}

func GetEnvServiceVersionYaml

func GetEnvServiceVersionYaml(ctx *internalhandler.Context, projectName, envName, serviceName string, revision int64, isHelmChart, isProduction bool, log *zap.SugaredLogger) (GetEnvServiceVersionYamlResponse, error)

type GetPortalServiceResponse

type GetPortalServiceResponse struct {
	DefaultGatewayAddress string                      `json:"default_gateway_address"`
	Servers               []SetupPortalServiceRequest `json:"servers"`
}

func GetIstioGrayscalePortalService

func GetIstioGrayscalePortalService(ctx context.Context, productName, envName, serviceName string) (GetPortalServiceResponse, error)

func GetPortalService

func GetPortalService(ctx context.Context, productName, envName, serviceName string) (GetPortalServiceResponse, error)

type GetReleaseInstanceDeployStatusResponse

type GetReleaseInstanceDeployStatusResponse struct {
	ReleaseName  string `json:"release_name"`
	ChartName    string `json:"chart_name"`
	ChartVersion string `json:"chart_version"`
	Status       string `json:"status"`
	Values       string `json:"values"`
}

func GetReleaseInstanceDeployStatus

func GetReleaseInstanceDeployStatus(productName string, production bool, request *HelmDeployStatusCheckRequest) ([]*GetReleaseInstanceDeployStatusResponse, error)

type GitRepoConfig

type GitRepoConfig struct {
	CodehostKey string   `json:"codehost_key"`
	Owner       string   `json:"owner"`
	Repo        string   `json:"repo"`
	Branch      string   `json:"branch"`
	ValuesPaths []string `json:"values_paths,omitempty"`
}

type GlobalVariables

type GlobalVariables struct {
	Variables           []*commontypes.ServiceVariableKV `json:"variables"`
	ProductionVariables []*commontypes.ServiceVariableKV `json:"production_variables"`
}

type HelmChartsResp

type HelmChartsResp struct {
	ChartInfos []*ChartInfo      `json:"chartInfos"`
	FileInfos  []*types.FileInfo `json:"fileInfos"`
}

func GetChartInfos

func GetChartInfos(productName, envName, serviceName string, production bool, log *zap.SugaredLogger) (*HelmChartsResp, error)

type HelmDeployStatusCheckRequest

type HelmDeployStatusCheckRequest struct {
	EnvName   string   `json:"env_name"`
	Services  []string `json:"services"`
	ClusterID string   `json:"cluster_id"`
	Namespace string   `json:"namespace"`
}

type HelmProductCreator

type HelmProductCreator struct{}

func (*HelmProductCreator) Create

func (creator *HelmProductCreator) Create(user, requestID string, args *ProductCreateArg, log *zap.SugaredLogger) error

type HelmProductItem

type HelmProductItem struct {
	OldName       string                            `json:"old_name"`
	NewName       string                            `json:"new_name"`
	BaseName      string                            `json:"base_name"`
	DefaultValues string                            `json:"default_values"`
	ChartValues   []*commonservice.HelmSvcRenderArg `json:"chart_values"`
	ValuesData    *commonservice.ValuesDataArgs     `json:"values_data"`
}

type HelmReleaseQueryArgs

type HelmReleaseQueryArgs struct {
	ProjectName string `json:"projectName"     form:"projectName"`
	Filter      string `json:"filter"          form:"filter"`
}

type HelmReleaseResp

type HelmReleaseResp struct {
	ReleaseName       string        `json:"releaseName"`
	ServiceName       string        `json:"serviceName"`
	Revision          int           `json:"revision"`
	ChartRepo         string        `json:"chartRepo"`
	Chart             string        `json:"chart"`
	AppVersion        string        `json:"appVersion"`
	OverrideValues    string        `json:"overrideValues"`
	OverrideYaml      string        `json:"overrideYaml"`
	Status            ReleaseStatus `json:"status"`
	Updatable         bool          `json:"updatable"`
	IsHelmChartDeploy bool          `json:"isHelmChartDeploy"`
	DeployStrategy    string        `json:"deployStrategy"`
	Error             string        `json:"error"`
}

func ListReleases

func ListReleases(args *HelmReleaseQueryArgs, envName string, production bool, log *zap.SugaredLogger) ([]*HelmReleaseResp, error)

type IProductCreator

type IProductCreator interface {
	Create(string, string, *ProductCreateArg, *zap.SugaredLogger) error
}

type ImageData

type ImageData struct {
	ImageName string `json:"imageName"`
	ImageTag  string `json:"imageTag"`
	Selected  bool   `json:"selected"`
}

type IstioGrayscaleChecks

type IstioGrayscaleChecks struct {
	NamespaceHasIstioLabel  bool `json:"namespace_has_istio_label"`
	PodsHaveIstioProxy      bool `json:"pods_have_istio_proxy"`
	WorkloadsReady          bool `json:"workloads_ready"`
	WorkloadsHaveK8sService bool `json:"workloads_have_k8s_service"`
}

type IstioGrayscaleReady

type IstioGrayscaleReady struct {
	IsReady bool                 `json:"is_ready"`
	Checks  IstioGrayscaleChecks `json:"checks"`
}

func CheckIstioGrayscaleReady

func CheckIstioGrayscaleReady(ctx context.Context, envName, op, productName string) (*IstioGrayscaleReady, error)

func (*IstioGrayscaleReady) CheckAndSetReady

func (s *IstioGrayscaleReady) CheckAndSetReady(state ShareEnvOp)

Note: `WorkloadsHaveK8sService` is an optional condition.

type K8sDeployStatusCheckRequest

type K8sDeployStatusCheckRequest struct {
	EnvName   string                           `json:"env_name"`
	Services  []*commonservice.K8sSvcRenderArg `json:"services"`
	ClusterID string                           `json:"cluster_id"`
	Namespace string                           `json:"namespace"`
}

type K8sRendersetArg

type K8sRendersetArg struct {
	VariableYaml string `json:"variable_yaml"`
}

type K8sResource

type K8sResource struct {
	ResourceName    string `json:"resource_name"`
	ResourceKind    string `json:"resource_kind"`
	ResourceGroup   string `json:"resource_group"`
	ResourceVersion string `json:"resource_version"`
}

func ListAllK8sResourcesInNamespace

func ListAllK8sResourcesInNamespace(clusterID, namespace string, log *zap.SugaredLogger) ([]*K8sResource, error)

type K8sResourceResp

type K8sResourceResp struct {
	Count     int                      `json:"count"`
	Workloads []interface{}            `json:"workloads,omitempty"`
	Resources []SortableByCreationTime `json:"resources,omitempty"`
}

func ListConfigMapOverview

func ListConfigMapOverview(page, pageSize int, namespace string, kc client.Client) (*K8sResourceResp, error)

func ListCronJobs

func ListCronJobs(page, pageSize int, clusterID, namespace string, kc client.Client, informer informers.SharedInformerFactory) (*K8sResourceResp, error)

func ListDaemonSets

func ListDaemonSets(page, pageSize int, namespace string, kc client.Client) (*K8sResourceResp, error)

func ListDeployments

func ListDeployments(page, pageSize int, namespace string, kc client.Client, informer informers.SharedInformerFactory) (*K8sResourceResp, error)

func ListIngressOverview

func ListIngressOverview(page, pageSize int, clusterID, namespace string, kc client.Client, log *zap.SugaredLogger) (*K8sResourceResp, error)

func ListJobs

func ListJobs(page, pageSize int, namespace string, kc client.Client) (*K8sResourceResp, error)

func ListK8sResOverview

func ListK8sResOverview(args *FetchResourceArgs, log *zap.SugaredLogger) (*K8sResourceResp, error)

func ListK8sSecretOverview

func ListK8sSecretOverview(page, pageSize int, namespace string, kc client.Client) (*K8sResourceResp, error)

func ListPVCs

func ListPVCs(page, pageSize int, namespace string, kc client.Client) (*K8sResourceResp, error)

func ListServices

func ListServices(page, pageSize int, namespace string, kc client.Client, informer informers.SharedInformerFactory) (*K8sResourceResp, error)

func ListStatefulSets

func ListStatefulSets(page, pageSize int, namespace string, kc client.Client, informer informers.SharedInformerFactory) (*K8sResourceResp, error)

type K8sService

type K8sService struct {
	// contains filtered or unexported fields
}

func (*K8sService) GetGroupService

func (k *K8sService) GetGroupService(service *commonmodels.ProductService, string, informer informers.SharedInformerFactory, productInfo *commonmodels.Product) *commonservice.ServiceResp

type K8sYamlProductCreator

type K8sYamlProductCreator struct {
}

func (*K8sYamlProductCreator) Create

func (creator *K8sYamlProductCreator) Create(user, requestID string, args *ProductCreateArg, log *zap.SugaredLogger) error

type ListCommonEnvCfgHistoryArgs

type ListCommonEnvCfgHistoryArgs struct {
	EnvName          string                  `json:"env_name"            form:"envName"`
	ProjectName      string                  `json:"project_name"        form:"projectName"`
	Name             string                  `json:"name"                form:"name"`
	CommonEnvCfgType config.CommonEnvCfgType `json:"common_env_cfg_type" form:"commonEnvCfgType"`
	AutoSync         bool                    `json:"auto_sync"           form:"autoSync"`
	Production       bool                    `json:"production"          form:"production"`
}

type ListCommonEnvCfgHistoryRes

type ListCommonEnvCfgHistoryRes struct {
	ID             primitive.ObjectID     `json:"id,omitempty"`
	ProductName    string                 `json:"product_name"`
	CreateTime     int64                  `json:"create_time"`
	UpdateUserName string                 `json:"update_user_name"`
	Namespace      string                 `json:"namespace,omitempty"`
	EnvName        string                 `json:"env_name"`
	Name           string                 `json:"name"`
	Type           string                 `json:"type"`
	YamlData       string                 `json:"yaml_data"`
	SourceDetail   *models.CreateFromRepo `json:"source_detail"`
}

type ListConfigMapArgs

type ListConfigMapArgs struct {
	EnvName     string `json:"env_name"`
	ProductName string `json:"product_name"`
	ServiceName string `json:"service_name"`
	Production  bool   `json:"production"`
}

type ListConfigMapRes

type ListConfigMapRes struct {
	*ResourceResponseBase
	CmName    string            `json:"cm_name"`
	Immutable bool              `json:"immutable"`
	CmData    map[string]string `json:"cm_data"`
}

func ListConfigMaps

func ListConfigMaps(args *ListConfigMapArgs, log *zap.SugaredLogger) ([]*ListConfigMapRes, error)

type ListEnvServiceVersionsResponse

type ListEnvServiceVersionsResponse struct {
	ServiceName string `json:"service_name"`
	Revision    int64  `json:"revision"`
	CreateTime  int64  `json:"create_time"`
	CreateBy    string `json:"create_by"`
}

func ListEnvServiceVersions

func ListEnvServiceVersions(ctx *internalhandler.Context, projectName, envName, serviceName string, isHelmChart, isProduction bool, log *zap.SugaredLogger) ([]ListEnvServiceVersionsResponse, error)

type ListIngressesResponse

type ListIngressesResponse struct {
	*ResourceResponseBase
	IngressName string `json:"ingress_name"`
	HostInfo    string `json:"host_info"`
	Address     string `json:"address"`
	Ports       string `json:"ports"`
	ErrorReason string `json:"error_reason"`
}

func ListIngresses

func ListIngresses(envName, productName string, production bool, log *zap.SugaredLogger) ([]*ListIngressesResponse, error)

type ListPodsInfoRespone

type ListPodsInfoRespone struct {
	Name       string   `json:"name"`
	Ready      string   `json:"ready"`
	Status     string   `json:"status"`
	Images     []string `json:"images"`
	CreateTime int64    `json:"create_time"`
}

func ListPodsInfo

func ListPodsInfo(projectName, envName string, production bool, log *zap.SugaredLogger) ([]*ListPodsInfoRespone, error)

type ListPvcsResponse

type ListPvcsResponse struct {
	*ResourceResponseBase
	PvcName      string `json:"pvc_name"`
	Status       string `json:"status"`
	Volume       string `json:"volume"`
	AccessModes  string `json:"access_modes"`
	StorageClass string `json:"storageclass"`
	Capacity     string `json:"capacity"`
}

func ListPvcs

func ListPvcs(envName, productName string, production bool, log *zap.SugaredLogger) ([]*ListPvcsResponse, error)

type ListSecretsResponse

type ListSecretsResponse struct {
	*ResourceResponseBase
	SecretName string `json:"secret_name"`
	SecretType string `json:"secret_type"`
}

func ListSecrets

func ListSecrets(envName, productName string, production bool, log *zap.SugaredLogger) ([]*ListSecretsResponse, error)

type MatchedEnv

type MatchedEnv struct {
	EnvName   string
	Namespace string
}

type MigrateHistoryConfigMapsRes

type MigrateHistoryConfigMapsRes struct {
}

type NodeResp

type NodeResp struct {
	Nodes  []*internalresource.Node `json:"data"`
	Labels []string                 `json:"labels"`
}

func ListAvailableNodes

func ListAvailableNodes(clusterID string, log *zap.SugaredLogger) (*NodeResp, error)

type OpenAPIApplyYamlServiceReq

type OpenAPIApplyYamlServiceReq struct {
	EnvName     string               `json:"env_key"`
	ServiceList []*YamlServiceWithKV `json:"service_list"`
}

func (*OpenAPIApplyYamlServiceReq) Validate

func (req *OpenAPIApplyYamlServiceReq) Validate() error

type OpenAPICreateEnvArgs

type OpenAPICreateEnvArgs struct {
	Production      bool                              `json:"production"`
	ProjectName     string                            `json:"project_key"`
	EnvName         string                            `json:"env_key"`
	ClusterID       string                            `json:"cluster_id"`
	Namespace       string                            `json:"namespace"`
	RegistryID      string                            `json:"registry_id"`
	Alias           string                            `json:"env_name"`
	GlobalVariables []*commontypes.GlobalVariableKV   `json:"global_variables"`
	ChartValues     []*ProductHelmServiceCreationInfo `json:"chart_values"`
	Services        []*OpenAPICreateServiceArgs       `json:"services"`
	EnvConfigs      []*EnvCfgArgs                     `json:"env_configs"`
}

func (*OpenAPICreateEnvArgs) Validate

func (env *OpenAPICreateEnvArgs) Validate() error

type OpenAPICreateServiceArgs

type OpenAPICreateServiceArgs struct {
	ServiceName    string                          `json:"service_name"`
	DeployStrategy string                          `json:"deploy_strategy"`
	Containers     []*commonmodels.Container       `json:"containers"`
	VariableKVs    []*commontypes.RenderVariableKV `json:"variable_kvs"`
	Status         string                          `json:"status"`
	Type           string                          `json:"type"`
}

type OpenAPIDeleteYamlServiceFromEnvReq

type OpenAPIDeleteYamlServiceFromEnvReq struct {
	EnvName      string   `json:"env_key"`
	ServiceNames []string `json:"service_names"`
}

func (*OpenAPIDeleteYamlServiceFromEnvReq) Validate

func (req *OpenAPIDeleteYamlServiceFromEnvReq) Validate() error

type OpenAPIEnvCfgArgs

type OpenAPIEnvCfgArgs struct {
	Name                 string                       `json:"name"`
	CommonEnvCfgType     config.CommonEnvCfgType      `json:"common_env_cfg_type"`
	CreatedBy            string                       `json:"created_by,omitempty"`
	CreatedTime          int64                        `json:"created_time,omitempty"`
	UpdateBy             string                       `json:"update_by,omitempty"`
	UpdateTime           int64                        `json:"update_time,omitempty"`
	EnvName              string                       `json:"env_key"`
	ProductName          string                       `json:"product_name"`
	ServiceName          string                       `json:"service_name,omitempty"`
	Services             []string                     `json:"services,omitempty"`
	YamlData             string                       `json:"yaml_data,omitempty"`
	SourceDetail         *commonmodels.CreateFromRepo `json:"source_detail"`
	RestartAssociatedSvc bool                         `json:"restart_associated_svc,omitempty"`
	AutoSync             bool                         `json:"auto_sync"`
}

func (*OpenAPIEnvCfgArgs) Validate

func (req *OpenAPIEnvCfgArgs) Validate() error

type OpenAPIEnvCfgBrief

type OpenAPIEnvCfgBrief struct {
	Name             string                  `json:"name"`
	EnvName          string                  `json:"env_name"`
	ProjectName      string                  `json:"project_name"`
	CommonEnvCfgType config.CommonEnvCfgType `json:"common_env_cfg_type"`
	UpdateBy         string                  `json:"update_by,omitempty"`
	UpdateTime       int64                   `json:"update_time,omitempty"`
}

func OpenAPIListCommonEnvCfg

func OpenAPIListCommonEnvCfg(projectName, envName string, cfgType string, production bool, logger *zap.SugaredLogger) ([]*OpenAPIEnvCfgBrief, error)

type OpenAPIEnvCfgConfigMapDetail

type OpenAPIEnvCfgConfigMapDetail struct {
	Name             string                  `json:"name"`
	ProjectName      string                  `json:"project_key"`
	EnvName          string                  `json:"env_key"`
	CommonEnvCfgType config.CommonEnvCfgType `json:"common_env_cfg_type"`
	CreatedBy        string                  `json:"created_by,omitempty"`
	CreatedTime      int64                   `json:"created_time,omitempty"`
	UpdateBy         string                  `json:"update_by,omitempty"`
	UpdateTime       int64                   `json:"update_time,omitempty"`
	YamlData         string                  `json:"yaml_data,omitempty"`
	Services         []string                `json:"services,omitempty"`
	SourceDetail     *CfgRepoInfo            `json:"source_detail"`
	Immutable        bool                    `json:"immutable,omitempty"`
	CmData           map[string]string       `json:"cm_data,omitempty"`
}

type OpenAPIEnvCfgDetail

type OpenAPIEnvCfgDetail struct {
	IngressDetail   *OpenAPIEnvCfgIngressDetail   `json:"ingress_detail,omitempty"`
	SecretDetail    *OpenAPIEnvCfgSecretDetail    `json:"secret_detail,omitempty"`
	PvcDetail       *OpenAPIEnvCfgPvcDetail       `json:"pvc_detail,omitempty"`
	ConfigMapDetail *OpenAPIEnvCfgConfigMapDetail `json:"configMap_detail,omitempty"`
}

func OpenAPIGetCommonEnvCfg

func OpenAPIGetCommonEnvCfg(projectName, envName, cfgType, name string, production bool, logger *zap.SugaredLogger) (*OpenAPIEnvCfgDetail, error)

type OpenAPIEnvCfgIngressDetail

type OpenAPIEnvCfgIngressDetail struct {
	Name             string                  `json:"name"`
	ProjectName      string                  `json:"project_key"`
	EnvName          string                  `json:"env_key"`
	CommonEnvCfgType config.CommonEnvCfgType `json:"common_env_cfg_type"`
	CreatedBy        string                  `json:"created_by,omitempty"`
	CreatedTime      int64                   `json:"created_time,omitempty"`
	UpdateBy         string                  `json:"update_by,omitempty"`
	UpdateTime       int64                   `json:"update_time,omitempty"`
	YamlData         string                  `json:"yaml_data,omitempty"`
	Services         []string                `json:"services,omitempty"`
	SourceDetail     *CfgRepoInfo            `json:"source_detail"`
	HostInfo         string                  `json:"host_info,omitempty"`
	Address          string                  `json:"address,omitempty"`
	Ports            string                  `json:"ports,omitempty"`
	ErrorReason      string                  `json:"error_reason,omitempty"`
}

type OpenAPIEnvCfgPvcDetail

type OpenAPIEnvCfgPvcDetail struct {
	Name             string                  `json:"name"`
	ProjectName      string                  `json:"project_key"`
	EnvName          string                  `json:"env_key"`
	CommonEnvCfgType config.CommonEnvCfgType `json:"common_env_cfg_type"`
	CreatedBy        string                  `json:"created_by,omitempty"`
	CreatedTime      int64                   `json:"created_time,omitempty"`
	UpdateBy         string                  `json:"update_by,omitempty"`
	UpdateTime       int64                   `json:"update_time,omitempty"`
	YamlData         string                  `json:"yaml_data,omitempty"`
	Services         []string                `json:"services,omitempty"`
	SourceDetail     *CfgRepoInfo            `json:"source_detail"`
	Status           string                  `json:"status,omitempty"`
	Volume           string                  `json:"volume,omitempty"`
	AccessModes      string                  `json:"access_modes,omitempty"`
	StorageClass     string                  `json:"storage_class,omitempty"`
	Capacity         string                  `json:"capacity,omitempty"`
}

type OpenAPIEnvCfgSecretDetail

type OpenAPIEnvCfgSecretDetail struct {
	Name             string                  `json:"name"`
	ProjectName      string                  `json:"project_key"`
	EnvName          string                  `json:"env_key"`
	CommonEnvCfgType config.CommonEnvCfgType `json:"common_env_cfg_type"`
	CreatedBy        string                  `json:"created_by,omitempty"`
	CreatedTime      int64                   `json:"created_time,omitempty"`
	UpdateBy         string                  `json:"update_by,omitempty"`
	UpdateTime       int64                   `json:"update_time,omitempty"`
	YamlData         string                  `json:"yaml_data,omitempty"`
	Services         []string                `json:"services,omitempty"`
	SourceDetail     *CfgRepoInfo            `json:"source_detail"`
	SecretType       string                  `json:"secret_type,omitempty"`
}

type OpenAPIEnvDetail

type OpenAPIEnvDetail struct {
	ProjectName     string                            `json:"project_key"`
	EnvName         string                            `json:"env_key"`
	UpdateBy        string                            `json:"update_by"`
	UpdateTime      int64                             `json:"update_time"`
	ClusterID       string                            `json:"cluster_id"`
	Namespace       string                            `json:"namespace"`
	RegistryID      string                            `json:"registry_id"`
	Alias           string                            `json:"env_name,omitempty"`
	GlobalVariables []*commontypes.GlobalVariableKV   `json:"global_variables"`
	ChartValues     []*ProductHelmServiceCreationInfo `json:"chart_values,omitempty"`
	Services        []*OpenAPIServiceDetail           `json:"services"`
	Status          string                            `json:"status"`
}

func GetEnvDetail

func GetEnvDetail(projectName, envName string, production bool, logger *zap.SugaredLogger) (*OpenAPIEnvDetail, error)

type OpenAPIEnvGlobalVariables

type OpenAPIEnvGlobalVariables struct {
	GlobalVariables []*commontypes.GlobalVariableKV `json:"global_variables"`
}

type OpenAPIEnvServiceDetail

type OpenAPIEnvServiceDetail struct {
	ServiceName    string                           `json:"service_name"`
	Variables      []*commontypes.ServiceVariableKV `json:"variables"`
	Images         []string                         `json:"images"`
	Status         string                           `json:"status"`
	Type           string                           `json:"type"`
	Error          string                           `json:"error"`
	DeployStrategy string                           `json:"deploy_strategy"`
}

type OpenAPIListEnvBrief

type OpenAPIListEnvBrief struct {
	Alias      string `json:"envName,omitempty"`
	EnvName    string `json:"env_key"`
	ClusterID  string `json:"cluster_id"`
	Namespace  string `json:"namespace"`
	Production bool   `json:"production"`
	RegistryID string `json:"registry_id"`
	Status     string `json:"status"`
	UpdateBy   string `json:"update_by"`
	UpdateTime int64  `json:"update_time"`
}

func OpenAPIListEnvs

func OpenAPIListEnvs(userID, projectName string, envNames []string, production bool, log *zap.SugaredLogger) ([]*OpenAPIListEnvBrief, error)

func OpenAPIListProductionEnvs

func OpenAPIListProductionEnvs(userId string, projectName string, envNames []string, log *zap.SugaredLogger) ([]*OpenAPIListEnvBrief, error)

type OpenAPIScaleServiceReq

type OpenAPIScaleServiceReq struct {
	ProjectKey     string `json:"project_key"`
	EnvName        string `json:"env_key"`
	WorkloadName   string `json:"workload_name"`
	WorkloadType   string `json:"workload_type"`
	TargetReplicas int    `json:"target_replicas"`
}

func (*OpenAPIScaleServiceReq) Validate

func (req *OpenAPIScaleServiceReq) Validate() error

type OpenAPIServiceDetail

type OpenAPIServiceDetail struct {
	ServiceName string                           `json:"service_name"`
	Containers  []*commonmodels.Container        `json:"containers"`
	VariableKVs []*commontypes.ServiceVariableKV `json:"variable_kvs"`
	Status      string                           `json:"status"`
	Type        string                           `json:"type"`
}

type OpenAPIServiceVariablesReq

type OpenAPIServiceVariablesReq struct {
	ServiceList []*ServiceVariable `json:"service_list"`
}

type PMProductCreator

type PMProductCreator struct {
}

func (*PMProductCreator) Create

func (creator *PMProductCreator) Create(user, requestID string, args *ProductCreateArg, log *zap.SugaredLogger) error

type PMService

type PMService struct {
	// contains filtered or unexported fields
}

type PreviewServiceArgs

type PreviewServiceArgs struct {
	ProductName           string                          `json:"product_name"`
	EnvName               string                          `json:"env_name"`
	ServiceName           string                          `json:"service_name"`
	UpdateServiceRevision bool                            `json:"update_service_revision"`
	ServiceModules        []*commonmodels.Container       `json:"service_modules"`
	VariableKVs           []*commontypes.RenderVariableKV `json:"variable_kvs"`
}

type ProductCreateArg

type ProductCreateArg struct {
	*models.Product
	mongo.Session
}

type ProductHelmServiceCreationInfo

type ProductHelmServiceCreationInfo struct {
	*commonservice.HelmSvcRenderArg
	DeployStrategy string `json:"deploy_strategy"`
}

type ProductIngressInfo

type ProductIngressInfo struct {
	IngressInfos []*commonservice.IngressInfo `json:"ingress_infos"`
	EnvName      string                       `json:"env_name"`
}

type ProductK8sServiceCreationInfo

type ProductK8sServiceCreationInfo struct {
	*commonmodels.ProductService
	DeployStrategy string `json:"deploy_strategy"`
}

type ProductParams

type ProductParams struct {
	IsPublic        bool     `json:"isPublic"`
	EnvName         string   `json:"envName"`
	RoleID          int      `json:"roleId"`
	PermissionUUIDs []string `json:"permissionUUIDs"`
}

type ProductResp

type ProductResp struct {
	ID          string                           `json:"id"`
	ProductName string                           `json:"product_name"`
	Namespace   string                           `json:"namespace"`
	Status      string                           `json:"status"`
	Error       string                           `json:"error"`
	EnvName     string                           `json:"env_name"`
	UpdateBy    string                           `json:"update_by"`
	UpdateTime  int64                            `json:"update_time"`
	Services    [][]*commonmodels.ProductService `json:"services"`
	Render      *commonmodels.RenderInfo         `json:"render"`
	Vars        []*templatemodels.RenderKV       `json:"vars"`
	IsPublic    bool                             `json:"isPublic"`
	ClusterID   string                           `json:"cluster_id,omitempty"`
	ClusterName string                           `json:"cluster_name,omitempty"`
	RecycleDay  int                              `json:"recycle_day"`
	IsProd      bool                             `json:"is_prod"`
	IsLocal     bool                             `json:"is_local"`
	IsExisted   bool                             `json:"is_existed"`
	Source      string                           `json:"source"`
	RegisterID  string                           `json:"registry_id"`

	// New Since v1.11.0
	ShareEnvEnable  bool   `json:"share_env_enable"`
	ShareEnvIsBase  bool   `json:"share_env_is_base"`
	ShareEnvBaseEnv string `json:"share_env_base_env"`

	// New Since v2.1.0
	RelatedEnvs           []*SharedNSEnvs            `json:"related_envs"`
	IstioGrayscaleEnable  bool                       `json:"istio_grayscale_enable"`
	IstioGrayscaleIsBase  bool                       `json:"istio_grayscale_is_base"`
	IstioGrayscaleBaseEnv string                     `json:"istio_grayscale_base_env"`
	YamlData              *templatemodels.CustomYaml `json:"yaml_data,omitempty"` // used for cron service
}

func GetProduct

func GetProduct(username, envName, productName string, log *zap.SugaredLogger) (*ProductResp, error)

type ProductRevision

type ProductRevision struct {
	ID          string `json:"id,omitempty"`
	EnvName     string `json:"env_name"`
	ProductName string `json:"product_name"`
	// 表示该产品更新前版本
	CurrentRevision int64 `json:"current_revision"`
	// 表示该产品更新后版本
	NextRevision int64 `json:"next_revision"`
	// true: 表示该产品的服务发生变化, 需要更新
	// false: 表示该产品的服务未发生变化, 无需更新
	Updatable bool `json:"updatable"`
	// 可以自动更新产品, 展示用户更新前和更新后的服务组以及服务详细对比
	ServiceRevisions []*SvcRevision `json:"services"`
	IsPublic         bool           `json:"isPublic"`
}

func GetProductRevision

func GetProductRevision(product *commonmodels.Product, allServiceTmpls []*commonmodels.Service, log *zap.SugaredLogger) (*ProductRevision, error)

FixMe do we need this funciton?

func ListProductSnapsByOption

func ListProductSnapsByOption(deployType string, log *zap.SugaredLogger) ([]*ProductRevision, error)

ListProductSnapsByOption called by service cron

func ListProductsRevision

func ListProductsRevision(productName, envName string, production bool, log *zap.SugaredLogger) (prodRevs []*ProductRevision, err error)

func (*ProductRevision) GroupsUpdated

func (pr *ProductRevision) GroupsUpdated() bool

type RawYamlResp

type RawYamlResp struct {
	YamlContent string `json:"yamlContent"`
}

type ReleaseFilter

type ReleaseFilter struct {
	Name   string        `json:"name"`
	Status ReleaseStatus `json:"status"`
}

type ReleaseStatus

type ReleaseStatus string
const (
	HelmReleaseStatusPending     ReleaseStatus = "pending"
	HelmReleaseStatusDeployed    ReleaseStatus = "deployed"
	HelmReleaseStatusFailed      ReleaseStatus = "failed"
	HelmReleaseStatusNotDeployed ReleaseStatus = "notDeployed"
)

type ResourceCommon

type ResourceCommon struct {
	Name         string           `json:"name"`
	Type         string           `json:"type"`
	Images       []*WorkloadImage `json:"images,omitempty"`
	CreationTime string           `json:"creation_time"`
}

func (*ResourceCommon) GetCreationTime

func (rc *ResourceCommon) GetCreationTime() string

type ResourceConfigMap

type ResourceConfigMap struct {
	*ResourceCommon
}

type ResourceDeployStatus

type ResourceDeployStatus struct {
	Type         string                  `json:"type"`
	Name         string                  `json:"name"`
	Status       DeployStatus            `json:"status"`
	GVK          schema.GroupVersionKind `json:"-"`
	OverrideYaml string                  `json:"override_yaml"`
	OverrideKvs  []*commonservice.KVPair `json:"override_kvs"`
}

type ResourceIngress

type ResourceIngress struct {
	*ResourceCommon
	Class   string `json:"class"`
	Hosts   string `json:"hosts"`
	Address string `json:"address"`
	Ports   string `json:"ports"`
}

type ResourcePVC

type ResourcePVC struct {
	*ResourceCommon
	Status       string `json:"status"`
	Volume       string `json:"volume"`
	Capacity     string `json:"capacity"`
	AccessModes  string `json:"access_modes"`
	StorageClass string `json:"storage_class"`
}

type ResourceResponseBase

type ResourceResponseBase struct {
	Name           string                  `json:"-"`
	Type           config.CommonEnvCfgType `json:"-"`
	EnvName        string                  `json:"-"`
	ProjectName    string                  `json:"-"`
	YamlData       string                  `json:"yaml_data"`
	UpdateUserName string                  `json:"update_username"`
	CreateTime     time.Time               `json:"create_time"`
	Services       []string                `json:"services"`
	SourceDetail   *models.CreateFromRepo  `json:"source_detail"`
	AutoSync       bool                    `json:"auto_sync"`
}

type ResourceSecret

type ResourceSecret struct {
	*ResourceCommon
	SecretType string `json:"secret_type"`
}

type ResourceService

type ResourceService struct {
	*ResourceCommon
	ServiceType string `json:"service_type"`
	ClusterIP   string `json:"cluster_ip"`
	Ports       string `json:"ports"`
}

type ResourceWithLabel

type ResourceWithLabel interface {
	GetLabels() map[string]string
	SetLabels(labels map[string]string)
	SetNamespace(ns string)
}

func GetResourceByCfgType

func GetResourceByCfgType(namespace, name string, cfgType config.CommonEnvCfgType, client client.Client, clientset *kubernetes.Clientset) (ResourceWithLabel, error)

type RestartScaleArgs

type RestartScaleArgs struct {
	Type        string `json:"type"`
	ProductName string `json:"product_name"`
	EnvName     string `json:"env_name"`
	Name        string `json:"name"`
	// deprecated, since it is not used
	ServiceName string `json:"service_name"`
}

type RollBackConfigMapArgs

type RollBackConfigMapArgs struct {
	EnvName          string `json:"env_name"`
	ProductName      string `json:"product_name"`
	ServiceName      string `json:"service_name"`
	SrcConfigName    string `json:"src_config_name"`
	DestinConfigName string `json:"destin_config_name"`
	Production       bool   `json:"production"`
}

type ScaleArgs

type ScaleArgs struct {
	Type        string `json:"type"`
	ProductName string `json:"product_name"`
	EnvName     string `json:"env_name"`
	ServiceName string `json:"service_name"`
	Name        string `json:"name"`
	Number      int    `json:"number"`
	Production  bool   `json:"production"`
}

type ServiceDeployStatus

type ServiceDeployStatus struct {
	ServiceName string                  `json:"service_name"`
	Resources   []*ResourceDeployStatus `json:"resources"`
}

func GetReleaseDeployStatus

func GetReleaseDeployStatus(productName string, production bool, request *HelmDeployStatusCheckRequest) ([]*ServiceDeployStatus, error)

func GetResourceDeployStatus

func GetResourceDeployStatus(productName string, request *K8sDeployStatusCheckRequest, production bool, log *zap.SugaredLogger) ([]*ServiceDeployStatus, error)

type ServiceImages

type ServiceImages struct {
	ServiceName string       `json:"serviceName"`
	Images      []*ImageData `json:"imageData"`
}

type ServiceMatchedDeploymentContainers

type ServiceMatchedDeploymentContainers struct {
	ServiceName string `json:"service_name"`
	Deployment  struct {
		DeploymentName string   `json:"deployments_name"`
		ContainerNames []string `json:"container_names"`
	} `json:"deployment"`
}

func ListCanaryDeploymentServiceInfo

func ListCanaryDeploymentServiceInfo(clusterID, namespace string, log *zap.SugaredLogger) ([]*ServiceMatchedDeploymentContainers, error)

list serivce and matched deployment containers for canary and blue-green deployment.

type ServiceVariable

type ServiceVariable struct {
	ServiceName string                          `json:"service_name"`
	Variables   []*commontypes.RenderVariableKV `json:"variable_kvs"`
}

type SetupPortalServiceRequest

type SetupPortalServiceRequest struct {
	Host         string `json:"host"`
	PortNumber   uint32 `json:"port_number"`
	PortProtocol string `json:"port_protocol"`
}

type ShareEnvOp

type ShareEnvOp string
const (
	ShareEnvEnable  ShareEnvOp = "enable"
	ShareEnvDisable ShareEnvOp = "disable"
)

type ShareEnvReady

type ShareEnvReady struct {
	IsReady bool                `json:"is_ready"`
	Checks  ShareEnvReadyChecks `json:"checks"`
}

func CheckShareEnvReady

func CheckShareEnvReady(ctx context.Context, envName, op, productName string) (*ShareEnvReady, error)

func (*ShareEnvReady) CheckAndSetReady

func (s *ShareEnvReady) CheckAndSetReady(state ShareEnvOp)

Note: `WorkloadsHaveK8sService` is an optional condition.

type ShareEnvReadyChecks

type ShareEnvReadyChecks struct {
	NamespaceHasIstioLabel  bool `json:"namespace_has_istio_label"`
	VirtualServicesDeployed bool `json:"virtualservice_deployed"`
	PodsHaveIstioProxy      bool `json:"pods_have_istio_proxy"`
	WorkloadsReady          bool `json:"workloads_ready"`
	WorkloadsHaveK8sService bool `json:"workloads_have_k8s_service"`
}

type SharedNSEnvs

type SharedNSEnvs struct {
	ProjectName string `json:"project_name"`
	EnvName     string `json:"env_name"`
	Production  bool   `json:"production"`
}

func FindNsUseEnvs

func FindNsUseEnvs(productInfo *commonmodels.Product, log *zap.SugaredLogger) ([]*SharedNSEnvs, error)

type SortableByCreationTime

type SortableByCreationTime interface {
	GetCreationTime() string
}

type SvcDataSet

type SvcDataSet struct {
	ProdSvc    *models.ProductService
	TmplSvc    *models.Service
	SvcRelease *release.Release
}

type SvcDiffResult

type SvcDiffResult struct {
	ReleaseName       string   `json:"release_name"`
	ServiceName       string   `json:"service_name"`
	ChartName         string   `json:"chart_name"`
	DeployedFromChart bool     `json:"deployed_from_chart"`
	Current           TmplYaml `json:"current"`
	Latest            TmplYaml `json:"latest"`
	Error             string   `json:"error"`
}

func BatchPreviewService

func BatchPreviewService(args []*PreviewServiceArgs, logger *zap.SugaredLogger) ([]*SvcDiffResult, error)

func GetServiceDiff

func GetServiceDiff(envName, productName, serviceName string, production bool, log *zap.SugaredLogger) (*SvcDiffResult, error)

GetServiceDiff 获得服务模板当前版本和最新版本的对比

func PreviewHelmProductGlobalVariables

func PreviewHelmProductGlobalVariables(productName, envName, globalVariable string, proudction bool, log *zap.SugaredLogger) ([]*SvcDiffResult, error)

func PreviewProductGlobalVariables

func PreviewProductGlobalVariables(productName, envName string, arg []*commontypes.GlobalVariableKV, production bool, log *zap.SugaredLogger) ([]*SvcDiffResult, error)

func PreviewProductGlobalVariablesWithRender

func PreviewProductGlobalVariablesWithRender(product *commonmodels.Product, args []*commontypes.GlobalVariableKV, log *zap.SugaredLogger) ([]*SvcDiffResult, error)

func PreviewService

func PreviewService(args *PreviewServiceArgs, _ *zap.SugaredLogger) (*SvcDiffResult, error)

type SvcOptArgs

type SvcOptArgs struct {
	EnvName           string
	ProductName       string
	ServiceName       string
	ServiceType       string
	ServiceRev        *SvcRevision
	UpdateBy          string
	UpdateServiceTmpl bool
}

type SvcRevision

type SvcRevision struct {
	ServiceName       string                          `json:"service_name"`
	Type              string                          `json:"type"`
	CurrentRevision   int64                           `json:"current_revision"`
	NextRevision      int64                           `json:"next_revision"`
	Updatable         bool                            `json:"updatable"`
	DeployStrategy    string                          `json:"deploy_strategy"`
	Error             string                          `json:"error"`
	Deleted           bool                            `json:"deleted"`
	New               bool                            `json:"new"`
	Containers        []*commonmodels.Container       `json:"containers,omitempty"`
	UpdateServiceTmpl bool                            `json:"update_service_tmpl"`
	VariableYaml      string                          `json:"variable_yaml"`
	VariableKVs       []*commontypes.RenderVariableKV `json:"variable_kvs"`
}

type SyncEnvResourceArg

type SyncEnvResourceArg struct {
	EnvName     string `json:"env_name"`
	ProductName string `json:"product_name"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Production  bool   `json:"production"`
}

type TmplConfig

type TmplConfig struct {
	Data []ConfigTmplData `json:"data,omitempty"`
}

type TmplYaml

type TmplYaml struct {
	Yaml     string `json:"yaml,omitempty"`
	UpdateBy string `json:"update_by,omitempty"`
	Revision int64  `json:"revision,omitempty"`
}

type UpdateConfigMapArgs

type UpdateConfigMapArgs struct {
	EnvName              string   `json:"env_name"`
	ProductName          string   `json:"product_name"`
	ServiceName          string   `json:"service_name"`
	ConfigName           string   `json:"config_name"`
	YamlData             string   `json:"yaml_data"`
	RestartAssociatedSvc bool     `json:"restart_associated_svc"`
	Services             []string `json:"services"`
}

type UpdateContainerImageArgs

type UpdateContainerImageArgs struct {
	Type          string `json:"type"`
	ProductName   string `json:"product_name"`
	EnvName       string `json:"env_name"`
	ServiceName   string `json:"service_name"`
	Name          string `json:"name"`
	ContainerName string `json:"container_name"`
	Image         string `json:"image"`
	Production    bool   `json:"production"`
}

type UpdateEnv

type UpdateEnv struct {
	EnvName  string              `json:"env_name"`
	Services []*UpdateServiceArg `json:"services"`
}

type UpdateEnvRequest

type UpdateEnvRequest struct {
	Type        string `form:"type"`
	ProjectName string `form:"projectName"`
	Force       bool   `form:"force"`
}

type UpdateIngressArgs

type UpdateIngressArgs struct {
	EnvName              string `json:"env_name"`
	ProductName          string `json:"product_name"`
	IngressName          string `json:"ingress_name"`
	YamlData             string `json:"yaml_data"`
	RestartAssociatedSvc bool   `json:"restart_associated_svc"`
}

type UpdateMultiHelmProductArg

type UpdateMultiHelmProductArg struct {
	ProductName     string                            `json:"productName"`
	EnvNames        []string                          `json:"envNames"`
	ChartValues     []*commonservice.HelmSvcRenderArg `json:"chartValues"`
	DeletedServices []string                          `json:"deletedServices"`
	ReplacePolicy   string                            `json:"replacePolicy"` // TODO logic not implemented
}

type UpdatePvcArgs

type UpdatePvcArgs struct {
	EnvName              string `json:"env_name"`
	ProductName          string `json:"product_name"`
	PvcName              string `json:"pvc_name"`
	YamlData             string `json:"yaml_data"`
	RestartAssociatedSvc bool   `json:"restart_associated_svc"`
}

type UpdateServiceArg

type UpdateServiceArg struct {
	ServiceName    string                          `json:"service_name"`
	DeployStrategy string                          `json:"deploy_strategy"`
	VariableKVs    []*commontypes.RenderVariableKV `json:"variable_kvs"`
}

type WorkloadCommonData

type WorkloadCommonData struct {
	Name           string
	WorkloadDetail *resource.Workload
	Services       []*resource.Service
	Ingresses      []*resource.Ingress
}

func GetDeployWorkloadData

func GetDeployWorkloadData(ns, name string, kc client.Client, cs *kubernetes.Clientset, log *zap.SugaredLogger) (*WorkloadCommonData, error)

func GetDsWorkloadData

func GetDsWorkloadData(ns, name string, kc client.Client, cs *kubernetes.Clientset, log *zap.SugaredLogger) (*WorkloadCommonData, error)

func GetJobData

func GetJobData(ns, name string, kc client.Client, cs *kubernetes.Clientset, log *zap.SugaredLogger) (*WorkloadCommonData, error)

func GetStsWorkloadData

func GetStsWorkloadData(ns, name string, kc client.Client, cs *kubernetes.Clientset, log *zap.SugaredLogger) (*WorkloadCommonData, error)

type WorkloadCronJob

type WorkloadCronJob struct {
	*ResourceCommon
	Schedule     string `json:"schedule"`
	Suspend      bool   `json:"suspend"`
	Active       int    `json:"active"`
	LastSchedule string `json:"last_schedule"`
	Age          string `json:"age"`
}

type WorkloadDaemonSet

type WorkloadDaemonSet struct {
	*ResourceCommon
	Desired   int `json:"desired"`
	Current   int `json:"current"`
	Ready     int `json:"ready"`
	UpToDate  int `json:"up_to_date"`
	Available int `json:"available"`
}

type WorkloadDeploySts

type WorkloadDeploySts struct {
	*ResourceCommon
	Ready string `json:"ready"`
}

type WorkloadDetailResp

type WorkloadDetailResp struct {
	Name     string                    `json:"name"`
	Type     string                    `json:"type"`
	Replicas int32                     `json:"replicas"`
	Images   []resource.ContainerImage `json:"images"`
	Pods     []*resource.Pod           `json:"pods"`
	Ingress  []*resource.Ingress       `json:"ingress"`
	Services []*resource.Service       `json:"service_endpoints"`
}

func GetWorkloadDetail

func GetWorkloadDetail(args *FetchResourceArgs, workloadType, workloadName string, log *zap.SugaredLogger) (*WorkloadDetailResp, error)

type WorkloadImage

type WorkloadImage struct {
	Name  string `json:"name"`
	Image string `json:"image"`
}

type WorkloadImageTarget

type WorkloadImageTarget struct {
	Target    string `json:"target"`
	ImageName string `json:"image_name"`
}

func ListCustomWorkload

func ListCustomWorkload(clusterID, namespace string, log *zap.SugaredLogger) ([]*WorkloadImageTarget, error)

type WorkloadInfo

type WorkloadInfo struct {
	WorkloadType  string `json:"workload_type"`
	WorkloadName  string `json:"workload_name"`
	ContainerName string `json:"container_name"`
}

func ListWorkloadsInfo

func ListWorkloadsInfo(clusterID, namespace string, log *zap.SugaredLogger) ([]*WorkloadInfo, error)

for now,only support deployment

type WorkloadItem

type WorkloadItem interface {
	GetName() string
	ImageInfos() []string
}

type WorkloadJob

type WorkloadJob struct {
	*ResourceCommon
	Completions string `json:"completions"`
	Duration    string `json:"duration"`
	Age         string `json:"age"`
}

type YamlContentRequestArg

type YamlContentRequestArg struct {
	CodehostID  int    `json:"codehostID" form:"codehostID"`
	Owner       string `json:"owner" form:"owner"`
	Repo        string `json:"repo" form:"repo"`
	Namespace   string `json:"namespace" form:"namespace"`
	Branch      string `json:"branch" form:"branch"`
	RepoLink    string `json:"repoLink" form:"repoLink"`
	ValuesPaths string `json:"valuesPaths" form:"valuesPaths"`
}

type YamlProductItem

type YamlProductItem struct {
	OldName         string                           `json:"old_name"`
	NewName         string                           `json:"new_name"`
	BaseName        string                           `json:"base_name"`
	DefaultValues   string                           `json:"default_values"`
	GlobalVariables []*commontypes.GlobalVariableKV  `json:"global_variables"`
	Services        []*commonservice.K8sSvcRenderArg `json:"services"`
}

type YamlServiceWithKV

type YamlServiceWithKV struct {
	ServiceName string                          `json:"service_name"`
	VariableKvs []*commontypes.RenderVariableKV `json:"variable_kvs"`
}

Jump to

Keyboard shortcuts

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