Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
feat: support dynamic ConfigMap name and Secret name (#286)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryota Sakamoto <sakamo.ryota+github@gmail.com>
  • Loading branch information
ryota-sakamoto authored May 19, 2021
1 parent 077889a commit ed0ce0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cmd/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func newControllerCommand() *cobra.Command {
logFormat string
metricsPort int
argocdRepoServer string
configMapName string
secretName string
)
var command = cobra.Command{
Use: "controller",
Expand Down Expand Up @@ -82,6 +84,9 @@ func newControllerCommand() *cobra.Command {
}
defer argocdService.Close()

k8s.ConfigMapName = configMapName
k8s.SecretName = secretName

registry := notificationscontroller.NewMetricsRegistry("argocd")
http.Handle("/metrics", promhttp.HandlerFor(prometheus.Gatherers{registry, prometheus.DefaultGatherer}, promhttp.HandlerOpts{}))

Expand Down Expand Up @@ -110,5 +115,7 @@ func newControllerCommand() *cobra.Command {
command.Flags().StringVar(&logFormat, "logformat", "text", "Set the logging format. One of: text|json")
command.Flags().IntVar(&metricsPort, "metrics-port", defaultMetricsPort, "Metrics port")
command.Flags().StringVar(&argocdRepoServer, "argocd-repo-server", "argocd-repo-server:8081", "Argo CD repo server address")
command.Flags().StringVar(&configMapName, "config-map-name", "argocd-notifications-cm", "Set notifications ConfigMap name")
command.Flags().StringVar(&secretName, "secret-name", "argocd-notifications-secret", "Set notifications Secret name")
return &command
}
4 changes: 3 additions & 1 deletion shared/k8s/informers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import (
"k8s.io/client-go/tools/cache"
)

const (
var (
ConfigMapName = "argocd-notifications-cm"
SecretName = "argocd-notifications-secret"
)

const (
settingsResyncDuration = 3 * time.Minute
)

Expand Down

0 comments on commit ed0ce0c

Please sign in to comment.