File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,16 @@ type k8sClient struct {
2929 appNamespace * string
3030}
3131
32- // GetApplication retrieves an application by name across all namespaces.
32+ // GetApplication retrieves an application by name, either in a specific namespace or all namespaces depending on client configuration .
3333func (client * k8sClient ) GetApplication (ctx context.Context , appName string ) (* v1alpha1.Application , error ) {
3434 // List all applications across configured namespace or all namespaces (using empty labelSelector)
35+ if * client .appNamespace != v1 .NamespaceAll {
36+ return client .kubeClient .ApplicationsClientset .ArgoprojV1alpha1 ().Applications (* client .appNamespace ).Get (ctx , appName , v1.GetOptions {})
37+ }
38+ return client .getApplicationInAllNamespaces (ctx , appName )
39+ }
40+
41+ func (client * k8sClient ) getApplicationInAllNamespaces (ctx context.Context , appName string ) (* v1alpha1.Application , error ) {
3542 appList , err := client .ListApplications ("" )
3643 if err != nil {
3744 return nil , fmt .Errorf ("error listing applications: %w" , err )
You can’t perform that action at this time.
0 commit comments