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

External volumes #325

Closed
wants to merge 2 commits into from
Closed

External volumes #325

wants to merge 2 commits into from

Conversation

amisevsk
Copy link
Contributor

What does this PR do?

This PR is half of #310 (support for "external" volumes). It adds support for mounting existing resources (e.g. configmaps, secrets, or persistent volumes) into devfile components without the implicit assumption that they're defined by the devfile itself. Use cases are:

  • Mounting config files or ssh secrets
  • Mounting shared volumes (e.g. static assets)

I've separated it out as this is a change we should consider carefully -- referring to volumes that are assumed to exist on the cluster makes devfiles less portable. Without a defined way of handling volumes we can't find, we risk e.g. my devfile not being compatible with your cluster (unless you happen to have the same configmaps/secrets defined). (Thanks @l0rd for pointing this out.)

What issues does this PR fix or reference?

Half of #310

Is your PR tested? Consider putting some instruction how to test your changes

N/A

Support the use case of mounting an existing secret, configmap, or
persistent volume into a devfile component by adding a field 'external'
to volume components. When not empty, the volume component is taken as
referring to some existing resource that should be mounted to components
as required.

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: amisevsk
To complete the pull request process, please assign after the PR has been reviewed.
You can assign the PR to them by writing /assign in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@amisevsk amisevsk mentioned this pull request Jan 26, 2021
Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

components:
- name: cfg
  volumes:
    external:
      name: my-app-cfg
      type: secret

Looks simple but it makes sense to think if we want to support advanced parameters for each of type, like optional, items for configmap and secret, and readonly for storage.
If we want, then we may want to go the following way:

components:
- name: cfg
  volumes:
    external:
      secret:
        name: my-app-cfg # can be secretName if we follow k8s
        optional: true # optional is optional =)
        items: ...

the only drawback - one more nesting level


const (
// PersistentVolumeType specifies persistent storage, e.g. a PersistentVolumeClaim
PersistentVolumeType ExistingVolumeType = "persistent"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is always going reference PVC would it be better to go with full name? persistentvolumeclaim?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the abstraction that persistent gives (plus it's shorter), but I'm fine either way. In general, tying our API 1-1 with kubernetes makes the whole thing feel like a weird indirection layer rather than an API.

Copy link
Contributor

@elsony elsony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are external and the existing size mutually exclusive, i.e. if we are using external volume, then the size field cannot be specified and vice versa?

@amisevsk
Copy link
Contributor Author

Are external and the existing size mutually exclusive, i.e. if we are using external volume, then the size field cannot be specified and vice versa?

From a k8s perspective, yes, the fields are exclusive -- most of the top-level volume fields are invalid if external is specified; I don't know a good solution there.

@openshift-ci-robot
Copy link

@amisevsk: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@amisevsk amisevsk closed this Apr 12, 2021
@amisevsk amisevsk deleted the external-volumes branch April 12, 2021 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants