Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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.

1 change: 1 addition & 0 deletions env_gen.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
| APP_SYNC_IMAGE | string |quay.io/devtron/chart-sync:1227622d-132-3775 | | | false |
| APP_SYNC_JOB_RESOURCES_OBJ | string | | | | false |
| APP_SYNC_SERVICE_ACCOUNT | string |chart-sync | | | false |
| APP_SYNC_SHUTDOWN_WAIT_DURATION | int |120 | | | false |
| ARGO_AUTO_SYNC_ENABLED | bool |true | | | false |
| ARGO_GIT_COMMIT_RETRY_COUNT_ON_CONFLICT | int |3 | | | false |
| ARGO_GIT_COMMIT_RETRY_DELAY_ON_CONFLICT | int |1 | | | false |
Expand Down
2 changes: 1 addition & 1 deletion pkg/chartRepo/ChartRepositoryService.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func (impl *ChartRepositoryServiceImpl) TriggerChartSyncManual(chartProviderConf

defaultClusterConfig := defaultClusterBean.GetClusterConfig()

manualAppSyncJobByteArr := manualAppSyncJobByteArr(impl.serverEnvConfig.AppSyncImage, impl.serverEnvConfig.AppSyncJobResourcesObj, impl.serverEnvConfig.AppSyncServiceAccount, chartProviderConfig, impl.serverEnvConfig.ParallelismLimitForTagProcessing)
manualAppSyncJobByteArr := manualAppSyncJobByteArr(impl.serverEnvConfig.AppSyncImage, impl.serverEnvConfig.AppSyncJobResourcesObj, impl.serverEnvConfig.AppSyncServiceAccount, chartProviderConfig, impl.serverEnvConfig.ParallelismLimitForTagProcessing, impl.serverEnvConfig.AppSyncJobShutDownWaitDuration)
err = impl.K8sUtil.DeleteAndCreateJob(manualAppSyncJobByteArr, impl.aCDAuthConfig.ACDConfigMapNamespace, defaultClusterConfig)
if err != nil {
impl.logger.Errorw("DeleteAndCreateJob err, TriggerChartSyncManual", "err", err)
Expand Down
35 changes: 24 additions & 11 deletions pkg/chartRepo/ManualAppSyncYaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,30 @@ import (
)

type AppSyncConfig struct {
DbConfig sql.Config
DockerImage string
AppSyncJobResourcesObj string
ChartProviderConfig *ChartProviderConfig
AppSyncServiceAccount string
DbConfig sql.Config
DockerImage string
AppSyncJobResourcesObj string
ChartProviderConfig *ChartProviderConfig
AppSyncServiceAccount string
ParallelismLimitForTagProcessing int
AppSyncJobShutDownWaitDuration int
}

type ChartProviderConfig struct {
ChartProviderId string
IsOCIRegistry bool
}

func manualAppSyncJobByteArr(dockerImage string, appSyncJobResourcesObj string, appSyncServiceAccount string, chartProviderConfig *ChartProviderConfig, ParallelismLimitForTagProcessing int) []byte {
func manualAppSyncJobByteArr(dockerImage string, appSyncJobResourcesObj string, appSyncServiceAccount string, chartProviderConfig *ChartProviderConfig, ParallelismLimitForTagProcessing, AppSyncJobShutDownWaitDuration int) []byte {
cfg, _ := sql.GetConfig()
configValues := AppSyncConfig{
DbConfig: sql.Config{Addr: cfg.Addr, Database: cfg.Database, User: cfg.User, Password: cfg.Password},
DockerImage: dockerImage,
AppSyncJobResourcesObj: appSyncJobResourcesObj,
ChartProviderConfig: chartProviderConfig,
AppSyncServiceAccount: appSyncServiceAccount,
DbConfig: sql.Config{Addr: cfg.Addr, Database: cfg.Database, User: cfg.User, Password: cfg.Password},
DockerImage: dockerImage,
AppSyncJobResourcesObj: appSyncJobResourcesObj,
ChartProviderConfig: chartProviderConfig,
AppSyncServiceAccount: appSyncServiceAccount,
ParallelismLimitForTagProcessing: ParallelismLimitForTagProcessing,
AppSyncJobShutDownWaitDuration: AppSyncJobShutDownWaitDuration,
}
temp := template.New("manualAppSyncJobByteArr")
temp, _ = temp.Parse(`{"apiVersion": "batch/v1",
Expand All @@ -71,6 +73,13 @@ func manualAppSyncJobByteArr(dockerImage string, appSyncJobResourcesObj string,
{
"name": "chart-sync",
"image": "{{.DockerImage}}",
"ports": [
{
"containerPort": 8080,
"name": "metrics",
"protocol": "TCP"
}
],
{{if .AppSyncJobResourcesObj}}
"resources": {{.AppSyncJobResourcesObj}},
{{end}}
Expand Down Expand Up @@ -102,6 +111,10 @@ func manualAppSyncJobByteArr(dockerImage string, appSyncJobResourcesObj string,
{
"name": "PARALLELISM_LIMIT_FOR_TAG_PROCESSING",
"value": "{{.ParallelismLimitForTagProcessing}}"
},
{
"name": "APP_SYNC_SHUTDOWN_WAIT_DURATION",
"value": "{{.AppSyncJobShutDownWaitDuration}}"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions pkg/server/config/ServerEnvConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type ServerEnvConfig struct {
AppSyncJobResourcesObj string `env:"APP_SYNC_JOB_RESOURCES_OBJ"`
ModuleMetaDataApiUrl string `env:"MODULE_METADATA_API_URL" envDefault:"https://api.devtron.ai/module?name=%s"`
ParallelismLimitForTagProcessing int `env:"PARALLELISM_LIMIT_FOR_TAG_PROCESSING"`
AppSyncJobShutDownWaitDuration int `env:"APP_SYNC_SHUTDOWN_WAIT_DURATION" envDefault:"120"`
ErrorEncounteredOnGettingDevtronHelmRelease error
}

Expand Down
2 changes: 1 addition & 1 deletion wire_gen.go

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

Loading