Skip to content

Commit

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

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



* fix go lint error



---------

Signed-off-by: May Zhang <may_zhang@intuit.com>
Co-authored-by: May Zhang <may_zhang@intuit.com>
  • Loading branch information
gcp-cherry-pick-bot[bot] and mayzhang2000 authored Oct 30, 2023
1 parent e74c6ca commit 6ab8512
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 @@ -61,7 +61,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 @@ -74,7 +80,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 6ab8512

Please sign in to comment.