Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pod health should be checking for readiness #1650

Merged
merged 3 commits into from
Sep 3, 2020
Merged

Pod health should be checking for readiness #1650

merged 3 commits into from
Sep 3, 2020

Conversation

alenkacz
Copy link
Contributor

@alenkacz alenkacz commented Aug 20, 2020

Signed-off-by: Alena Varkockova varkockova.a@gmail.com

What this PR does / why we need it:
We already use ready condition when evaluating health of statefulset we should do it for pods as well. Running condition is not enough as the container might be just starting also it does not include waiting for the readiness checks.

See https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/ for more context. Also see how StatefulSet evaluates what goes into readyReplicas https://github.com/kubernetes/kubernetes/blob/60044a8accfe8fddeb452c4adca4fefbbff64967/pkg/controller/statefulset/stateful_set_utils.go#L204

Fixes #

Signed-off-by: Alena Varkockova <varkockova.a@gmail.com>
@ANeumann82
Copy link
Member

lgtm, although you need to add a PodRunningCondition in task_apply_test.go line 172

Signed-off-by: Alena Varkockova <varkockova.a@gmail.com>
@alenkacz alenkacz changed the title WIP: Pod health should be checking for readiness Pod health should be checking for readiness Aug 20, 2020
@alenkacz
Copy link
Contributor Author

@ANeumann82 thanks, you're the best :D

Copy link
Member

@ANeumann82 ANeumann82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, lgtm 👍

Copy link
Contributor

@zen-dog zen-dog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it 🚢

@@ -106,7 +108,7 @@ func IsHealthy(obj runtime.Object) error {
return fmt.Errorf("instance %s/%s active plan is in state %v", obj.Namespace, obj.Name, obj.Spec.PlanExecution.Status)

case *corev1.Pod:
if obj.Status.Phase == corev1.PodRunning {
if obj.Status.Phase == corev1.PodRunning && podutils.IsPodReady(obj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need both conditions to be true? Isn't podutils.IsPodReady(obj) enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not have that in the first version but in the end I ended up doing exactly what StatefulSet is doing to be on the safe side https://github.com/kubernetes/kubernetes/blob/60044a8accfe8fddeb452c4adca4fefbbff64967/pkg/controller/statefulset/stateful_set_utils.go#L204

Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>

# Conflicts:
#	pkg/engine/health/health.go
@ANeumann82 ANeumann82 merged commit eb2baf4 into main Sep 3, 2020
@ANeumann82 ANeumann82 deleted the av/pod-health branch September 3, 2020 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants