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

feat: introduce emulation for sc, pv and pvc #38

Merged
merged 5 commits into from
Sep 4, 2023
Merged

Conversation

stevensbkang
Copy link
Member

@stevensbkang stevensbkang commented Aug 31, 2023

Closes #12.

Implementation Details

In Kubernetes, Storage Class, Persistent Volume Claim, and Persistent Volume are generally used for storage. Translating these to the Docker terms:

  • Storage Class = Volume Plugins
    • This can be expanded to other plugins, such as CSI drivers, in future
  • Persistent Volume Claim = N/A
  • Persistent Volume = Docker Volume

Unlike Kubernetes, where a storage class can be defined as a manifest, creating a Volume plugin on demand is impossible at the Docker layer. Hence, only the GET and LIST operations will be added, defaulting to the local Docker Volume driver only as a starting point.

Since there is no concept of Persistent Volume Claim in Docker, the decision was to merge PV and PVC into Docker Volume. This means that the creation and deletion of a Docker Volume are only activated via PVC (dynamic PV creation). The user will not be able to create a PV and statically map it to a PVC. Rather, you can rely on the PVC to dynamically provision a PV, which is a Docker Volume in the backend.

Due to Docker Volume's immutable nature, for instance, updating its labels requires a complete recreation; the reclaim policy is set to Delete. There is a separate discussion to change the default policy to Retain.

The details of PVC are stored as a Docker Volume label, and PV is directly obtained from the specification of a Docker Volume.

Finally, mounting a PVC to a pod is equivalent to a Docker volume mount; docker run -v ${DOCKER_VOLUME}:/${PATH}.

Copy link
Member

@deviantony deviantony left a comment

Choose a reason for hiding this comment

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

First initial review

internal/adapter/naming.go Outdated Show resolved Hide resolved
internal/adapter/persistentvolume.go Outdated Show resolved Hide resolved
internal/adapter/persistentvolume.go Outdated Show resolved Hide resolved
internal/adapter/persistentvolumeclaim.go Outdated Show resolved Hide resolved
internal/adapter/types/labels.go Outdated Show resolved Hide resolved
internal/api/apis/apis.go Outdated Show resolved Hide resolved
@deviantony deviantony merged commit e910bd1 into develop Sep 4, 2023
1 check passed
@deviantony deviantony deleted the feat/storage branch September 4, 2023 08:00
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

Successfully merging this pull request may close these issues.

Support for emulation of Persistent Volumes via PVCs
2 participants