Documentation ¶
Index ¶
- Constants
- Variables
- func BulkCopyHelmProduct(projectName, user, requestID string, arg CopyHelmProductArg, ...) error
- func BulkCopyYamlProduct(projectName, user, requestID string, arg CopyYamlProductArg, ...) error
- func CleanProductCronJob(requestID string, log *zap.SugaredLogger)
- func CleanProducts()
- func CopyHelmProduct(productName, userName, requestID string, args []*CreateHelmProductArg, ...) error
- func CreateHelmProduct(productName, userName, requestID string, args []*CreateHelmProductArg, ...) error
- func CreateProduct(user, requestID string, args *commonmodels.Product, log *zap.SugaredLogger) (err error)
- func DeletePod(envName, productName, podName string, log *zap.SugaredLogger) error
- func ExportYaml(envName, productName, serviceName string, log *zap.SugaredLogger) []string
- func FillProductVars(products []*commonmodels.Product, log *zap.SugaredLogger) error
- func FindHelmRenderSet(productName, renderName string, log *zap.SugaredLogger) (*commonmodels.RenderSet, error)
- func GeneEstimatedValues(productName, envName, serviceName, scene, format string, ...) (interface{}, error)
- func GetBundleResources(logger *zap.SugaredLogger) ([]*resourceSpec, error)
- func GetEstimatedRenderCharts(productName, envName, serviceNameListStr string, log *zap.SugaredLogger) ([]*commonservice.RenderChartArg, error)
- func GetHelmChartVersions(productName, envName string, log *zap.SugaredLogger) ([]*commonmodels.HelmVersions, error)
- func GetIngressInfo(product *commonmodels.Product, service *commonmodels.Service, ...) *commonservice.IngressInfo
- func GetInitProduct(productTmplName string, log *zap.SugaredLogger) (*commonmodels.Product, error)
- func GetMergedYamlContent(arg *YamlContentRequestArg, paths []string) (string, error)
- func GetProductInfo(username, envName, productName string, log *zap.SugaredLogger) (*commonmodels.Product, error)
- func GetServiceContainer(envName, productName, serviceName, container string, log *zap.SugaredLogger) error
- func ListAvailableNamespaces(clusterID, listType string, log *zap.SugaredLogger) ([]*resource.Namespace, error)
- func ListConfigMaps(args *ListConfigMapArgs, log *zap.SugaredLogger) ([]*configMapWithHistory, error)
- func ListGroups(serviceName, envName, productName string, perPage, page int, ...) ([]*commonservice.ServiceResp, int, error)
- func ListKubeEvents(env string, productName string, name string, rtype string, ...) ([]*resource.Event, error)
- func ListPodEvents(envName, productName, podName string, log *zap.SugaredLogger) ([]*resource.Event, error)
- func ListServicePods(productName, envName string, serviceName string, log *zap.SugaredLogger) ([]*resource.Pod, error)
- func ResetProductsStatus()
- func RestartScale(args *RestartScaleArgs, _ *zap.SugaredLogger) error
- func RestartService(envName string, args *SvcOptArgs, log *zap.SugaredLogger) (err error)
- func RollBackConfigMap(envName string, args *RollBackConfigMapArgs, userName, userID string, ...) error
- func Scale(args *ScaleArgs, logger *zap.SugaredLogger) error
- func ScaleService(envName, productName, serviceName string, number int, log *zap.SugaredLogger) (err error)
- func UpdateConfigMap(envName string, args *UpdateConfigMapArgs, userName, userID string, ...) error
- func UpdateContainerImage(requestID string, args *UpdateContainerImageArgs, log *zap.SugaredLogger) error
- func UpdateHelmProduct(productName, envName, updateType, username, requestID string, ...) error
- func UpdateHelmProductRenderset(productName, envName, userName, requestID string, args *EnvRendersetArg, ...) error
- func UpdateHelmProductVariable(productName, envName, username, requestID string, ...) error
- func UpdateProduct(existedProd, updateProd *commonmodels.Product, ...) (err error)
- func UpdateProductRecycleDay(envName, productName string, recycleDay int) error
- func UpdateProductRegistry(envName, productName, registryID string, log *zap.SugaredLogger) (err error)
- func UpdateProductV2(envName, productName, user, requestID string, force bool, ...) (err error)
- func UpdateService(args *SvcOptArgs, log *zap.SugaredLogger) error
- type AutoCreator
- type ChartInfo
- type ConfigDiffResult
- type ConfigTmplData
- type ContainerNotFound
- type CopyHelmProductArg
- type CopyYamlProductArg
- type CreateHelmProductArg
- type CreateProductParam
- type DefaultProductCreator
- type DefaultValuesResp
- type EnvRenderChartArg
- type EnvRendersetArg
- type EnvResp
- type EnvStatus
- func AutoCreateProduct(productName, envType, requestID string, log *zap.SugaredLogger) []*EnvStatus
- func AutoUpdateProduct(envNames []string, productName, requestID string, force bool, ...) ([]*EnvStatus, error)
- func UpdateMultipleHelmEnv(requestID string, args *UpdateMultiHelmProductArg, log *zap.SugaredLogger) ([]*EnvStatus, error)
- type EstimateValuesArg
- type ExternalProductCreator
- type HelmChartsResp
- type HelmProductCreator
- type HelmProductItem
- type HelmReleaseResp
- type IProductCreator
- type K8sService
- type ListConfigMapArgs
- type NodeResp
- type PMProductCreator
- type PMService
- type ProductIngressInfo
- type ProductParams
- type ProductResp
- type ProductRevision
- func GetProductRevision(product *commonmodels.Product, allServiceTmpls []*commonmodels.Service, ...) (*ProductRevision, error)
- func ListProductsRevision(productName, envName string, log *zap.SugaredLogger) (prodRevs []*ProductRevision, err error)
- func ListProductsRevisionByFacility(basicFacility string, log *zap.SugaredLogger) ([]*ProductRevision, error)
- type RawYamlResp
- type RestartScaleArgs
- type RollBackConfigMapArgs
- type ScaleArgs
- type SvcDiffResult
- type SvcOptArgs
- type SvcResp
- type SvcRevision
- type TmplConfig
- type TmplYaml
- type UpdateConfigMapArgs
- type UpdateContainerImageArgs
- type UpdateMultiHelmProductArg
- type YamlContentRequestArg
- type YamlProductItem
Constants ¶
View Source
const ( Timeout = 60 UpdateTypeSystem = "systemVar" UpdateTypeEnv = "envVar" )
Variables ¶
View Source
var DefaultCleanWhiteList = []string{"spockadmin"}
Functions ¶
func BulkCopyHelmProduct ¶ added in v1.9.9
func BulkCopyHelmProduct(projectName, user, requestID string, arg CopyHelmProductArg, log *zap.SugaredLogger) error
func BulkCopyYamlProduct ¶ added in v1.9.9
func BulkCopyYamlProduct(projectName, user, requestID string, arg CopyYamlProductArg, log *zap.SugaredLogger) error
func CleanProductCronJob ¶
func CleanProductCronJob(requestID string, log *zap.SugaredLogger)
func CleanProducts ¶
func CleanProducts()
func CopyHelmProduct ¶ added in v1.8.0
func CopyHelmProduct(productName, userName, requestID string, args []*CreateHelmProductArg, log *zap.SugaredLogger) error
func CreateHelmProduct ¶ added in v1.5.0
func CreateHelmProduct(productName, userName, requestID string, args []*CreateHelmProductArg, log *zap.SugaredLogger) error
func CreateProduct ¶
func CreateProduct(user, requestID string, args *commonmodels.Product, log *zap.SugaredLogger) (err error)
CreateProduct create a new product with its dependent stacks
func ExportYaml ¶
func ExportYaml(envName, productName, serviceName string, log *zap.SugaredLogger) []string
ExportYaml 查询使用到服务模板的服务组模板
func FillProductVars ¶
func FillProductVars(products []*commonmodels.Product, log *zap.SugaredLogger) error
func FindHelmRenderSet ¶ added in v1.2.0
func FindHelmRenderSet(productName, renderName string, log *zap.SugaredLogger) (*commonmodels.RenderSet, error)
func GeneEstimatedValues ¶ added in v1.6.0
func GeneEstimatedValues(productName, envName, serviceName, scene, format string, arg *EstimateValuesArg, log *zap.SugaredLogger) (interface{}, error)
func GetBundleResources ¶ added in v1.7.1
func GetBundleResources(logger *zap.SugaredLogger) ([]*resourceSpec, error)
func GetEstimatedRenderCharts ¶ added in v1.5.0
func GetEstimatedRenderCharts(productName, envName, serviceNameListStr string, log *zap.SugaredLogger) ([]*commonservice.RenderChartArg, error)
func GetHelmChartVersions ¶ added in v1.2.0
func GetHelmChartVersions(productName, envName string, log *zap.SugaredLogger) ([]*commonmodels.HelmVersions, error)
func GetIngressInfo ¶
func GetIngressInfo(product *commonmodels.Product, service *commonmodels.Service, log *zap.SugaredLogger) *commonservice.IngressInfo
func GetInitProduct ¶
func GetInitProduct(productTmplName string, log *zap.SugaredLogger) (*commonmodels.Product, error)
func GetMergedYamlContent ¶ added in v1.6.0
func GetMergedYamlContent(arg *YamlContentRequestArg, paths []string) (string, error)
func GetProductInfo ¶
func GetProductInfo(username, envName, productName string, log *zap.SugaredLogger) (*commonmodels.Product, error)
func GetServiceContainer ¶
func GetServiceContainer(envName, productName, serviceName, container string, log *zap.SugaredLogger) error
func ListAvailableNamespaces ¶
func ListAvailableNamespaces(clusterID, listType string, log *zap.SugaredLogger) ([]*resource.Namespace, error)
ListAvailableNamespaces lists available namespaces created by non-koderover
func ListConfigMaps ¶
func ListConfigMaps(args *ListConfigMapArgs, log *zap.SugaredLogger) ([]*configMapWithHistory, error)
func ListGroups ¶
func ListGroups(serviceName, envName, productName string, perPage, page int, log *zap.SugaredLogger) ([]*commonservice.ServiceResp, int, error)
func ListKubeEvents ¶
func ListPodEvents ¶
func ListServicePods ¶
func ResetProductsStatus ¶
func ResetProductsStatus()
func RestartScale ¶
func RestartScale(args *RestartScaleArgs, _ *zap.SugaredLogger) error
func RestartService ¶
func RestartService(envName string, args *SvcOptArgs, log *zap.SugaredLogger) (err error)
RestartService 在kube中, 如果资源存在就更新不存在就创建
func RollBackConfigMap ¶
func RollBackConfigMap(envName string, args *RollBackConfigMapArgs, userName, userID string, log *zap.SugaredLogger) error
func ScaleService ¶
func ScaleService(envName, productName, serviceName string, number int, log *zap.SugaredLogger) (err error)
ScaleService 增加或者缩减服务的deployment或者stafefulset的副本数量
func UpdateConfigMap ¶
func UpdateConfigMap(envName string, args *UpdateConfigMapArgs, userName, userID string, log *zap.SugaredLogger) error
func UpdateContainerImage ¶
func UpdateContainerImage(requestID string, args *UpdateContainerImageArgs, log *zap.SugaredLogger) error
func UpdateHelmProduct ¶ added in v1.2.0
func UpdateHelmProduct(productName, envName, updateType, username, requestID string, overrideCharts []*commonservice.RenderChartArg, log *zap.SugaredLogger) error
func UpdateHelmProductRenderset ¶ added in v1.6.0
func UpdateHelmProductRenderset(productName, envName, userName, requestID string, args *EnvRendersetArg, log *zap.SugaredLogger) error
func UpdateHelmProductVariable ¶ added in v1.2.0
func UpdateHelmProductVariable(productName, envName, username, requestID string, updatedRcs []*templatemodels.RenderChart, renderset *commonmodels.RenderSet, log *zap.SugaredLogger) error
func UpdateProduct ¶
func UpdateProduct(existedProd, updateProd *commonmodels.Product, renderSet *commonmodels.RenderSet, log *zap.SugaredLogger) (err error)
func UpdateProductRecycleDay ¶ added in v1.2.0
func UpdateProductRegistry ¶ added in v1.8.0
func UpdateProductRegistry(envName, productName, registryID string, log *zap.SugaredLogger) (err error)
func UpdateProductV2 ¶
func UpdateProductV2(envName, productName, user, requestID string, force bool, kvs []*templatemodels.RenderKV, log *zap.SugaredLogger) (err error)
func UpdateService ¶
func UpdateService(args *SvcOptArgs, log *zap.SugaredLogger) error
Types ¶
type AutoCreator ¶ added in v1.5.0
type AutoCreator struct {
Param *CreateProductParam
}
type ConfigDiffResult ¶
type ConfigDiffResult struct { Current TmplConfig `json:"current,omitempty"` Latest TmplConfig `json:"latest,omitempty"` }
type ConfigTmplData ¶
type ContainerNotFound ¶
type ContainerNotFound struct { ServiceName string Container string EnvName string ProductName string }
func (*ContainerNotFound) Error ¶
func (c *ContainerNotFound) Error() string
type CopyHelmProductArg ¶ added in v1.9.9
type CopyHelmProductArg struct {
Items []HelmProductItem
}
type CopyYamlProductArg ¶ added in v1.9.9
type CopyYamlProductArg struct {
Items []YamlProductItem `json:"items"`
}
type CreateHelmProductArg ¶ added in v1.5.0
type CreateHelmProductArg struct { ProductName string `json:"productName"` EnvName string `json:"envName"` Namespace string `json:"namespace"` ClusterID string `json:"clusterID"` DefaultValues string `json:"defaultValues"` RegistryID string `json:"registry_id"` ChartValues []*commonservice.RenderChartArg `json:"chartValues"` BaseEnvName string `json:"baseEnvName"` BaseName string `json:"base_name,omitempty"` IsExisted bool `json:"is_existed"` }
type CreateProductParam ¶ added in v1.5.0
type DefaultProductCreator ¶ added in v1.5.0
type DefaultProductCreator struct { }
func (*DefaultProductCreator) Create ¶ added in v1.5.0
func (creator *DefaultProductCreator) Create(user, requestID string, args *models.Product, log *zap.SugaredLogger) error
type DefaultValuesResp ¶ added in v1.6.0
type DefaultValuesResp struct {
DefaultValues string `json:"defaultValues"`
}
func GetDefaultValues ¶ added in v1.6.0
func GetDefaultValues(productName, envName string, log *zap.SugaredLogger) (*DefaultValuesResp, error)
type EnvRenderChartArg ¶ added in v1.5.0
type EnvRenderChartArg struct {
ChartValues []*commonservice.RenderChartArg `json:"chartValues"`
}
type EnvRendersetArg ¶ added in v1.6.0
type EnvRendersetArg struct { DefaultValues string `json:"defaultValues"` ChartValues []*commonservice.RenderChartArg `json:"chartValues"` }
type EnvResp ¶ added in v1.7.1
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"` 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"` }
func ListProducts ¶
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
自动创建环境
func AutoUpdateProduct ¶
func UpdateMultipleHelmEnv ¶ added in v1.5.0
func UpdateMultipleHelmEnv(requestID string, args *UpdateMultiHelmProductArg, log *zap.SugaredLogger) ([]*EnvStatus, error)
type EstimateValuesArg ¶ added in v1.6.0
type EstimateValuesArg struct { DefaultValues string `json:"defaultValues"` OverrideYaml string `json:"overrideYaml"` OverrideValues []*commonservice.KVPair `json:"overrideValues,omitempty"` }
type ExternalProductCreator ¶ added in v1.5.0
type ExternalProductCreator struct { }
func (*ExternalProductCreator) Create ¶ added in v1.5.0
func (creator *ExternalProductCreator) Create(user, requestID string, args *models.Product, log *zap.SugaredLogger) error
type HelmChartsResp ¶ added in v1.8.0
type HelmChartsResp struct { ChartInfos []*ChartInfo `json:"chartInfos"` FileInfos []*types.FileInfo `json:"fileInfos"` }
func GetChartInfos ¶ added in v1.8.0
func GetChartInfos(productName, envName, serviceName string, log *zap.SugaredLogger) (*HelmChartsResp, error)
type HelmProductCreator ¶ added in v1.5.0
type HelmProductCreator struct{}
func (*HelmProductCreator) Create ¶ added in v1.5.0
func (creator *HelmProductCreator) Create(user, requestID string, args *models.Product, log *zap.SugaredLogger) error
type HelmProductItem ¶ added in v1.9.9
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.RenderChartArg `json:"chart_values"` }
type HelmReleaseResp ¶ added in v1.8.0
type HelmReleaseResp struct { ReleaseName string `json:"releaseName"` ServiceName string `json:"serviceName"` Revision int `json:"revision"` Chart string `json:"chart"` AppVersion string `json:"appVersion"` }
func ListReleases ¶ added in v1.8.0
func ListReleases(productName, envName string, log *zap.SugaredLogger) ([]*HelmReleaseResp, error)
type IProductCreator ¶ added in v1.5.0
type K8sService ¶
type K8sService struct {
// contains filtered or unexported fields
}
type ListConfigMapArgs ¶
type NodeResp ¶ added in v1.8.0
type NodeResp struct { Nodes []*internalresource.Node `json:"data"` Labels []string `json:"labels"` }
func ListAvailableNodes ¶ added in v1.8.0
func ListAvailableNodes(clusterID string, log *zap.SugaredLogger) (*NodeResp, error)
type PMProductCreator ¶ added in v1.5.0
type PMProductCreator struct { }
func (*PMProductCreator) Create ¶ added in v1.5.0
func (creator *PMProductCreator) Create(user, requestID string, args *models.Product, log *zap.SugaredLogger) error
type PMService ¶ added in v1.2.0
type PMService struct {
// contains filtered or unexported fields
}
type ProductIngressInfo ¶
type ProductIngressInfo struct { IngressInfos []*commonservice.IngressInfo `json:"ingress_infos"` EnvName string `json:"env_name"` }
func GetProductIngress ¶
func GetProductIngress(productName string, log *zap.SugaredLogger) ([]*ProductIngressInfo, error)
type ProductParams ¶
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 [][]string `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"` }
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)
func ListProductsRevision ¶
func ListProductsRevision(productName, envName string, log *zap.SugaredLogger) (prodRevs []*ProductRevision, err error)
func ListProductsRevisionByFacility ¶ added in v1.4.0
func ListProductsRevisionByFacility(basicFacility string, log *zap.SugaredLogger) ([]*ProductRevision, error)
ListProductsRevisionByFacility called by service cron
func (*ProductRevision) GroupsUpdated ¶
func (pr *ProductRevision) GroupsUpdated() bool
type RawYamlResp ¶ added in v1.6.0
type RawYamlResp struct {
YamlContent string `json:"yamlContent"`
}
type RestartScaleArgs ¶
type RollBackConfigMapArgs ¶
type SvcDiffResult ¶
type SvcDiffResult struct { Current TmplYaml `json:"current,omitempty"` Latest TmplYaml `json:"latest,omitempty"` }
func GetServiceDiff ¶ added in v1.3.0
func GetServiceDiff(envName, productName, serviceName string, log *zap.SugaredLogger) (*SvcDiffResult, error)
GetServiceDiff 获得服务模板当前版本和最新版本的对比
type SvcOptArgs ¶
type SvcResp ¶
type SvcResp struct { ServiceName string `json:"service_name"` Scales []*internalresource.Workload `json:"scales"` Ingress []*internalresource.Ingress `json:"ingress"` Services []*internalresource.Service `json:"service_endpoints"` EnvName string `json:"env_name"` ProductName string `json:"product_name"` GroupName string `json:"group_name"` }
SvcResp struct 产品-服务详情页面Response
func GetService ¶
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"` Deleted bool `json:"deleted"` New bool `json:"new"` Containers []*commonmodels.Container `json:"containers,omitempty"` }
type TmplConfig ¶
type TmplConfig struct {
Data []ConfigTmplData `json:"data,omitempty"`
}
type UpdateConfigMapArgs ¶
type UpdateMultiHelmProductArg ¶ added in v1.5.0
type UpdateMultiHelmProductArg struct { ProductName string `json:"productName"` EnvNames []string `json:"envNames"` ChartValues []*commonservice.RenderChartArg `json:"chartValues"` ReplacePolicy string `json:"replacePolicy"` // TODO logic not implemented }
type YamlContentRequestArg ¶ added in v1.6.0
type YamlContentRequestArg struct { CodehostID int `json:"codehostID" form:"codehostID"` Owner string `json:"owner" form:"owner"` Repo string `json:"repo" form:"repo"` Branch string `json:"branch" form:"branch"` RepoLink string `json:"repoLink" form:"repoLink"` ValuesPaths string `json:"valuesPaths" form:"valuesPaths"` }
type YamlProductItem ¶ added in v1.9.9
type YamlProductItem struct { OldName string `json:"old_name"` NewName string `json:"new_name"` BaseName string `json:"base_name"` Vars []*templatemodels.RenderKV `json:"vars"` }
Click to show internal directories.
Click to hide internal directories.