Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion env_gen.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions env_gen.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@
| DEVTRON_HELM_REPO_NAME | string |devtron | Is used to install modules (stack manager) | | false |
| DEVTRON_HELM_REPO_URL | string |https://helm.devtron.ai | Is used to install modules (stack manager) | | false |
| DEVTRON_INSTALLATION_TYPE | string | | Devtron Installation type(EA/Full) | | false |
| DEVTRON_INSTALLER_MODULES_PATH | string |installer.modules | Path to devtron installer modules, used to find the helm charts and values files | | false |
| DEVTRON_INSTALLER_RELEASE_PATH | string |installer.release | Path to devtron installer release, used to find the helm charts and values files | | false |
| DEVTRON_MODULES_IDENTIFIER_IN_HELM_VALUES | string |installer.modules | | | false |
| DEVTRON_OPERATOR_BASE_PATH | string | | Base path for devtron operator, used to find the helm charts and values files | | false |
| DEVTRON_SECRET_NAME | string |devtron-secret | | | false |
| DEVTRON_VERSION_IDENTIFIER_IN_HELM_VALUES | string |installer.release | devtron operator version identifier in helm values yaml | | false |
| DEX_CID | string |example-app | dex client id | | false |
Expand Down
8 changes: 7 additions & 1 deletion manifests/installation-script
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
LTAG="v1.6.0";
REPO_RAW_URL="https://raw.githubusercontent.com/devtron-labs/devtron/";

