Skip to content

Need to define convention on where project sources are mounted with mountSources: true #291

Closed
@amisevsk

Description

@amisevsk

Description

Container components can specify mountSources: true to enable mounting the project repos into the container. Currently, sources are mounted at the path /projects, which leave the potential for a collision if a devfile specifies volumeMount to /projects directly -- e.g. the DevWorkspace

kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: projects-volumeMount
spec:
  started: true
  template:
    components:
      - name: testing-container
        container:
          image: quay.io/fedora/fedora:34
          mountSources: true # Default value
          volumeMounts:
          - path: "/projects"
            name: my-volume

is at least ambiguous -- default behaviour would be to provision a container with conflicting volumeMounts on the /projects path.

Required Changes

Option 1

  • Use random mountPath (based on workspace UID) for mountSources and expect editors, etc. to respect $PROJECTS_ROOT env var.

Option 2

  • Specify that /projects is a reserved volumeMount path, (unless mountSources is explicitly false?)

Relevant API docs

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.

The API documentation for volumeMounts:

// Volume that should be mounted to a component container
type VolumeMount struct {
	// The volume mount name is the name of an existing `Volume` component.
	// If several containers mount the same volume name
	// then they will reuse the same volume and will be able to access to the same files.
	Name string `json:"name"`

	// The path in the component container where the volume should be mounted.
	// If not path is mentioned, default path is the is `/<name>`.
	// +optional
	Path string `json:"path,omitempty"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions