Storage rework part 1 (#337)

* Create docs for Integrated Persistent Storage

* add a clear note about possibly moving to PVC's in the (near) future.

* Adapt developer docs to reflect new storage system

* Move Apps fixed-storage to new Storage system
This commit is contained in:
Kjeld Schouten-Lebbing
2021-04-13 21:43:27 +02:00
committed by GitHub
parent 728cd300c8
commit eb48f8a4e1
491 changed files with 8313 additions and 11058 deletions

View File

@@ -5,82 +5,78 @@ This article serves as a development extention to the storage article available
##### Storage and Common-Chart
For all these storage solutions we require the commonchart to be added to the App.
The Common-Chart handles both the connection/addition of storage to the container and spinning up special k8s jobs to fix the permissions if requested.
The Common-Chart handles both the connection/addition of storage to the container and spinning up special k8s jobs to fix the permissions if requested for the Custom storage.
### Fixed Storage
### Integrated Persistent Storage
When adding an App, there are almost always certain folders that are required for solid Apps performance. For example config files that should be persistent across restarts.
For these storages we can easily add fixes values in the UI, these settings can not be disabled or removed and would, by default, bind to an ix_volume if nothing is changed.
For these storages we can easily add fixes values in the UI, these settings can not be disabled or removed and would, by default and preferably, be limited to the "internal" storage class
Preventing the user to disable them, ensures that users don't (by mistake) remove the storage.
#####
```
- variable: appVolumeMounts
label: "app storage"
group: "Storage and Devices"
- variable: persistence
label: "Integrated Persistent Storage"
description: "Websocket Service"
group: "Storage"
schema:
type: dict
attrs:
# Config ------------------------
- variable: config
label: "config dataset"
- variable: data
label: "App Config Storage"
description: "Stores the Application Configuration."
schema:
type: dict
$ref:
- "normalize/ixVolume"
attrs:
- variable: enabled
label: "Enabled"
label: "Enable the storage"
schema:
type: boolean
default: true
required: true
hidden: true
editable: false
- variable: setPermissions
label: "Automatic Permissions"
description: "Automatically set permissions on install"
schema:
type: boolean
default: true
hidden: false
- variable: emptyDir
label: "emptyDir"
schema:
type: boolean
default: false
hidden: true
editable: false
- variable: datasetName
label: "Dataset Name"
- variable: storageClass
label: "Type of Storage"
description: " Warning: Anything other than Internal will break rollback!"
schema:
type: string
default: "config"
required: true
editable: false
hidden: true
default: ""
enum:
- value: ""
description: "Internal"
- variable: mountPath
label: "Mount Path"
description: "Path to mount inside the pod"
label: "mountPath"
description: "Path inside the container the storage is mounted"
schema:
type: path
required: true
default: "/config"
editable: false
- variable: hostPathEnabled
label: "host Path Enabled"
type: string
default: "/data"
hidden: true
- variable: emptyDir
label: "Mount a ramdisk instead of actual storage"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Host Path"
schema:
type: hostpath
required: true
hidden: true
- variable: accessMode
label: "Access Mode (Advanced)"
description: "Allow or disallow multiple PVC's writhing to the same PVC"
schema:
type: string
default: "ReadWriteOnce"
enum:
- value: "ReadWriteOnce"
description: "ReadWriteOnce"
- value: "ReadOnlyMany"
description: "ReadOnlyMany"
- value: "ReadWriteMany"
description: "ReadWriteMany"
- variable: size
label: "Size quotum of storage"
schema:
type: string
default: "100Gi"
```
### Unlimited Custom Storage Mounts

View File

@@ -1,41 +1,69 @@
# Storage
TrueCharts tries to stay in sync with the Official IX-Systems App Catalog when it comes to storage. Which is currently pretty much a "work in progres".
TrueCharts uses multiple different storage systems:
### Storage types
Storage is currently seperated into two types:
1. ix_volumes
2. hostPath
While, from a k8s point of view, both of these are technically hostPath volumes, for you, as a user, there is a significant difference.
1. Integrated Persistent Storage
2. Custom Storage
##### ix_volumes
ix_volumes, are the default storage option for every TrueCharts App. They always get created and used unless "hostPath" is checked.
ix_volumes are fully managed by TrueNAS SCALE, they get created and destroyed on demand when creating, updating or editing an App.
But, most importantly, they can be reverted if an upgrade goes wrong. Which makes them an great to use for storing config files.
### Integrated Persistent Storage
They are, normally, stored in the following directory:
`/mnt/poolname/ix-applications/releases/releasename/volumes/ix_volumes/`
Integrated Persistent Storage is based around Kubernetes PVC's to integrate as closely as possible into TrueNAS SCALE. They are also heavily preconfigured to work as optimal as possible and provide options for future expansion such as NFS and Gluster options being added.
##### hostPath
These storage options inherently are not well suited to being shared with multiple applications.
We currently have the following Storage options for Integrated Persistent Storage storage:
1. Internal
##### Internal
This storage is integrated into TrueNAS SCALE and completely supports reverting upgrades. Thats why this is the default (and only actually supported!) way of storing App configuration files.
### Custom Storage
Besides the earlier mentioned Integrated Persistent Storage, we also provide the option to mount as many host folders as you want.
Custom storage currently actually quite simple:
It mounts a directory from your TrueNAS SCALE system, directly to a directory inside the App you're installing.
However: We might port this to PVC's in the future, which is not fully decided on yet.
Hostpath is quite simple: It mounts a directory from your TrueNAS SCALE system, directly to a directory inside the App you're installing.
There is, in contrast to the ix_volumes, no "special magic sauce" when adding hostPath storage.
### Permissions
Permission settings are rather important and are often something that causes issues for users.
For that reason TrueCharts introduced a feature to automatically set permissions individually for each of your storage options.
For both Integrated Persistent Storage and Custom storage, we offer special options to automatically set permissions to coincide with your container.
##### Integrated Persistent Storage
These get automatically set to be owned by root:__PGID__
There are no options available to configure this.
##### Custom storage
We offer an optional automatic set the permissions according to App PGID and PUID.
Setting permissions automatically means we `chown` the folder and all folder within it, to a user and group of your choice.
However, we only do so when installing or updating an app.
Please be aware that automatically setting ownership/permissions, does mean it overrides your current CHOWN and CHMOD settings. This could break things and yes, it will destroy your system if used carelessly. It's also not wise to enable the automatic permissions on mounted shares from an external system.
These permission get based on the user and group you enter in the App configuration dialog and default to `568` (the SCALE default Apps user).
### Custom Storage
Besides the earlier mentioned storage options, we also provide the option to mount as many host folders as you want. This is limited to hostPath mounts only.
### Depricated Storage systems
##### ix_volumes
ix_volumes, where the default storage option for every TrueCharts App before 21.04ALPHA. They always got created and used unless "hostPath" was checked.
ix_volumes where fully managed by TrueNAS SCALE, they got created and destroyed on demand when creating, updating or editing an App.
But, most importantly, they could be reverted if an upgrade goes wrong. Which makes them an great to use for storing config files.
They are, normally, stored in the following directory:
`/mnt/poolname/ix-applications/releases/releasename/volumes/ix_volumes/`