Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit ed0ce0c

Browse files
feat: support dynamic ConfigMap name and Secret name (#286)
Signed-off-by: Ryota Sakamoto <[email protected]>
1 parent 077889a commit ed0ce0c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmd/controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ func newControllerCommand() *cobra.Command {
3636
logFormat string
3737
metricsPort int
3838
argocdRepoServer string
39+
configMapName string
40+
secretName string
3941
)
4042
var command = cobra.Command{
4143
Use: "controller",
@@ -82,6 +84,9 @@ func newControllerCommand() *cobra.Command {
8284
}
8385
defer argocdService.Close()
8486

87+
k8s.ConfigMapName = configMapName
88+
k8s.SecretName = secretName
89+
8590
registry := notificationscontroller.NewMetricsRegistry("argocd")
8691
http.Handle("/metrics", promhttp.HandlerFor(prometheus.Gatherers{registry, prometheus.DefaultGatherer}, promhttp.HandlerOpts{}))
8792

@@ -110,5 +115,7 @@ func newControllerCommand() *cobra.Command {
110115
command.Flags().StringVar(&logFormat, "logformat", "text", "Set the logging format. One of: text|json")
111116
command.Flags().IntVar(&metricsPort, "metrics-port", defaultMetricsPort, "Metrics port")
112117
command.Flags().StringVar(&argocdRepoServer, "argocd-repo-server", "argocd-repo-server:8081", "Argo CD repo server address")
118+
command.Flags().StringVar(&configMapName, "config-map-name", "argocd-notifications-cm", "Set notifications ConfigMap name")
119+
command.Flags().StringVar(&secretName, "secret-name", "argocd-notifications-secret", "Set notifications Secret name")
113120
return &command
114121
}

shared/k8s/informers.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import (
1010
"k8s.io/client-go/tools/cache"
1111
)
1212

13-
const (
13+
var (
1414
ConfigMapName = "argocd-notifications-cm"
1515
SecretName = "argocd-notifications-secret"
16+
)
1617

18+
const (
1719
settingsResyncDuration = 3 * time.Minute
1820
)
1921

0 commit comments

Comments
 (0)