Skip to content

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

Closed as not planned
@amisevsk

Description

@amisevsk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenRotten items. These items have been stale for 60 days and are now closed.lifecycle/staleStale items. These items have not been updated for 90 days.

    Type

    No type

    Projects

    Status

    Done ✅

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions