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

Clarification on container mountSources behavior when "projects" volume is defined in devfile #290

Open
3 tasks
amisevsk opened this issue Jan 7, 2021 · 2 comments
Labels
lifecycle/stale Stale items. These items have not been updated for 90 days.

Comments

@amisevsk
Copy link
Contributor

amisevsk commented Jan 7, 2021

Description

Currently, container components can set the field mountSources: true to enable mounting of project sources inside the pod and defaults to true for most user defined sources. Typically this would be done by generating a k8s volumeMount and k8s volume for the container that is mounting sources. However, as volumes can be defined as components, how k8s volumes are generated is unclear -- what behavior is expected if a devfile has a "projects" component already defined?

Note: I'm assuming that an explicit "projects" volume component isn't required in devfiles, since mountSources is by default true for many containers. Generating the required k8s volume is a sensible default since otherwise devfiles require a bit of arbitrary boilerplate.

Potential solutions

1. Implicit "projects" volume component, can be overridden in devfile

We assume there is a volume component named projects with a default configuration in every devfile, available in case mountSources is true for any component. The devfile writer can define an explicit "projects" volume to override default behavior. However, if this approach is taken, it's unclear how to handle devfiles that contain a non-volume component named "projects" -- is this an error or should we assume the devfile does not override the default projects volume?

Required updates to devfile API in this case

  • Update documentation to mention that "projects" volumes can be used to override storage, etc. for the defaulted Volume used for mountSources
  • (optional) Define "projects" as a reserved component name to avoid ambiguity when a devfile contains a non-volume component named "projects"

2. Unique "projects" volume component that cannot be overridden

We generate a unique volume (e.g. keyed to workspace UID) that stores project sources, avoiding any potential name collisions. Users can define a "projects" volume and mount it manually for other use. However, this approach leaves to clear path for e.g. increasing the storage allocated for projects.

Required updates to devfile API in this case

  • Provide in-spec way to set amount of storage provisioned for projects volume (this can be left to an attribute that's handled by consumers, if necessary).

Additional info

The API documentation for mountSources:

mountSources: boolean

Toggles whether or not the project source code should be mounted in the component.

Defaults to true for all component types except plugins and components that set dedicatedPod to true.

Related: #291

@amisevsk
Copy link
Contributor Author

amisevsk commented Jan 7, 2021

cc: @l0rd @davidfestal your input here is appreciated. I'm leaning towards option 2.

amisevsk added a commit to amisevsk/devworkspace-operator that referenced this issue Jan 15, 2021
This avoids an issue where a container can mount the projects volume
directly and have `mountSources: true`, which results in a duplicate
mount and invalid deployment.

Related to issue devfile/api#290 and how
projects volume should be handled with `mountSources`.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
amisevsk added a commit to amisevsk/devworkspace-operator that referenced this issue Jan 20, 2021
This avoids an issue where a container can mount the projects volume
directly and have `mountSources: true`, which results in a duplicate
mount and invalid deployment.

Related to issue devfile/api#290 and how
projects volume should be handled with `mountSources`.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
amisevsk added a commit to devfile/devworkspace-operator that referenced this issue Jan 21, 2021
This avoids an issue where a container can mount the projects volume
directly and have `mountSources: true`, which results in a duplicate
mount and invalid deployment.

Related to issue devfile/api#290 and how
projects volume should be handled with `mountSources`.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
amisevsk added a commit to amisevsk/devworkspace-operator that referenced this issue Jan 27, 2021
This avoids an issue where a container can mount the projects volume
directly and have `mountSources: true`, which results in a duplicate
mount and invalid deployment.

Related to issue devfile/api#290 and how
projects volume should be handled with `mountSources`.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Copy link

This issue is stale because it has been open for 90 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the lifecycle/stale Stale items. These items have not been updated for 90 days. label Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Stale items. These items have not been updated for 90 days.
Projects
Status: No status
Development

No branches or pull requests

1 participant