-
Notifications
You must be signed in to change notification settings - Fork 63
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 lifecycle bindings to bind commands to specific events #32
Comments
This might be related to issue #30 if we consider that an init action is mainly just a specific case of a wider concept of command bindings. |
In addition to the events and scopes, I think we may generalize the events:
editor:
open:
command: "open Readme"
once: true
clone:
command: "build all"
workspace:
init:
command: "initialize something"
stop:
command: "do some cleanup"
before: true
componentStart:
component: maven
before: "copy files"
after: "cleanup files"
custom:
- scope: "my custom scope"
event: "my custom event"
command: "some specific command" |
Reviewed and approved |
Signed-off-by: David Festal <dfestal@redhat.com>
Sorry I missed this until now, but I'm unclear on the semantics of
Does this mean
This seems to leave a little too much grey area, and it introduces a bit of a "change one line and everything is different" issue: visually, a user has to match
to determine if a container will be in the main deployment or not. I think it would be clearer to explicitly have to mark containers as 'external' to the workspace deployment. With the current set-up:
|
1.
If would vote for initContainers instead of components and commands bound for preStart phase. 2.
It may be confusing if we take into account postStart phase of the k8s model https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ 3 What is actually postStop? If it a dedicated deployment run to execute some command after the main deployment is totally removed? |
@amisevsk agree. On one hand I am concerned as you are about that. On the other end I am afraid that we are over-engineering it. Supporting the case of a container used as both init container and main container is really required? If not I would prefer if we start with this spec and work on an external/init optional fields in next iteration. @sleshchenko 1) |
I moreso referring to the grey area that's not explictly documented -- where do my components end up based on a set of commands and event bindings? It can be hard to reason about, which I imagine will make implementation similarly tricky/subtle. To determine where containers end up, we need to consider, for each command:
The example above would be further complicated by considering |
@amisevsk one thing is how readable the devfile is. Another how hard is it to validate/reconcile. We are making implementation harder but it should be easy to read. I am worried if you think that's hard to read too. On making implementation easier: even if we add a component components:
- container:
name: "copier"
init: true we still need to validate that |
On the reading side, I think being explicit about where each component is to be used improves things -- if I can set components:
- container:
name: "copier"
external: true # or init/similar to signify that I intend this container to be a 'setup/teardown' container, it's easier to reason about. On the parsing side, this also enables simpler validation:
This would also encourage using specific components for your prestart/poststop actions, but would potentially block reusing a component for prestart and during the deployment. Also, I'm not 100% sure on using regular commands for the preStart/postStop phases, since it's a bit strange -- these commands are mixed in with commands that the user will use regularly, but should not necessarily be listed in whatever UI shows them. Edit because I forgot to address this:
The difference here would be that the check goes in one direction, otherwise we have to implicitly populate this as internal metadata and check it that way. |
Alternatively, the implementation I would produce for the current spec would mean that whatever containers are used for prestart/poststop actions are created before/after the main deployment. In a pathlogical case, this could mean running every container in the workspace three times. What would a best-practice workspace configuration look like? IMO it would be a separate component that's used for setup/teardown, so I think the spec should encourange the user in that direction. |
* Implement agreement on issue #18 * Implement agreement on issue #17 * Implement agreement on issue #21 * Implement agreement on issue #22 * Implement agreement on issue #27 * Implement agreement on issue #9 * Implement agreement on issue #10 * Fix PR comments about issue #9 PR comment #35 (comment) * Fix PR comments about issue #17 PR comment #35 (comment) * Implement agreement on issue #14 and #19 * Add the spring boot example * Implement agreement on issue #32 * Fix last PR comments Signed-off-by: David Festal <dfestal@redhat.com> Co-Authored-By: Sergii Leshchenko <sleshche@redhat.com>
I have added the proposal to add a |
Reviewed and agreed that with:
|
Issue opened here: #56 |
Implemented |
We might want to introduce a syntax that would allow binding commands to a given workspace event.
A few use cases
Lifecycle Bindings
The lifecycle binding could be provided by a new top-level construct that could look like the following:
where can be one of the following:
Spec Details
lifecycleBindings
are processed sequentially. For examplepreStart
commands will be invoked after everypostCreate
command has completed.postStart
bindings should happen after all plugins and extensions have started, including project cloning. This means that those commands are not triggered until the user opens the IDE in his browser.preStart
commands may need execution of a workspace pod init container. That means that the component associated to thepreStart
command should not be part of the workspace pod. The same applies topostStop
bindings.lifecycleBinding
should provide a mechanism to figure out when they have completed. That means that the command should be terminating or having a readiness probe.lifecycleBinding
are not guarantee to be executed sequentially or in any order. To run commands in a given order a user should use a composite.Example
Not included in this spec
lifecycleBindings
of componentsThe text was updated successfully, but these errors were encountered: