Skip to content

Commit

Permalink
fix: argocd notification controller app cluster permission issue (arg…
Browse files Browse the repository at this point in the history
…oproj#16057)

* if applicationNamespaces is not provided as input parameter, then use namespaced appClient

Signed-off-by: May Zhang <[email protected]>

* fix go lint error

Signed-off-by: May Zhang <[email protected]>

---------

Signed-off-by: May Zhang <[email protected]>
  • Loading branch information
mayzhang2000 committed Oct 30, 2023
1 parent 394211c commit 6b5bade
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions notification_controller/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ func NewController(
secretName string,
configMapName string,
) *notificationController {
appClient := client.Resource(applications)
var appClient dynamic.ResourceInterface
namespaceableAppClient := client.Resource(applications)
appClient = namespaceableAppClient
if len(applicationNamespaces) == 0 {
appClient = namespaceableAppClient.Namespace(namespace)
}

appInformer := newInformer(appClient, namespace, applicationNamespaces, appLabelSelector)
appProjInformer := newInformer(newAppProjClient(client, namespace), namespace, []string{namespace}, "")
secretInformer := k8s.NewSecretInformer(k8sClient, namespace, secretName)
Expand All @@ -73,7 +79,7 @@ func NewController(
appInformer: appInformer,
appProjInformer: appProjInformer,
apiFactory: apiFactory}
res.ctrl = controller.NewController(appClient, appInformer, apiFactory,
res.ctrl = controller.NewController(namespaceableAppClient, appInformer, apiFactory,
controller.WithSkipProcessing(func(obj v1.Object) (bool, string) {
app, ok := (obj).(*unstructured.Unstructured)
if !ok {
Expand Down

0 comments on commit 6b5bade

Please sign in to comment.