chart

package
v0.6.24 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DeploymentChartType = "Deployment"
	RolloutChartType    = "Rollout Deployment"
	ReferenceChart      = "reference-chart"
)
View Source
const (
	CHART_ALREADY_EXISTS_INTERNAL_ERROR = "Chart exists already, try uploading another chart"
	CHART_NAME_RESERVED_INTERNAL_ERROR  = "Change the name of the chart and try uploading again"
)

Variables

View Source
var ReservedChartRefNamesList *[]ReservedChartList

Functions

func CheckCompatibility added in v0.6.21

func CheckCompatibility(oldChartType, newChartType string) bool

func CompatibleChartsWith added in v0.6.21

func CompatibleChartsWith(chartType string) []string

func PatchWinterSoldierConfig added in v0.6.21

func PatchWinterSoldierConfig(override json.RawMessage, newChartType string) (json.RawMessage, error)

func PatchWinterSoldierIfExists added in v0.6.21

func PatchWinterSoldierIfExists(newChartType string, jsonMap map[string]json.RawMessage) (map[string]json.RawMessage, error)

func SetReservedChartList added in v0.6.23

func SetReservedChartList(devtronChartList []*chartRepoRepository.ChartRef)

Types

type AppConfigResponse

type AppConfigResponse struct {
	//DefaultAppConfig  json.RawMessage `json:"defaultAppConfig"`
	//AppConfig         TemplateRequest            `json:"appConfig"`
	LatestAppConfig   TemplateRequest `json:"latestAppConfig"`
	PreviousAppConfig TemplateRequest `json:"previousAppConfig"`
}

type AppMetricEnableDisableRequest

type AppMetricEnableDisableRequest struct {
	AppId               int   `json:"appId,omitempty"`
	EnvironmentId       int   `json:"environmentId,omitempty"`
	IsAppMetricsEnabled bool  `json:"isAppMetricsEnabled"`
	UserId              int32 `json:"-"`
}

type AppMetricsEnabled

type AppMetricsEnabled struct {
	AppMetrics bool `json:"app-metrics"`
}

type ChartDataInfo

type ChartDataInfo struct {
	ChartLocation   string `json:"chartLocation"`
	ChartName       string `json:"chartName"`
	ChartVersion    string `json:"chartVersion"`
	TemporaryFolder string `json:"temporaryFolder"`
	Description     string `json:"description"`
	Message         string `json:"message"`
}

type ChartDto

type ChartDto struct {
	Id               int    `json:"id"`
	Name             string `json:"name"`
	ChartDescription string `json:"chartDescription"`
	Version          string `json:"version"`
	IsUserUploaded   bool   `json:"isUserUploaded"`
}

type ChartRef added in v0.6.22

type ChartRef struct {
	Id                    int    `json:"id"`
	Version               string `json:"version"`
	Name                  string `json:"name"`
	Description           string `json:"description"`
	UserUploaded          bool   `json:"userUploaded"`
	IsAppMetricsSupported bool   `json:"isAppMetricsSupported"`
}

type ChartRefChangeRequest added in v0.6.21

type ChartRefChangeRequest struct {
	AppId            int `json:"appId" validate:"required"`
	EnvId            int `json:"envId" validate:"required"`
	TargetChartRefId int `json:"targetChartRefId" validate:"required"`
}

type ChartRefMetaData added in v0.6.6

type ChartRefMetaData struct {
	ChartDescription string `json:"chartDescription"`
}

type ChartRefResponse added in v0.6.22

type ChartRefResponse struct {
	ChartRefs            []ChartRef                  `json:"chartRefs"`
	LatestChartRef       int                         `json:"latestChartRef"`
	LatestAppChartRef    int                         `json:"latestAppChartRef"`
	LatestEnvChartRef    int                         `json:"latestEnvChartRef,omitempty"`
	ChartsMetadata       map[string]ChartRefMetaData `json:"chartMetadata"` // chartName vs Metadata
	CompatibleChartTypes []string                    `json:"compatibleChartTypes,omitempty"`
}

type ChartService

type ChartService interface {
	Create(templateRequest TemplateRequest, ctx context.Context) (chart *TemplateRequest, err error)
	CreateChartFromEnvOverride(templateRequest TemplateRequest, ctx context.Context) (chart *TemplateRequest, err error)
	FindLatestChartForAppByAppId(appId int) (chartTemplate *TemplateRequest, err error)
	GetByAppIdAndChartRefId(appId int, chartRefId int) (chartTemplate *TemplateRequest, err error)
	GetAppOverrideForDefaultTemplate(chartRefId int) (map[string]interface{}, string, error)
	UpdateAppOverride(ctx context.Context, templateRequest *TemplateRequest) (*TemplateRequest, error)
	IsReadyToTrigger(appId int, envId int, pipelineId int) (IsReady, error)
	ChartRefAutocomplete() ([]ChartRef, error)
	ChartRefAutocompleteForAppOrEnv(appId int, envId int) (*ChartRefResponse, error)
	FindPreviousChartByAppId(appId int) (chartTemplate *TemplateRequest, err error)
	UpgradeForApp(appId int, chartRefId int, newAppOverride map[string]interface{}, userId int32, ctx context.Context) (bool, error)
	AppMetricsEnableDisable(appMetricRequest AppMetricEnableDisableRequest) (*AppMetricEnableDisableRequest, error)
	DeploymentTemplateValidate(ctx context.Context, templatejson interface{}, chartRefId int, scope resourceQualifiers.Scope) (bool, error)
	JsonSchemaExtractFromFile(chartRefId int) (map[string]interface{}, string, error)
	GetSchemaAndReadmeForTemplateByChartRefId(chartRefId int) (schema []byte, readme []byte, err error)
	ExtractChartIfMissing(chartData []byte, refChartDir string, location string) (*ChartDataInfo, error)
	CheckChartExists(chartRefId int) error
	CheckIsAppMetricsSupported(chartRefId int) (bool, error)
	GetLocationFromChartNameAndVersion(chartName string, chartVersion string) string
	FormatChartName(chartName string) string
	ValidateUploadedFileFormat(fileName string) error
	ReadChartMetaDataForLocation(chartDir string, fileName string) (*ChartYamlStruct, error)
	RegisterInArgo(chartGitAttribute *util.ChartGitAttribute, ctx context.Context) error
	FetchCustomChartsInfo() ([]*ChartDto, error)
	CheckCustomChartByAppId(id int) (bool, error)
	CheckCustomChartByChartId(id int) (bool, error)
	ChartRefIdsCompatible(oldChartRefId int, newChartRefId int) (bool, string, string)
	PatchEnvOverrides(values json.RawMessage, oldChartType string, newChartType string) (json.RawMessage, error)
	FlaggerCanaryEnabled(values json.RawMessage) (bool, error)
	GetCustomChartInBytes(chatRefId int) ([]byte, error)
	GetRefChart(templateRequest TemplateRequest) (string, string, error, string, string)
	ExtractVariablesAndResolveTemplate(scope resourceQualifiers.Scope, template string, templateType parsers.VariableTemplateType) (string, error)
}

type ChartServiceImpl

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

func NewChartServiceImpl

func NewChartServiceImpl(chartRepository chartRepoRepository.ChartRepository,
	logger *zap.SugaredLogger,
	chartTemplateService util.ChartTemplateService,
	repoRepository chartRepoRepository.ChartRepoRepository,
	pipelineGroupRepository app.AppRepository,
	refChartDir chartRepoRepository.RefChartDir,
	defaultChart DefaultChart,
	mergeUtil util.MergeUtil,
	repositoryService repository.ServiceClient,
	chartRefRepository chartRepoRepository.ChartRefRepository,
	envOverrideRepository chartConfig.EnvConfigOverrideRepository,
	pipelineConfigRepository chartConfig.PipelineConfigRepository,
	configMapRepository chartConfig.ConfigMapRepository,
	environmentRepository repository4.EnvironmentRepository,
	pipelineRepository pipelineConfig.PipelineRepository,
	appLevelMetricsRepository repository3.AppLevelMetricsRepository,
	envLevelAppMetricsRepository repository3.EnvLevelAppMetricsRepository,
	client *http.Client,
	deploymentTemplateHistoryService history.DeploymentTemplateHistoryService,
	variableEntityMappingService variables.VariableEntityMappingService,
	variableTemplateParser parsers.VariableTemplateParser,
	scopedVariableService variables.ScopedVariableService) *ChartServiceImpl

func (ChartServiceImpl) AppMetricsEnableDisable

func (impl ChartServiceImpl) AppMetricsEnableDisable(appMetricRequest AppMetricEnableDisableRequest) (*AppMetricEnableDisableRequest, error)

func (ChartServiceImpl) ChartRefAutocomplete

func (impl ChartServiceImpl) ChartRefAutocomplete() ([]ChartRef, error)

func (ChartServiceImpl) ChartRefAutocompleteForAppOrEnv

func (impl ChartServiceImpl) ChartRefAutocompleteForAppOrEnv(appId int, envId int) (*ChartRefResponse, error)

func (ChartServiceImpl) ChartRefIdsCompatible added in v0.6.21

func (impl ChartServiceImpl) ChartRefIdsCompatible(oldChartRefId int, newChartRefId int) (bool, string, string)

func (ChartServiceImpl) CheckChartExists

func (impl ChartServiceImpl) CheckChartExists(chartRefId int) error

func (ChartServiceImpl) CheckCustomChartByAppId

func (impl ChartServiceImpl) CheckCustomChartByAppId(id int) (bool, error)

func (ChartServiceImpl) CheckCustomChartByChartId

func (impl ChartServiceImpl) CheckCustomChartByChartId(id int) (bool, error)

func (ChartServiceImpl) CheckIsAppMetricsSupported added in v0.6.17

func (impl ChartServiceImpl) CheckIsAppMetricsSupported(chartRefId int) (bool, error)

func (ChartServiceImpl) Create

func (impl ChartServiceImpl) Create(templateRequest TemplateRequest, ctx context.Context) (*TemplateRequest, error)

func (ChartServiceImpl) CreateChartFromEnvOverride

func (impl ChartServiceImpl) CreateChartFromEnvOverride(templateRequest TemplateRequest, ctx context.Context) (*TemplateRequest, error)

func (ChartServiceImpl) DeploymentTemplateValidate

func (impl ChartServiceImpl) DeploymentTemplateValidate(ctx context.Context, template interface{}, chartRefId int, scope resourceQualifiers.Scope) (bool, error)

func (ChartServiceImpl) ExtractChartIfMissing

func (impl ChartServiceImpl) ExtractChartIfMissing(chartData []byte, refChartDir string, location string) (*ChartDataInfo, error)

func (ChartServiceImpl) ExtractVariablesAndResolveTemplate added in v0.6.24

func (impl ChartServiceImpl) ExtractVariablesAndResolveTemplate(scope resourceQualifiers.Scope, template string, templateType parsers.VariableTemplateType) (string, error)

func (ChartServiceImpl) FetchCustomChartsInfo added in v0.6.23

func (impl ChartServiceImpl) FetchCustomChartsInfo() ([]*ChartDto, error)

func (ChartServiceImpl) FindLatestChartForAppByAppId

func (impl ChartServiceImpl) FindLatestChartForAppByAppId(appId int) (chartTemplate *TemplateRequest, err error)

func (ChartServiceImpl) FindPreviousChartByAppId

func (impl ChartServiceImpl) FindPreviousChartByAppId(appId int) (chartTemplate *TemplateRequest, err error)

func (ChartServiceImpl) FlaggerCanaryEnabled added in v0.6.21

func (impl ChartServiceImpl) FlaggerCanaryEnabled(values json.RawMessage) (bool, error)

func (*ChartServiceImpl) FormatChartName added in v0.6.23

func (impl *ChartServiceImpl) FormatChartName(chartName string) string

func (ChartServiceImpl) GetAppOverrideForDefaultTemplate

func (impl ChartServiceImpl) GetAppOverrideForDefaultTemplate(chartRefId int) (map[string]interface{}, string, error)

func (ChartServiceImpl) GetByAppIdAndChartRefId

func (impl ChartServiceImpl) GetByAppIdAndChartRefId(appId int, chartRefId int) (chartTemplate *TemplateRequest, err error)

func (ChartServiceImpl) GetCustomChartInBytes added in v0.6.23

func (impl ChartServiceImpl) GetCustomChartInBytes(chartRefId int) ([]byte, error)

func (*ChartServiceImpl) GetLocationFromChartNameAndVersion

func (impl *ChartServiceImpl) GetLocationFromChartNameAndVersion(chartName string, chartVersion string) string

func (ChartServiceImpl) GetRefChart added in v0.6.24

func (impl ChartServiceImpl) GetRefChart(templateRequest TemplateRequest) (string, string, error, string, string)

func (ChartServiceImpl) GetSchemaAndReadmeForTemplateByChartRefId

func (impl ChartServiceImpl) GetSchemaAndReadmeForTemplateByChartRefId(chartRefId int) ([]byte, []byte, error)

func (ChartServiceImpl) IsReadyToTrigger

func (impl ChartServiceImpl) IsReadyToTrigger(appId int, envId int, pipelineId int) (IsReady, error)

func (ChartServiceImpl) JsonSchemaExtractFromFile

func (impl ChartServiceImpl) JsonSchemaExtractFromFile(chartRefId int) (map[string]interface{}, string, error)

func (ChartServiceImpl) PatchEnvOverrides added in v0.6.21

func (impl ChartServiceImpl) PatchEnvOverrides(values json.RawMessage, oldChartType string, newChartType string) (json.RawMessage, error)

func (ChartServiceImpl) ReadChartMetaDataForLocation

func (impl ChartServiceImpl) ReadChartMetaDataForLocation(chartDir string, fileName string) (*ChartYamlStruct, error)

func (ChartServiceImpl) RegisterInArgo

func (impl ChartServiceImpl) RegisterInArgo(chartGitAttribute *util.ChartGitAttribute, ctx context.Context) error

func (ChartServiceImpl) UpdateAppOverride

func (impl ChartServiceImpl) UpdateAppOverride(ctx context.Context, templateRequest *TemplateRequest) (*TemplateRequest, error)

func (ChartServiceImpl) UpgradeForApp

func (impl ChartServiceImpl) UpgradeForApp(appId int, chartRefId int, newAppOverride map[string]interface{}, userId int32, ctx context.Context) (bool, error)

func (ChartServiceImpl) ValidateReservedChartName added in v0.6.23

func (impl ChartServiceImpl) ValidateReservedChartName(chartName string) (isReservedChart bool, err error)

func (*ChartServiceImpl) ValidateUploadedFileFormat

func (impl *ChartServiceImpl) ValidateUploadedFileFormat(fileName string) error

type ChartUpgradeRequest

type ChartUpgradeRequest struct {
	ChartRefId int   `json:"chartRefId"  validate:"number"`
	All        bool  `json:"all"`
	AppIds     []int `json:"appIds"`
	UserId     int32 `json:"-"`
}

type ChartYamlStruct

type ChartYamlStruct struct {
	Name        string `yaml:"name"`
	Version     string `yaml:"version"`
	Description string `yaml:"description"`
}

type DefaultChart

type DefaultChart string

type IsReady

type IsReady struct {
	Flag    bool   `json:"flag"`
	Message string `json:"message"`
}

type PipelineConfigRequest

type PipelineConfigRequest struct {
	Id                   int             `json:"id"  validate:"number"`
	AppId                int             `json:"appId,omitempty"  validate:"number,required"`
	EnvConfigOverrideId  int             `json:"envConfigOverrideId,omitempty"`
	PipelineConfigValues json.RawMessage `json:"pipelineConfigValues,omitempty" validate:"required"` //json format user value
	PipelineId           int             `json:"PipelineId,omitempty"`
	Latest               bool            `json:"latest"`
	Previous             bool            `json:"previous"`
	EnvId                int             `json:"envId,omitempty"`
	ManualReviewed       bool            `json:"manualReviewed" validate:"required"`
	UserId               int32           `json:"-"`
}

type PipelineConfigRequestResponse

type PipelineConfigRequestResponse struct {
	LatestPipelineConfigRequest   PipelineConfigRequest `json:"latestPipelineConfigRequest"`
	PreviousPipelineConfigRequest PipelineConfigRequest `json:"previousPipelineConfigRequest"`
}

type ReservedChartList added in v0.6.23

type ReservedChartList struct {
	LocationPrefix string
	Name           string
}

type TemplateRequest

type TemplateRequest struct {
	Id                      int                         `json:"id"  validate:"number"`
	AppId                   int                         `json:"appId,omitempty"  validate:"number,required"`
	RefChartTemplate        string                      `json:"refChartTemplate,omitempty"`
	RefChartTemplateVersion string                      `json:"refChartTemplateVersion,omitempty"`
	ChartRepositoryId       int                         `json:"chartRepositoryId,omitempty"`
	ValuesOverride          json.RawMessage             `json:"valuesOverride,omitempty" validate:"required"` //json format user value
	DefaultAppOverride      json.RawMessage             `json:"defaultAppOverride,omitempty"`                 //override values available
	ChartRefId              int                         `json:"chartRefId,omitempty"  validate:"number"`
	Latest                  bool                        `json:"latest"`
	IsAppMetricsEnabled     bool                        `json:"isAppMetricsEnabled"`
	Schema                  json.RawMessage             `json:"schema"`
	Readme                  string                      `json:"readme"`
	IsBasicViewLocked       bool                        `json:"isBasicViewLocked"`
	CurrentViewEditor       models.ChartsViewEditorType `json:"currentViewEditor"` //default "UNDEFINED" in db
	UserId                  int32                       `json:"-"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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