Skip to content

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

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

Closed
2 tasks
amisevsk opened this issue Jan 7, 2021 · 2 comments
Closed
2 tasks

Comments

@amisevsk
Copy link
Contributor

amisevsk commented Jan 7, 2021

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"`
}
@amisevsk
Copy link
Contributor Author

amisevsk commented Jan 7, 2021

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

@amisevsk
Copy link
Contributor Author

amisevsk commented Jan 7, 2021

I missed the sourceMapping field above:

sourceMapping: string /projects

Optional specification of the path in the container where project sources should be transferred/mounted when mountSources is true. When omitted, the default value of /projects is used.

which implies option 1 in the original description; it should be specified that the value used for sourceMapping cannot be used as a mount path for any VolumeMounts or it will result in a collision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant