feat: expose notifications controller processors count via cmd params (#26798)

Signed-off-by: Kirill Bilchenko <kirillbilchenko@users.noreply.github.com>
This commit is contained in:
Kirill Bilchenko 2026-03-12 00:49:31 +01:00 committed by GitHub
parent f8c0d7efcf
commit 3cb4955d44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 100 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package commands
import (
"context"
"fmt"
"math"
"net/http"
"os"
"os/signal"
@ -162,7 +163,7 @@ func NewCommand() *cobra.Command {
},
}
clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().IntVar(&processorsCount, "processors-count", 1, "Processors count.")
command.Flags().IntVar(&processorsCount, "processors-count", env.ParseNumFromEnv("ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT", 1, 1, math.MaxInt32), "Processors count.")
command.Flags().StringVar(&appLabelSelector, "app-label-selector", "", "App label selector.")
command.Flags().StringVar(&logLevel, "loglevel", env.StringFromEnv("ARGOCD_NOTIFICATIONS_CONTROLLER_LOGLEVEL", "info"), "Set the logging level. One of: debug|info|warn|error")
command.Flags().StringVar(&logFormat, "logformat", env.StringFromEnv("ARGOCD_NOTIFICATIONS_CONTROLLER_LOGFORMAT", "json"), "Set the logging format. One of: json|text")

View file

@ -0,0 +1,28 @@
package commands
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNewCommandProcessorsCountDefault(t *testing.T) {
t.Setenv("ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT", "4")
cmd := NewCommand()
processorsCount, err := cmd.Flags().GetInt("processors-count")
require.NoError(t, err)
assert.Equal(t, 4, processorsCount)
}
func TestNewCommandProcessorsCountInvalidEnvFallsBackToDefault(t *testing.T) {
t.Setenv("ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT", "0")
cmd := NewCommand()
processorsCount, err := cmd.Flags().GetInt("processors-count")
require.NoError(t, err)
assert.Equal(t, 1, processorsCount)
}

View file

@ -393,6 +393,8 @@ data:
notificationscontroller.log.level: "info"
# Set the logging format. One of: json|text (default "json")
notificationscontroller.log.format: "json"
# Number of notification processors (default 1)
notificationscontroller.processors.count: "1"
# Enable self-service notifications config. Used in conjunction with apps-in-any-namespace. (default "false")
notificationscontroller.selfservice.enabled: "false"
# Disable TLS on connections to repo server

View file

@ -70,6 +70,19 @@ data:
notificationscontroller.selfservice.enabled: "true"
```
Other notifications controller startup settings can be managed the same way. For notifications-heavy
installations, `notificationscontroller.processors.count` configures the worker concurrency and maps
to the `--processors-count` startup flag. For example:
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cmd-params-cm
data:
notificationscontroller.processors.count: "4"
```
To use this feature, you can deploy configmap named `argocd-notifications-cm` and possibly a secret `argocd-notifications-secret` in the namespace where the Argo CD application lives.
When it is configured this way the controller will send notifications using both the controller level configuration (the configmap located in the same namespaces as the controller) as well as

View file

@ -48,6 +48,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef:
@ -96,4 +102,4 @@ spec:
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
kubernetes.io/os: linux

View file

@ -33129,6 +33129,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef:

View file

@ -32959,6 +32959,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef:

View file

@ -2376,6 +2376,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef:

View file

@ -2206,6 +2206,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef:

View file

@ -32147,6 +32147,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef:

View file

@ -31975,6 +31975,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef:

View file

@ -1394,6 +1394,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef:

View file

@ -1222,6 +1222,12 @@ spec:
key: notificationscontroller.log.level
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_NOTIFICATION_CONTROLLER_PROCESSORS_COUNT
valueFrom:
configMapKeyRef:
key: notificationscontroller.processors.count
name: argocd-cmd-params-cm
optional: true
- name: ARGOCD_LOG_FORMAT_TIMESTAMP
valueFrom:
configMapKeyRef: