Skip to content

Commit

Permalink
add leader pot not scheduled info log
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvegamyhre committed Feb 13, 2024
1 parent bc8b320 commit 15c24a3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/webhooks/pod_admission_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ func (p *podWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (ad
}

func (p *podWebhook) leaderPodScheduled(ctx context.Context, pod *corev1.Pod) (bool, error) {
log := ctrl.LoggerFrom(ctx)
leaderPod, err := p.leaderPodForFollower(ctx, pod)
if err != nil {
return false, err
}
return leaderPod.Spec.NodeName != "", nil
scheduled := leaderPod.Spec.NodeName != ""
if !scheduled {
log.V(3).Info("leader pod %s is not yet scheduled", leaderPod.Name)
}
return scheduled, nil
}

func (p *podWebhook) leaderPodForFollower(ctx context.Context, pod *corev1.Pod) (*corev1.Pod, error) {
Expand Down

0 comments on commit 15c24a3

Please sign in to comment.