-
Notifications
You must be signed in to change notification settings - Fork 727
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
Reconciliation is blocked when a Pod can't be created #2266
Comments
Oh right... good catch. We don't create Pods ourselves anymore so we don't get a Pod creation error :( A way out of the above is for the user to manually delete the StatefulSet... but this is not a good idea if some good Pods already exist for it. I don't have any other idea so far. |
Happened with #2854. If you set invalid resource requirements (eg. cpu requests > cpu limits), the corresponding Pod can never be created, and ECK waits forever for that Pod to appear in expectations. Even though you may have fixed the requirements in the Elasticsearch manifest. |
I hit this one again while playing with
I was wondering if we can use the "dry run" feature, it is not available until K8S 1.13 but it returns an HTTP 400 error if it is not supported yet: func validatePod(c k8s.Client, expected appsv1.StatefulSet) func() error {
// Create a dummy Pod with the pod template
return func() error {
dummyPod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Namespace: expected.Namespace,
Name: expected.Name + "-dummy-" + rand.String(5),
Labels: expected.Spec.Template.Labels,
Annotations: expected.Spec.Template.Annotations,
},
Spec: expected.Spec.Template.Spec,
}
// Dry run is beta and available since Kubernetes 1.13
if err := c.Create(dummyPod, client.DryRunAll); err != nil {
// Openshift 3.11 and K8S 1.12 don't support dryRun but gently returns "400 - BadRequest" in that case
if errors.ReasonForError(err) == metav1.StatusReasonBadRequest {
return nil
}
// If the Pod spec is invalid the expected error is 422 - UNPROCESSABLE ENTITY
// But for K8S >= 1.13 we should not have an error here
return fmt.Errorf("error while validating Pod for %s/%s: %v", expected.Namespace, expected.Name, err)
}
return nil
}
} This could be done in the |
😲 That's a great idea @barkbay! |
A few thoughts while I'm working on this one:
And ofc generate an event:
|
I got a situation where:
ok, err := d.expectationsSatisfied()
always returnsfalse
The following manifest helps to recreate the issue:
The problem is that we assume that a Pod is at least in a
Pending
state, which is not the case.The text was updated successfully, but these errors were encountered: