Skip to content

Commit

Permalink
feat(kubernetes): check if DaemonSet is ready
Browse files Browse the repository at this point in the history
Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang committed May 2, 2024
1 parent 1fa9c14 commit 5a4d394
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kubernetes/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ func GetDaemonSet(kubeClient kubeclient.Interface, namespace, name string) (*app

return kubeClient.AppsV1().DaemonSets(namespace).Get(context.Background(), name, metav1.GetOptions{})
}

// IsDaemonSetReady checks if the DaemonSet is ready by comparing the number of ready pods with the desired number of pods.
func IsDaemonSetReady(daemonSet *appsv1.DaemonSet) bool {
return daemonSet.Status.NumberReady == daemonSet.Status.DesiredNumberScheduled
}

0 comments on commit 5a4d394

Please sign in to comment.