From 3f00d4ad0d3e3f23fa2c81879630253a551aede3 Mon Sep 17 00:00:00 2001 From: Filipe Souza Date: Thu, 25 Jan 2024 00:43:55 -0300 Subject: [PATCH] - Now supports a external PVC to be attached to the container; - Added parameters to include a external PVC; --- chart/VALUES_SUMMARY.md | 4 +++- chart/templates/deployments.yaml | 4 ++++ chart/templates/pvcs.yaml | 4 +++- chart/values.yaml | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/chart/VALUES_SUMMARY.md b/chart/VALUES_SUMMARY.md index f76fb43..ef8ad5b 100644 --- a/chart/VALUES_SUMMARY.md +++ b/chart/VALUES_SUMMARY.md @@ -54,7 +54,9 @@ This chart can provide an rAthena emulator installation on a Kubernetes cluster. | server.service.ports[2] | dict | `{"name":"rcon","port":25575,"protocol":"UDP","targetPort":25575}` | The "rcon" port definition . If you change this, make sure to change the server.ports.rcon and server.config.rcon.port accordingly. | | server.service.ports[3] | dict | `{"name":"healthz","port":80,"protocol":"TCP","targetPort":80}` | The "healthz" port definition . Used only to create a health check for load balancers on cloud services. | | server.service.type | string | `"LoadBalancer"` | The type of service to be created. | -| server.storage | dict | `{"preventDelete":false,"size":"10Gi","storageClassName":""}` | Define some parameters for the storage volume | +| server.storage | dict | `{"external":false,"externalName":"","preventDelete":false,"size":"10Gi","storageClassName":""}` | Define some parameters for the storage volume | +| server.storage.external | bool | `false` | Define if it will use an existing PVC containing the installation data. | +| server.storage.externalName | bool | `""` | The external PVC name to use. | | server.storage.preventDelete | bool | `false` | Keeps helm from deleting the PVC. By default, helm does not delete pvcs. | | server.storage.size | string | `"10Gi"` | The size of the pvc storage. | | server.storage.storageClassName | string | `""` | The storage class name. | diff --git a/chart/templates/deployments.yaml b/chart/templates/deployments.yaml index 823261b..105909b 100644 --- a/chart/templates/deployments.yaml +++ b/chart/templates/deployments.yaml @@ -55,4 +55,8 @@ spec: volumes: - name: datadir persistentVolumeClaim: + {{- if not .Values.server.storage.external }} claimName: "{{ .Release.Name }}-datadir-pvc" + {{ else }} + claimName: "{{ .Values.server.storage.externalName }}" + {{ end }} diff --git a/chart/templates/pvcs.yaml b/chart/templates/pvcs.yaml index b4d9a5f..c16e754 100644 --- a/chart/templates/pvcs.yaml +++ b/chart/templates/pvcs.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.server.storage.external }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -26,4 +27,5 @@ spec: resources: requests: storage: {{ .Values.server.storage.size }} - storageClassName: {{ .Values.server.storage.storageClassName }} \ No newline at end of file + storageClassName: {{ .Values.server.storage.storageClassName }} +{{ end }} \ No newline at end of file diff --git a/chart/values.yaml b/chart/values.yaml index 3172d7a..e72af11 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -9,6 +9,10 @@ server: labels: { } # -- (dict) Define some parameters for the storage volume storage: + # -- (bool) Define if it will use an existing PVC containing the installation data. + external: false + # -- (bool) The external PVC name to use. + externalName: "" # -- Keeps helm from deleting the PVC. By default, helm does not delete pvcs. preventDelete: false # -- The size of the pvc storage.