Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev committed Dec 16, 2024
1 parent f40cad8 commit 58f8554
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion controller/appcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func (ctrl *ApplicationController) getResourceTree(destCluster *appv1.Cluster, a
orphanedNodesMap := make(map[kube.ResourceKey]appv1.ResourceNode)
warnOrphaned := true
if proj.Spec.OrphanedResources != nil {
orphanedNodesMap, err = ctrl.stateCache.GetNamespaceTopLevelResources(a.Spec.Destination.Server, a.Spec.Destination.Namespace)
orphanedNodesMap, err = ctrl.stateCache.GetNamespaceTopLevelResources(destCluster.Server, a.Spec.Destination.Namespace)
if err != nil {
return nil, fmt.Errorf("failed to get namespace top-level resources: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion controller/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ func (c *liveStateCache) GetNamespaceTopLevelResources(server string, namespace
func (c *liveStateCache) GetManagedLiveObjs(destCluster *appv1.Cluster, a *appv1.Application, targetObjs []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error) {
clusterInfo, err := c.getSyncedCluster(destCluster.Server)
if err != nil {
return nil, fmt.Errorf("failed to get cluster info for %q: %w", a.Spec.Destination.Server, err)
return nil, fmt.Errorf("failed to get cluster info for %q: %w", destCluster.Server, err)
}
return clusterInfo.GetManagedLiveObjs(targetObjs, func(r *clustercache.Resource) bool {
return resInfo(r).AppName == a.InstanceName(c.settingsMgr.GetNamespace())
Expand Down
11 changes: 1 addition & 10 deletions server/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -2176,17 +2176,8 @@ func (s *Server) getObjectsForDeepLinks(ctx context.Context, app *appv1.Applicat
if !permitted {
return nil, nil, fmt.Errorf("error getting destination cluster")
}
clst, err := s.db.GetCluster(ctx, app.Spec.Destination.Server)
if err != nil {
log.WithFields(map[string]interface{}{
"application": app.GetName(),
"ns": app.GetNamespace(),
"destination": app.Spec.Destination,
}).Warnf("cannot get cluster from db, error=%v", err.Error())
return nil, nil, nil
}
// sanitize cluster, remove cluster config creds and other unwanted fields
cluster, err = deeplinks.SanitizeCluster(clst)
cluster, err = deeplinks.SanitizeCluster(destCluster)
return cluster, project, err
}

Expand Down

0 comments on commit 58f8554

Please sign in to comment.