Skip to content

Commit

Permalink
update status
Browse files Browse the repository at this point in the history
  • Loading branch information
weibaohui committed Jul 11, 2024
1 parent 52d0869 commit 2d084d7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
3 changes: 3 additions & 0 deletions BlazorApp/Diagrams/KubeNodeWidget.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ protected override async Task OnInitializedAsync()
"V1Alpha2TCPRoute" => (item as V1Alpha2TCPRoute)?.Status?.Parents?.IsReady(),
"V1Alpha2UDPRoute" => (item as V1Alpha2UDPRoute)?.Status?.Parents?.IsReady(),
"V1Gateway" => (item as V1Gateway)?.Status?.IsReady(),
"V1DaemonSet" => (item as V1DaemonSet)?.Status?.IsReady(),
"V1StatefulSet" => (item as V1StatefulSet)?.Status?.Conditions?.IsReady(),
"V1Node" => (item as V1Node)?.Status?.Conditions?.IsReady(),
// "V1Job" => (Node.Item as V1Job)?.IsReady(),
// "V1CronJob" =>( Node.Item as V1CronJob)?.IsReady(),
// "V1DaemonSet" => (Node.Item as V1DaemonSet)?.IsReady(),
Expand Down
17 changes: 17 additions & 0 deletions Extension/k8s/DaemonSetExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using k8s.Models;

namespace Extension.k8s;

public static class DaemonSetExtension
{
public static bool IsReady(this V1DaemonSetStatus status)
{
if (status.DesiredNumberScheduled == status.NumberAvailable &&
status.DesiredNumberScheduled == status.NumberReady)
{
return true;
}

return false;
}
}
2 changes: 1 addition & 1 deletion Extension/k8s/NodeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Extension.k8s;

public static class Extension
public static class NodeExtension
{
public static bool IsReady(this IList<V1NodeCondition> conditions)
{
Expand Down
20 changes: 20 additions & 0 deletions Extension/k8s/StatefulSetExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using k8s.Models;

namespace Extension.k8s;

public static class StatefulSetExtension
{
public static bool IsReady(this IList<V1StatefulSetCondition> conditions)
{
foreach (var condition in conditions)
{
if (condition is { Type: "Ready", Status: "True" })
{
return true;
}
}

return false;
}
}

0 comments on commit 2d084d7

Please sign in to comment.