Skip to content

Commit 20e44d1

Browse files
committed
prom client in chart-sync
1 parent 12905d4 commit 20e44d1

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

pkg/chartRepo/ManualAppSyncYaml.go

+22-10
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,32 @@ import (
2323
)
2424

2525
type AppSyncConfig struct {
26-
DbConfig sql.Config
27-
DockerImage string
28-
AppSyncJobResourcesObj string
29-
ChartProviderConfig *ChartProviderConfig
30-
AppSyncServiceAccount string
26+
DbConfig sql.Config
27+
DockerImage string
28+
AppSyncJobResourcesObj string
29+
ChartProviderConfig *ChartProviderConfig
30+
AppSyncServiceAccount string
3131
ParallelismLimitForTagProcessing int
32+
AppSyncJobShutDownInterval int
3233
}
3334

3435
type ChartProviderConfig struct {
3536
ChartProviderId string
3637
IsOCIRegistry bool
3738
}
3839

40+
const AppSyncJobShutDownInterval = 60
41+
3942
func manualAppSyncJobByteArr(dockerImage string, appSyncJobResourcesObj string, appSyncServiceAccount string, chartProviderConfig *ChartProviderConfig, ParallelismLimitForTagProcessing int) []byte {
4043
cfg, _ := sql.GetConfig()
4144
configValues := AppSyncConfig{
42-
DbConfig: sql.Config{Addr: cfg.Addr, Database: cfg.Database, User: cfg.User, Password: cfg.Password},
43-
DockerImage: dockerImage,
44-
AppSyncJobResourcesObj: appSyncJobResourcesObj,
45-
ChartProviderConfig: chartProviderConfig,
46-
AppSyncServiceAccount: appSyncServiceAccount,
45+
DbConfig: sql.Config{Addr: cfg.Addr, Database: cfg.Database, User: cfg.User, Password: cfg.Password},
46+
DockerImage: dockerImage,
47+
AppSyncJobResourcesObj: appSyncJobResourcesObj,
48+
ChartProviderConfig: chartProviderConfig,
49+
AppSyncServiceAccount: appSyncServiceAccount,
4750
ParallelismLimitForTagProcessing: ParallelismLimitForTagProcessing,
51+
AppSyncJobShutDownInterval: AppSyncJobShutDownInterval,
4852
}
4953
temp := template.New("manualAppSyncJobByteArr")
5054
temp, _ = temp.Parse(`{"apiVersion": "batch/v1",
@@ -71,6 +75,10 @@ func manualAppSyncJobByteArr(dockerImage string, appSyncJobResourcesObj string,
7175
{
7276
"name": "chart-sync",
7377
"image": "{{.DockerImage}}",
78+
"ports":
79+
- "containerPort": 8080
80+
"name": "metrics"
81+
"protocol": "TCP"
7482
{{if .AppSyncJobResourcesObj}}
7583
"resources": {{.AppSyncJobResourcesObj}},
7684
{{end}}
@@ -102,6 +110,10 @@ func manualAppSyncJobByteArr(dockerImage string, appSyncJobResourcesObj string,
102110
{
103111
"name": "PARALLELISM_LIMIT_FOR_TAG_PROCESSING",
104112
"value": "{{.ParallelismLimitForTagProcessing}}"
113+
},
114+
{
115+
"name": "APP_SYNC_SHUTDOWN_INTERVAL",
116+
"value": "{{.AppSyncJobShutDownInterval}}"
105117
}
106118
]
107119
}

0 commit comments

Comments
 (0)