variables

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResolvedCMCSList added in v0.6.26

func GetResolvedCMCSList(resolvedCS string, resolvedCM string) (map[string]*serviceBean.ConfigData, map[string]*serviceBean.ConfigData, error)

Types

type ScopedVariableCMCSManager added in v0.6.26

type ScopedVariableCMCSManager interface {
	ScopedVariableManager
	GetResolvedCMCSHistoryDtos(ctx context.Context, configType repository.ConfigType, configList serviceBean.ConfigList, history *repository.ConfigmapAndSecretHistory, secretList serviceBean.SecretList) (map[string]serviceBean.ConfigData, map[string]map[string]string, error)
	ResolveCMCSHistoryDto(ctx context.Context, configType repository.ConfigType, configList serviceBean.ConfigList, history *repository.ConfigmapAndSecretHistory, componentName string, secretList serviceBean.SecretList) (map[string]string, string, error)

	CreateVariableMappingsForCMApp(model *chartConfig.ConfigMapAppModel) error
	CreateVariableMappingsForCMEnv(model *chartConfig.ConfigMapEnvModel) error
	CreateVariableMappingsForSecretApp(model *chartConfig.ConfigMapAppModel) error
	CreateVariableMappingsForSecretEnv(model *chartConfig.ConfigMapEnvModel) error

	ResolveCMCSTrigger(cType bean.DeploymentConfigurationType, scope resourceQualifiers.Scope, configMapAppId int, configMapEnvId int, configMapByte []byte, secretDataByte []byte, configMapHistoryId int, secretHistoryId int) (string, string, map[string]string, map[string]string, error)
	ResolveCMCS(ctx context.Context,
		scope resourceQualifiers.Scope, configAppLevelId int,
		configEnvLevelId int,
		mergedConfigMap map[string]*serviceBean.ConfigData,
		mergedSecret map[string]*serviceBean.ConfigData) (map[string]*serviceBean.ConfigData, map[string]*serviceBean.ConfigData, map[string]map[string]string, map[string]map[string]string, error)

	ResolveForPrePostStageTrigger(scope resourceQualifiers.Scope, configResponse bean.ConfigMapJson, secretResponse bean.ConfigSecretJson, cmAppId int, cmEnvId int) (*bean.ConfigMapJson, *bean.ConfigSecretJson, error)
}

type ScopedVariableCMCSManagerImpl added in v0.6.26

type ScopedVariableCMCSManagerImpl struct {
	ScopedVariableManagerImpl
}

func NewScopedVariableCMCSManagerImpl added in v0.6.26

func NewScopedVariableCMCSManagerImpl(logger *zap.SugaredLogger,
	scopedVariableService ScopedVariableService,
	variableEntityMappingService VariableEntityMappingService,
	variableSnapshotHistoryService VariableSnapshotHistoryService,
	variableTemplateParser parsers.VariableTemplateParser,
) (*ScopedVariableCMCSManagerImpl, error)

func (*ScopedVariableCMCSManagerImpl) CreateVariableMappingsForCMApp added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) CreateVariableMappingsForCMApp(model *chartConfig.ConfigMapAppModel) error

func (*ScopedVariableCMCSManagerImpl) CreateVariableMappingsForCMEnv added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) CreateVariableMappingsForCMEnv(model *chartConfig.ConfigMapEnvModel) error

func (*ScopedVariableCMCSManagerImpl) CreateVariableMappingsForSecretApp added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) CreateVariableMappingsForSecretApp(model *chartConfig.ConfigMapAppModel) error

func (*ScopedVariableCMCSManagerImpl) CreateVariableMappingsForSecretEnv added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) CreateVariableMappingsForSecretEnv(model *chartConfig.ConfigMapEnvModel) error

func (*ScopedVariableCMCSManagerImpl) GetResolvedCMCSHistoryDtos added in v0.6.26

func (*ScopedVariableCMCSManagerImpl) ResolveCMCS added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) ResolveCMCS(ctx context.Context,
	scope resourceQualifiers.Scope, configAppLevelId int,
	configEnvLevelId int,
	mergedConfigMap map[string]*serviceBean.ConfigData,
	mergedSecret map[string]*serviceBean.ConfigData) (map[string]*serviceBean.ConfigData, map[string]*serviceBean.ConfigData, map[string]map[string]string, map[string]map[string]string, error)

func (*ScopedVariableCMCSManagerImpl) ResolveCMCSHistoryDto added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) ResolveCMCSHistoryDto(ctx context.Context, configType repository.ConfigType, configList serviceBean.ConfigList, history *repository.ConfigmapAndSecretHistory, componentName string, secretList serviceBean.SecretList) (map[string]string, string, error)

func (*ScopedVariableCMCSManagerImpl) ResolveCMCSTrigger added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) ResolveCMCSTrigger(cType bean.DeploymentConfigurationType, scope resourceQualifiers.Scope, configMapAppId int, configMapEnvId int, configMapByte []byte, secretDataByte []byte, configMapHistoryId int, secretHistoryId int) (string, string, map[string]string, map[string]string, error)

func (*ScopedVariableCMCSManagerImpl) ResolveCMHistoryDto added in v0.6.26

func (*ScopedVariableCMCSManagerImpl) ResolveForPrePostStageTrigger added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) ResolveForPrePostStageTrigger(scope resourceQualifiers.Scope, configResponse bean.ConfigMapJson, secretResponse bean.ConfigSecretJson, cmAppId int, cmEnvId int) (*bean.ConfigMapJson, *bean.ConfigSecretJson, error)

func (*ScopedVariableCMCSManagerImpl) ResolveSecretHistoryDto added in v0.6.26

func (*ScopedVariableCMCSManagerImpl) ResolvedVariableForLastSaved added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) ResolvedVariableForLastSaved(scope resourceQualifiers.Scope, configMapAppId int, configMapEnvId int, configMapByte []byte, secretDataByte []byte, unmaskSensitive bool) (string, string, map[string]string, map[string]string, error)

func (*ScopedVariableCMCSManagerImpl) ResolvedVariableForSpecificType added in v0.6.26

func (impl *ScopedVariableCMCSManagerImpl) ResolvedVariableForSpecificType(configMapHistoryId int, secretHistoryId int, configMapByte []byte, secretDataByte []byte) (string, string, map[string]string, map[string]string, error)

type ScopedVariableManager added in v0.6.26

type ScopedVariableManager interface {

	// pass throughs
	GetScopedVariables(scope resourceQualifiers.Scope, varNames []string, unmaskSensitiveData bool) (scopedVariableDataObj []*models.ScopedVariableData, err error)
	GetEntityToVariableMapping(entity []repository.Entity) (map[repository.Entity][]string, error)
	SaveVariableHistoriesForTrigger(variableHistories []*repository.VariableSnapshotHistoryBean, userId int32) error
	RemoveMappedVariables(entityId int, entityType repository.EntityType, userId int32, tx *pg.Tx) error
	ParseTemplateWithScopedVariables(request parsers.VariableParserRequest) (string, error)

	// variable mapping
	ExtractAndMapVariables(template string, entityId int, entityType repository.EntityType, userId int32, tx *pg.Tx) error

	// template resolvers
	ExtractVariablesAndResolveTemplate(scope resourceQualifiers.Scope, template string, templateType parsers.VariableTemplateType, unmaskSensitiveData bool, maskUnknownVariable bool) (string, map[string]string, error)
	GetMappedVariablesAndResolveTemplate(template string, scope resourceQualifiers.Scope, entity repository.Entity, unmaskSensitiveData bool) (string, map[string]string, error)
	GetMappedVariablesAndResolveTemplateBatch(template string, scope resourceQualifiers.Scope, entities []repository.Entity) (string, map[string]string, error)
	GetVariableSnapshotAndResolveTemplate(template string, templateType parsers.VariableTemplateType, reference repository.HistoryReference, isSuperAdmin bool, ignoreUnknown bool) (map[string]string, string, error)
}

type ScopedVariableManagerImpl added in v0.6.26

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

func NewScopedVariableManagerImpl added in v0.6.26

func NewScopedVariableManagerImpl(logger *zap.SugaredLogger,
	scopedVariableService ScopedVariableService,
	variableEntityMappingService VariableEntityMappingService,
	variableSnapshotHistoryService VariableSnapshotHistoryService,
	variableTemplateParser parsers.VariableTemplateParser,
) (*ScopedVariableManagerImpl, error)

func (ScopedVariableManagerImpl) ExtractAndMapVariables added in v0.6.26

func (impl ScopedVariableManagerImpl) ExtractAndMapVariables(template string, entityId int, entityType repository.EntityType, userId int32, tx *pg.Tx) error

func (ScopedVariableManagerImpl) ExtractVariablesAndResolveTemplate added in v0.6.26

func (impl ScopedVariableManagerImpl) ExtractVariablesAndResolveTemplate(scope resourceQualifiers.Scope, template string, templateType parsers.VariableTemplateType, isSuperAdmin bool, maskUnknownVariable bool) (string, map[string]string, error)

func (ScopedVariableManagerImpl) GetEntityToVariableMapping added in v0.6.26

func (impl ScopedVariableManagerImpl) GetEntityToVariableMapping(entity []repository.Entity) (map[repository.Entity][]string, error)

func (ScopedVariableManagerImpl) GetMappedVariablesAndResolveTemplate added in v0.6.26

func (impl ScopedVariableManagerImpl) GetMappedVariablesAndResolveTemplate(template string, scope resourceQualifiers.Scope, entity repository.Entity, isSuperAdmin bool) (string, map[string]string, error)

func (ScopedVariableManagerImpl) GetMappedVariablesAndResolveTemplateBatch added in v0.6.26

func (impl ScopedVariableManagerImpl) GetMappedVariablesAndResolveTemplateBatch(template string, scope resourceQualifiers.Scope, entities []repository.Entity) (string, map[string]string, error)

func (ScopedVariableManagerImpl) GetScopedVariables added in v0.6.26

func (impl ScopedVariableManagerImpl) GetScopedVariables(scope resourceQualifiers.Scope, varNames []string, unmaskSensitiveData bool) (scopedVariableDataObj []*models.ScopedVariableData, err error)

func (ScopedVariableManagerImpl) GetVariableSnapshotAndResolveTemplate added in v0.6.26

func (impl ScopedVariableManagerImpl) GetVariableSnapshotAndResolveTemplate(template string, templateType parsers.VariableTemplateType, reference repository.HistoryReference, isSuperAdmin bool, ignoreUnknown bool) (map[string]string, string, error)

func (ScopedVariableManagerImpl) ParseTemplateWithScopedVariables added in v0.6.26

func (impl ScopedVariableManagerImpl) ParseTemplateWithScopedVariables(request parsers.VariableParserRequest) (string, error)

func (ScopedVariableManagerImpl) RemoveMappedVariables added in v0.6.26

func (impl ScopedVariableManagerImpl) RemoveMappedVariables(entityId int, entityType repository.EntityType, userId int32, tx *pg.Tx) error

func (ScopedVariableManagerImpl) SaveVariableHistoriesForTrigger added in v0.6.26

func (impl ScopedVariableManagerImpl) SaveVariableHistoriesForTrigger(variableHistories []*repository.VariableSnapshotHistoryBean, userId int32) error

type ScopedVariableService

type ScopedVariableService interface {
	CreateVariables(payload models.Payload) error
	GetScopedVariables(scope resourceQualifiers.Scope, varNames []string, unmaskSensitiveData bool) (scopedVariableDataObj []*models.ScopedVariableData, err error)
	GetJsonForVariables() (*models.Payload, error)
	CheckForSensitiveVariables(variableNames []string) (map[string]bool, error)
	GetFormattedVariableForName(name string) string
	GetMatchedScopedVariables(varScope []*resourceQualifiers.QualifierMapping) map[int][]*resourceQualifiers.QualifierMapping
	GetScopeWithPriority(variableIdToVariableScopes map[int][]*resourceQualifiers.QualifierMapping) map[int]int
}

type ScopedVariableServiceImpl

type ScopedVariableServiceImpl struct {
	VariableNameConfig *VariableConfig
	VariableCache      *cache.VariableCacheObj
	// contains filtered or unexported fields
}

func NewScopedVariableServiceImpl

func NewScopedVariableServiceImpl(logger *zap.SugaredLogger, scopedVariableRepository repository2.ScopedVariableRepository, appRepository app.AppRepository, environmentRepository repository3.EnvironmentRepository, devtronResourceSearchableKeyService read.DevtronResourceSearchableKeyService, clusterRepository repository.ClusterRepository,
	qualifierMappingService resourceQualifiers.QualifierMappingService) (*ScopedVariableServiceImpl, error)

func (*ScopedVariableServiceImpl) CheckForSensitiveVariables added in v0.6.25

func (impl *ScopedVariableServiceImpl) CheckForSensitiveVariables(variableNames []string) (map[string]bool, error)

func (*ScopedVariableServiceImpl) CreateVariables

func (impl *ScopedVariableServiceImpl) CreateVariables(payload models.Payload) error

func (*ScopedVariableServiceImpl) GetFormattedVariableForName added in v0.6.25

func (impl *ScopedVariableServiceImpl) GetFormattedVariableForName(name string) string

func (*ScopedVariableServiceImpl) GetJsonForVariables

func (impl *ScopedVariableServiceImpl) GetJsonForVariables() (*models.Payload, error)

func (*ScopedVariableServiceImpl) GetMatchedScopedVariables added in v0.7.1

func (impl *ScopedVariableServiceImpl) GetMatchedScopedVariables(varScope []*resourceQualifiers.QualifierMapping) map[int][]*resourceQualifiers.QualifierMapping

func (*ScopedVariableServiceImpl) GetScopeWithPriority added in v0.7.1

func (impl *ScopedVariableServiceImpl) GetScopeWithPriority(variableIdToVariableScopes map[int][]*resourceQualifiers.QualifierMapping) map[int]int

func (*ScopedVariableServiceImpl) GetScopedVariables

func (impl *ScopedVariableServiceImpl) GetScopedVariables(scope resourceQualifiers.Scope, varNames []string, unmaskSensitiveData bool) (scopedVariableDataObj []*models.ScopedVariableData, err error)

func (*ScopedVariableServiceImpl) SetVariableCache

func (impl *ScopedVariableServiceImpl) SetVariableCache(cache *cache.VariableCacheObj)

type VariableConfig

type VariableConfig struct {
	VariableNameRegex    string `env:"SCOPED_VARIABLE_NAME_REGEX" envDefault:"^[a-zA-Z][a-zA-Z0-9_-]{0,62}[a-zA-Z0-9]$"`
	VariableCacheEnabled bool   `env:"VARIABLE_CACHE_ENABLED" envDefault:"true"`
	SystemVariablePrefix string `env:"SYSTEM_VAR_PREFIX" envDefault:"DEVTRON_"`
	ScopedVariableFormat string `env:"SCOPED_VARIABLE_FORMAT" envDefault:"@{{%s}}"`
}

func GetVariableNameConfig

func GetVariableNameConfig() (*VariableConfig, error)

type VariableEntityMappingService

type VariableEntityMappingService interface {
	UpdateVariablesForEntity(variableNames []string, entity repository.Entity, userId int32, tx *pg.Tx) error
	GetAllMappingsForEntities(entities []repository.Entity) (map[repository.Entity][]string, error)
	DeleteMappingsForEntities(entities []repository.Entity, userId int32, tx *pg.Tx) error
}

type VariableEntityMappingServiceImpl

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

func NewVariableEntityMappingServiceImpl

func NewVariableEntityMappingServiceImpl(variableEntityMappingRepository repository.VariableEntityMappingRepository, logger *zap.SugaredLogger) *VariableEntityMappingServiceImpl

func (VariableEntityMappingServiceImpl) DeleteMappingsForEntities

func (impl VariableEntityMappingServiceImpl) DeleteMappingsForEntities(entities []repository.Entity, userId int32, tx *pg.Tx) error

func (VariableEntityMappingServiceImpl) GetAllMappingsForEntities

func (impl VariableEntityMappingServiceImpl) GetAllMappingsForEntities(entities []repository.Entity) (map[repository.Entity][]string, error)

func (VariableEntityMappingServiceImpl) UpdateVariablesForEntity

func (impl VariableEntityMappingServiceImpl) UpdateVariablesForEntity(variableNames []string, entity repository.Entity, userId int32, passedTx *pg.Tx) error

type VariableSnapshotHistoryService

type VariableSnapshotHistoryService interface {
	SaveVariableHistoriesForTrigger(variableHistories []*repository2.VariableSnapshotHistoryBean, userId int32) error
	GetVariableHistoryForReferences(references []repository2.HistoryReference) (map[repository2.HistoryReference]*repository2.VariableSnapshotHistoryBean, error)
}

type VariableSnapshotHistoryServiceImpl

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

func (VariableSnapshotHistoryServiceImpl) GetVariableHistoryForReferences

func (VariableSnapshotHistoryServiceImpl) SaveVariableHistoriesForTrigger

func (impl VariableSnapshotHistoryServiceImpl) SaveVariableHistoriesForTrigger(variableHistories []*repository2.VariableSnapshotHistoryBean, userId int32) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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