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

single: allow overriding pvc names for deployment #1647

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/victoria-logs-single/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Next release

- TODO
- Added ability to override PVC name for Deployment

## 0.7.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ spec:
- name: server-volume
{{- if $app.persistentVolume.enabled }}
persistentVolumeClaim:
claimName: {{ $app.persistentVolume.existingClaim | default $fullname }}
claimName: {{ $app.persistentVolume.existingClaim | default $app.persistentVolume.name | default $fullname }}
{{- else }}
emptyDir: {{ toYaml $app.emptyDir | nindent 12 }}
{{- end }}
Expand Down
21 changes: 12 additions & 9 deletions charts/victoria-logs-single/templates/server-pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
{{- if .Values.server.persistentVolume.enabled -}}
{{- if not .Values.server.statefulSet.enabled -}}
{{- if not .Values.server.persistentVolume.existingClaim -}}
{{- $app := .Values.server }}
{{- $pvc := $app.persistentVolume }}
{{- if $pvc.enabled -}}
{{- if not $app.statefulSet.enabled -}}
{{- if not $pvc.existingClaim -}}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "vm.plain.fullname" $ctx }}
name: {{ $pvc.name | default $fullname }}
namespace: {{ include "vm.namespace" . }}
{{- with .Values.server.persistentVolume.annotations }}
{{- with $pvc.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
spec:
{{- with .Values.server.persistentVolume.accessModes }}
{{- with $pvc.accessModes }}
accessModes: {{ toYaml . | nindent 4 }}
{{- end }}
resources:
requests:
storage: {{ .Values.server.persistentVolume.size }}
{{- with .Values.server.persistentVolume.storageClassName }}
storage: {{ $pvc.size }}
{{- with $pvc.storageClassName }}
storageClassName: {{ . }}
{{- end }}
{{- with .Values.server.persistentVolume.matchLabels }}
{{- with $pvc.matchLabels }}
selector:
matchLabels: {{ toYaml . | nindent 6 }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions charts/victoria-logs-single/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ server:
# -- Create/use Persistent Volume Claim for server component. Empty dir if false
enabled: false

# -- Override Persistent Volume Claim name
name: ""

# -- Array of access modes. Must match those of existing PV or dynamic provisioner. Details are [here](http://kubernetes.io/docs/user-guide/persistent-volumes/)
accessModes:
- ReadWriteOnce
Expand Down
1 change: 1 addition & 0 deletions charts/victoria-metrics-single/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- replaced chart templates with common ones
- multiple paths for a host in ingress
- Added ability to override PVC name for Deployment

## 0.12.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ spec:
- name: server-volume
{{- if $app.persistentVolume.enabled }}
persistentVolumeClaim:
claimName: {{ $app.persistentVolume.existingClaim | default $fullname }}
claimName: {{ $app.persistentVolume.existingClaim | default $app.persistentVolume.name | default $fullname }}
{{- else }}
emptyDir: {{ toYaml $app.emptyDir | nindent 12 }}
{{- end }}
Expand Down
17 changes: 9 additions & 8 deletions charts/victoria-metrics-single/templates/server-pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
{{- $app := .Values.server }}
{{- if $app.persistentVolume.enabled -}}
{{- $pvc := $app.persistentVolume }}
{{- if $pvc.enabled -}}
{{- if not $app.statefulSet.enabled -}}
{{- if not $app.persistentVolume.existingClaim -}}
{{- if not $pvc.existingClaim -}}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ $fullname }}
name: {{ $pvc.name | default $fullname }}
namespace: {{ include "vm.namespace" . }}
{{- with $app.persistentVolume.annotations }}
{{- with $pvc.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels: {{ include "vm.labels" $ctx | nindent 4 }}
spec:
{{- with $app.persistentVolume.accessModes }}
{{- with $pvc.accessModes }}
accessModes: {{ toYaml . | nindent 4 }}
{{- end }}
resources:
requests:
storage: {{ $app.persistentVolume.size }}
{{- with $app.persistentVolume.storageClassName }}
storage: {{ $pvc.size }}
{{- with $pvc.storageClassName }}
storageClassName: {{ . }}
{{- end }}
{{- with $app.persistentVolume.matchLabels }}
{{- with $pvc.matchLabels }}
selector:
matchLabels: {{ toYaml . | nindent 6 }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions charts/victoria-metrics-single/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ server:
# -- Create/use Persistent Volume Claim for server component. Empty dir if false
enabled: true

# -- Override Persistent Volume Claim name
name: ""

# -- Array of access modes. Must match those of existing PV or dynamic provisioner. Details are [here](http://kubernetes.io/docs/user-guide/persistent-volumes/)
accessModes:
- ReadWriteOnce
Expand Down