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: allow broader storage configuration #25

Merged
merged 1 commit into from
Feb 25, 2024
Merged

feat: allow broader storage configuration #25

merged 1 commit into from
Feb 25, 2024

Conversation

USA-RedDragon
Copy link
Contributor

@USA-RedDragon USA-RedDragon commented Feb 21, 2024

Fixes #12

Motivations

Discussed in #12

Modifications

This PR changes the structure of the server.storage block and is therefore a breaking change.

This takes the existing storage config (below for reference):

server:
  # Storage definitions related to the palworld-server
  #
  storage:
    external: false
    externalName: ""

    # Keeps helm from deleting the PVC, by default helm does not delete pvcs
    #
    preventDelete: false

    size: 12Gi
    storageClassName: ""

and modifies it to the following, basically moving it under main.

server:
  # Storage definitions related to the palworld-server
  #
  storage:
    main:
      external: false
      externalName: ""

      # Keeps helm from deleting the PVC, by default helm does not delete pvcs
      #
      preventDelete: false

      size: 12Gi
      storageClassName: ""

Then we have the backups key, which supports any Kubernetes Volume spec as it's body. The persistentVolumeClaim is a special case which matches the schema of server.storage.main rather than the Kubernetes Volume spec

server:
  storage:
    backups: {}
      # persistentVolumeClaim:
      #   external: false
      #   externalName: ""
      #   preventDelete: false
      #   size: 12Gi
      #   storageClassName: ""

      # nfs:
      #   server: your.server.ip
      #   path: /path/to/remote/dir

Finally, we have the extra array. This takes a list of objects where name and mountPath are required, along with a Kubernetes volume spec. In extra, the subPath and readOnly of the volume mounts on the deployment are configurable. If a persistentVolumeClaim is used, external can be set to not provision a new PVC, otherwise size, storageClassName, and preventDelete can be used to modify the provisioned PVC. The values.yaml shows several commented examples of this:

# Additional storage definitions
#
# Supports all storage types as defined by https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/volume/#Volume
#
# THe objects supports configuring the mount path and the subpath.
# If external isn't true, the defined deletion prevention, storage class, and size will be used to create a new PVC
extra: []
# An example of using an existing PVC at a subpath
#
# - name: existing-pvc
# mountPath: /existing-pvc
# subPath: test
# external: true
# persistentVolumeClaim:
# claimName: existing-pvc
# An example of creating a new PVC of 5Gi
#
# - name: new-pvc
# mountPath: /new-pvc
# size: 5Gi
# preventDelete: false
# storageClassName: "my-storage-class"
# persistentVolumeClaim:
# claimName: new-pvc
# An example of mounting a configmap with key `test.ini` as `config.ini` in /config
#
# - name: config
# mountPath: /config
# configMap:
# name: app-configfile
# items:
# - key: test.ini
# path: config.ini
# An example of mounting a secret
# - name: keys
# mountPath: /keys
# readOnly: true
# secret:
# secretName: app-keyfile
# An example of mounting an nfs volume
# - name: nfs
# mountPath: /data
# nfs:
# server: your.server.ip
# path: /path/to/dir

@USA-RedDragon USA-RedDragon marked this pull request as ready for review February 21, 2024 04:59
@USA-RedDragon
Copy link
Contributor Author

Deployed this HEAD to my cluster with

storage:
    main:
      size: 12Gi
      storageClassName: "longhorn-nvme"

    backups:
      nfs:
        server: my-ip-here
        path: /mnt/data/backups/palworld

and it's been backing up appropriately :)

@Twinki14
Copy link
Owner

Twinki14 commented Feb 23, 2024

Will take a deeper look into this in the next few days

@Twinki14 Twinki14 merged commit ad897d6 into Twinki14:main Feb 25, 2024
5 checks passed
@USA-RedDragon USA-RedDragon deleted the storage-config branch February 25, 2024 19:09
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.

Extra volume mounts on the deployment
2 participants