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

feat: support dynamic ConfigMap name and Secret name #286

Merged
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
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