Skip to content

Commit

Permalink
Filter non-namespaced resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Yihao committed Aug 29, 2023
1 parent 59cea76 commit 62627c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions source/Calamari/Kubernetes/ResourceStatus/KubectlGet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public string Resource(string kind, string name, string @namespace, IKubectl kub
{
return kubectl.ExecuteCommandAndReturnOutput(new[]
{
"get", kind, name, "-o json", $"-n {@namespace}"
"get", kind, name, "-o json", string.IsNullOrEmpty(@namespace) ? "" : $"-n {@namespace}"
}).Output.InfoLogs.Join(string.Empty);
}

public string AllResources(string kind, string @namespace, IKubectl kubectl)
{
return kubectl.ExecuteCommandAndReturnOutput(new[]
{
"get", kind, "-o json", $"-n {@namespace}"
"get", kind, "-o json", string.IsNullOrEmpty(@namespace) ? "" : $"-n {@namespace}"
}).Output.InfoLogs.Join(string.Empty);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public class ResourceStatusCheckTask
var resourceStatuses = definedResourceStatuses
.SelectMany(IterateResourceTree)
.Where(resource => resource.Namespaced)
.ToDictionary(resource => resource.Uid, resource => resource);
var deploymentStatus = GetDeploymentStatus(definedResourceStatuses, definedResources);
var deploymentStatus = GetDeploymentStatus(definedResourceStatuses.Where(resource => resource.Namespaced).ToArray(), definedResources);
reporter.ReportUpdatedResources(result.ResourceStatuses, resourceStatuses, ++checkCount);
Expand Down

0 comments on commit 62627c8

Please sign in to comment.