77862b85e2
Test Plan: - Deploy using `feature-fstype` image tag - Create the following storage class: ``` apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: btrfs-sc parameters: fsType: btrfs provisioner: rawfile.hamravesh.com reclaimPolicy: Delete volumeBindingMode: WaitForFirstConsumer allowVolumeExpansion: true ``` - Create and use a pvc backed by the new storage class - Exec into the pod and verify that the mounted volume is a `btrfs` filesystem indeed Reviewers: h.marvi, sina_rad, mhyousefi, bghadiri Reviewed By: h.marvi, mhyousefi, bghadiri Differential Revision: https://phab.hamravesh.ir/D833
27 lines
688 B
Python
27 lines
688 B
Python
import sys
|
|
|
|
LATEST_SCHEMA_VERSION = 2 # type: int
|
|
|
|
|
|
def migrate_0_to_1(data: dict) -> dict:
|
|
data["schema_version"] = 1
|
|
return data
|
|
|
|
|
|
def migrate_1_to_2(data: dict) -> dict:
|
|
data["schema_version"] = 2
|
|
data.setdefault("fs_type", "ext4")
|
|
return data
|
|
|
|
|
|
def migrate_to(data: dict, version: int) -> dict:
|
|
current = data.get("schema_version", 0)
|
|
if current > version:
|
|
raise Exception(
|
|
f"Current schema version ({current}) is newer than target schema version ({version})"
|
|
)
|
|
for i in range(current, version):
|
|
migrate_fn = getattr(sys.modules[__name__], f"migrate_{i}_to_{i + 1}")
|
|
data = migrate_fn(data)
|
|
return data
|