devfile / devworkspace-operator

Apache License 2.0
61 stars 55 forks source link

Add initContainer for initializing persistentHome when $HOME persistence enabled #1260

Closed AObuchow closed 4 months ago

AObuchow commented 4 months ago

Description

Currently, $HOME persistence functionality relies on the Universal Developer Image's entrypoint to create symbolic links (and copy some non-linkable files) from the containers tooling directory (/home/tooling/) to the persistent $HOME directory (/home/user/).

The problem with this approach is that there is no guarantee that the containers entrypoint will be run before any devfile postStart commands. This results in a potential race condition between the initialization of the persistent $HOME directory, and any postStart commands that may depend on the $HOME directory being initialized.

In order to resolve this race condition, @dkwon17 has proposed to move the $HOME persistence initialization logic outside of the UDI's entrypoint, into a devfile container that will be applied as a preStart command (i.e. an initContainer). The initContainer will guarantee that the $HOME persistence initialization logic always runs before any devfile postStart commands.

Additional context

Related upstream issue: https://github.com/eclipse-che/che/issues/22914