shebang = `#!/bin/bash
`;
sleep50 = shebang + `
sleep 50`;
ignore = shellScript sleep50;
ignore = shellScript sleep50;
ignore = shellScript sleep50;
log("executed devtron setup installation");
12 changes: 6 additions & 6 deletions pkg/module/ModuleService.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ func (impl ModuleServiceImpl) handleModuleNotFoundStatus(moduleName string) (bea

// if check non-cicd module status
if moduleName != bean.ModuleNameCiCd {
isEnabled := gjson.Get(releaseValues, moduleUtil.BuildModuleEnableKey(moduleName)).Bool()
isEnabled := gjson.Get(releaseValues, moduleUtil.BuildModuleEnableKey(impl.serverEnvConfig.DevtronOperatorBasePath, moduleName)).Bool()
if isEnabled {
status, err := impl.saveModuleAsInstalled(moduleName, moduleType, flagForEnablingState)
return status, moduleType, flagForActiveTool, err
}
} else if util2.IsBaseStack() {
// check if cicd is in installing state
// if devtron is installed with cicd module, then cicd module should be shown as installing
installerModulesIface := gjson.Get(releaseValues, bean.INSTALLER_MODULES_HELM_KEY).Value()
installerModulesIface := gjson.Get(releaseValues, impl.serverEnvConfig.DevtronInstallerModulesPath).Value()
if installerModulesIface != nil {
installerModulesIfaceKind := reflect.TypeOf(installerModulesIface).Kind()
if installerModulesIfaceKind == reflect.Slice {
Expand Down Expand Up @@ -410,20 +410,20 @@ func (impl ModuleServiceImpl) HandleModuleAction(userId int32, moduleName string
}

extraValues := make(map[string]interface{})
extraValues["installer.release"] = moduleActionRequest.Version
extraValues[bean.INSTALLER_MODULES_HELM_KEY] = []interface{}{moduleName}
extraValues[impl.serverEnvConfig.DevtronInstallerReleasePath] = moduleActionRequest.Version
extraValues[impl.serverEnvConfig.DevtronInstallerModulesPath] = []interface{}{moduleName}
alreadyInstalledModuleNames, err := impl.moduleRepository.GetInstalledModuleNames()
if err != nil {
impl.logger.Errorw("error in getting modules with installed status ", "err", err)
return nil, err
}
moduleEnableKeys := moduleUtil.BuildAllModuleEnableKeys(moduleName)
moduleEnableKeys := moduleUtil.BuildAllModuleEnableKeys(impl.serverEnvConfig.DevtronOperatorBasePath, moduleName)
for _, moduleEnableKey := range moduleEnableKeys {
extraValues[moduleEnableKey] = true
}
for _, alreadyInstalledModuleName := range alreadyInstalledModuleNames {
if alreadyInstalledModuleName != moduleName {
alreadyInstalledModuleEnableKeys := moduleUtil.BuildAllModuleEnableKeys(alreadyInstalledModuleName)
alreadyInstalledModuleEnableKeys := moduleUtil.BuildAllModuleEnableKeys(impl.serverEnvConfig.DevtronOperatorBasePath, alreadyInstalledModuleName)
for _, alreadyInstalledModuleEnableKey := range alreadyInstalledModuleEnableKeys {
extraValues[alreadyInstalledModuleEnableKey] = true
}
Expand Down
1 change: 0 additions & 1 deletion pkg/module/bean/bean.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ type ModuleStatus = string
type ModuleName = string

const BlobStorage = "blob-storage"
const INSTALLER_MODULES_HELM_KEY = "installer.modules"
const (
CLAIR_V4 = "V4"
CLAIR_V2 = "V2"
Expand Down
11 changes: 7 additions & 4 deletions pkg/module/util/ModuleUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ import (
"strings"
)

func BuildAllModuleEnableKeys(moduleName string) []string {
func BuildAllModuleEnableKeys(basePath string, moduleName string) []string {
var keys []string
keys = append(keys, BuildModuleEnableKey(moduleName))
keys = append(keys, BuildModuleEnableKey(basePath, moduleName))
if strings.Contains(moduleName, ".") {
parent := strings.Split(moduleName, ".")[0]
keys = append(keys, BuildModuleEnableKey(parent))
keys = append(keys, BuildModuleEnableKey(basePath, parent))
}
return keys
}

func BuildModuleEnableKey(moduleName string) string {
func BuildModuleEnableKey(basePath string, moduleName string) string {
if len(basePath) > 0 {
return fmt.Sprintf("%s.%s.%s", basePath, moduleName, "enabled")
}
return fmt.Sprintf("%s.%s", moduleName, "enabled")
}
4 changes: 2 additions & 2 deletions pkg/server/ServerService.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ func (impl ServerServiceImpl) HandleServerAction(userId int32, serverActionReque
}

extraValues := make(map[string]interface{})
extraValues["installer.release"] = serverActionRequest.Version
extraValues[impl.serverEnvConfig.DevtronInstallerReleasePath] = serverActionRequest.Version
alreadyInstalledModuleNames, err := impl.moduleRepository.GetInstalledModuleNames()
if err != nil {
impl.logger.Errorw("error in getting modules with installed status ", "err", err)
return nil, err
}
for _, alreadyInstalledModuleName := range alreadyInstalledModuleNames {
alreadyInstalledModuleEnableKeys := moduleUtil.BuildAllModuleEnableKeys(alreadyInstalledModuleName)
alreadyInstalledModuleEnableKeys := moduleUtil.BuildAllModuleEnableKeys(impl.serverEnvConfig.DevtronOperatorBasePath, alreadyInstalledModuleName)
for _, alreadyInstalledModuleEnableKey := range alreadyInstalledModuleEnableKeys {
extraValues[alreadyInstalledModuleEnableKey] = true
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/server/config/ServerEnvConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type ServerEnvConfig struct {
ModuleMetaDataApiUrl string `env:"MODULE_METADATA_API_URL" envDefault:"https://api.devtron.ai/module?name=%s" description:"Modules list and meta info will be fetched from this server, that is central api server of devtron."`
ParallelismLimitForTagProcessing int `env:"PARALLELISM_LIMIT_FOR_TAG_PROCESSING" description:"App manual sync job parallel tag processing count."`
AppSyncJobShutDownWaitDuration int `env:"APP_SYNC_SHUTDOWN_WAIT_DURATION" envDefault:"120"`
DevtronOperatorBasePath string `env:"DEVTRON_OPERATOR_BASE_PATH" envDefault:"" description:"Base path for devtron operator, used to find the helm charts and values files"`
DevtronInstallerModulesPath string `env:"DEVTRON_INSTALLER_MODULES_PATH" envDefault:"installer.modules" description:"Path to devtron installer modules, used to find the helm charts and values files"`
DevtronInstallerReleasePath string `env:"DEVTRON_INSTALLER_RELEASE_PATH" envDefault:"installer.release" description:"Path to devtron installer release, used to find the helm charts and values files"`
ErrorEncounteredOnGettingDevtronHelmRelease error
}

Expand Down
4 changes: 2 additions & 2 deletions wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading