dirsigler / uptime-kuma-helm

This Helm Chart installs Uptime-Kuma from @louislam to your Kubernetes Cluster.
https://helm.irsigler.cloud
GNU General Public License v3.0
151 stars 53 forks source link

Example for using Existing PV #71

Closed Milindkg97 closed 1 year ago

Milindkg97 commented 2 years ago

The existing PV setup requires to pass in an object, can you share an example of how to attach our own PV/PVC via the values.yaml file

Milindkg97 commented 2 years ago

@dirsigler

Milindkg97 commented 2 years ago

We are trying to implement this using Terraform.

Spritekin commented 1 year ago

I don't think its possible to use an existing PVC in this chart right now. As far as I see the values.yaml defines

# If this option is set to false a StateFulset instead of a Deployment is used
useDeploy: true

So it will use the deployment.yaml template, however in the Deployment.yaml template it only has a mention for the PVC created in the pvc.yaml.

      volumes:
      - name: storage
        persistentVolumeClaim:
          claimName: {{ include "uptime-kuma.fullname" . }}-pvc     <<< Name from pvc.yaml

The pvc.yaml right now only allows "not creating" the volume if the existing claim is defined.

{{- if and .Values.useDeploy (not .Values.volume.existingClaim) }}
{{- if and .Values.volume.enabled (not .Values.volume.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ include "uptime-kuma.fullname" . }}-pvc
  labels:
    {{- include "uptime-kuma.labels" . | nindent 4 }}

The solution for this problem is just doing something like this in the deployment.yaml

      volumes:
      - name: storage
        persistentVolumeClaim:
          {{- if not .Values.volume.existingClaim }}   
          claimName: {{ include "uptime-kuma.fullname" . }}-pvc
          {{- else }}
          claimName: {{ .Values.volume.existingClaim }}
          {{- end }}