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

Add Container Lifecycle support #16391

Merged
merged 6 commits into from
Apr 9, 2020
Merged

Add Container Lifecycle support #16391

merged 6 commits into from
Apr 9, 2020

Conversation

vparfonov
Copy link
Contributor

@vparfonov vparfonov commented Mar 18, 2020

Signed-off-by: Vitalii Parfonov [email protected]

What does this PR do?

Add Container Lifecycle support.
This should allow postStart and preStop actions for plugin containers.
More information here: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/
depends on: eclipse-che/che-plugin-broker#98

What issues does this PR fix or reference?

#16464

Release Notes

Docs PR

@che-bot che-bot added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. kind/enhancement A feature request - must adhere to the feature request template. labels Mar 18, 2020
@che-bot
Copy link
Contributor

che-bot commented Mar 18, 2020

✅ E2E Happy path tests succeed 🎉

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

@che-bot
Copy link
Contributor

che-bot commented Apr 1, 2020

❌ E2E Happy path tests failed ❗

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

⚠️ https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

ℹ️ Use comment "crw-ci-test" to rerun happy path E2E test.

@dmytro-ndp
Copy link
Contributor

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Apr 1, 2020

✅ E2E Happy path tests succeed 🎉

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

@che-bot
Copy link
Contributor

che-bot commented Apr 2, 2020

❌ E2E Happy path tests failed ❗

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

⚠️ https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

ℹ️ Use comment "crw-ci-test" to rerun happy path E2E test.

@che-bot
Copy link
Contributor

che-bot commented Apr 2, 2020

✅ E2E Happy path tests succeed 🎉

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

Signed-off-by: Vitalii Parfonov <[email protected]>
@vparfonov vparfonov marked this pull request as ready for review April 2, 2020 15:25
@che-bot
Copy link
Contributor

che-bot commented Apr 2, 2020

✅ E2E Happy path tests succeed 🎉

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

Copy link
Contributor

@metlos metlos left a comment

Choose a reason for hiding this comment

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

Generally LGTM apart from 2 minor objections.


@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Copy link
Contributor

Choose a reason for hiding this comment

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

toString() formatting.

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

@vparfonov
Copy link
Contributor Author

I wonder if preStop handlers are run even when we forcibly remove pods
https://github.com/eclipse/che/blob/master/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties#L413

For normal work preStop handlers we need to increase terminationGracePeriodSeconds but value depends on handler itself so this open discussion, and we can increase it in separate PR.
This is note from official k8s documentations:

If one of the Pod’s containers has defined a preStop hook, it is invoked inside of the container. If the preStop hook is still running after the grace period expires, step 2 is then invoked with a small (2 second) one-time extended grace period. You must modify terminationGracePeriodSeconds if the preStop hook needs longer to complete.

@che-bot
Copy link
Contributor

che-bot commented Apr 3, 2020

✅ E2E Happy path tests succeed 🎉

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

@amisevsk
Copy link
Contributor

amisevsk commented Apr 3, 2020

If one of the Pod’s containers has defined a preStop hook, it is invoked inside of the container. If the preStop hook is still running after the grace period expires, step 2 is then invoked with a small (2 second) one-time extended grace period. You must modify terminationGracePeriodSeconds if the preStop hook needs longer to complete.

The reason we initially set the termination grace period to 0 is that workspaces would be in a terminating state until it expired, so maybe some process in the workspace isn't properly respecting signals?

Signed-off-by: Vitalii Parfonov <[email protected]>
@vparfonov
Copy link
Contributor Author

So @davidfestal @ibuziuk @amisevsk @sleshchenko @l0rd what do you think about terminationGracePeriodSeconds? Should we increase it in this PR?

@ibuziuk
Copy link
Member

ibuziuk commented Apr 6, 2020

what do you think about terminationGracePeriodSeconds? Should we increase it in this PR?

IMHO, we should make this property configurable via toggle per-workspace smth. similar to what is proposed in #15960

Signed-off-by: Vitalii Parfonov <[email protected]>
@vparfonov
Copy link
Contributor Author

what do you think about terminationGracePeriodSeconds? Should we increase it in this PR?

IMHO, we should make this property configurable via toggle per-workspace smth. similar to what is proposed in #15960

So it this case it will be done via separate PR, right?

@ibuziuk
Copy link
Member

ibuziuk commented Apr 6, 2020

So it this case it will be done via separate PR, right?

sure

@che-bot
Copy link
Contributor

che-bot commented Apr 6, 2020

❌ E2E Happy path tests failed ❗

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

⚠️ https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

ℹ️ Use comment "crw-ci-test" to rerun happy path E2E test.

@vparfonov
Copy link
Contributor Author

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Apr 6, 2020

❌ E2E Happy path tests failed ❗

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

⚠️ https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

ℹ️ Use comment "crw-ci-test" to rerun happy path E2E test.

Copy link
Member

@ibuziuk ibuziuk left a comment

Choose a reason for hiding this comment

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

LGTM, having some tests would be really nice to have though ;)

@vparfonov
Copy link
Contributor Author

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Apr 7, 2020

❌ E2E Happy path tests failed ❗

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

⚠️ https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

ℹ️ Use comment "crw-ci-test" to rerun happy path E2E test.

@che-bot
Copy link
Contributor

che-bot commented Apr 8, 2020

✅ E2E Happy path tests succeed 🎉

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

@vparfonov
Copy link
Contributor Author

@metlos @sleshchenko @amisevsk can i merge it?

@ibuziuk
Copy link
Member

ibuziuk commented Apr 8, 2020

@metlos @sleshchenko folks, are you ok to merge this PR?

Copy link
Contributor

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

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

LGTM, sorry about the delay.

I agree with Ilya that TerminationGracePeriod should be configurable (separate PR/issue), but it might open the door to some subtle configuration issues that are hard to notice. I also think there's some work to be done in implementing a nonzero termination grace period, as in my experience workspaces will take the entire termination grace period (even if it's a minute) -- that may have changed somewhere along the line though.

@vparfonov vparfonov merged commit 71de584 into master Apr 9, 2020
@vparfonov vparfonov deleted the lifecycle branch April 9, 2020 10:38
@che-bot che-bot removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants