Skip to content

Commit

Permalink
shortlink-common: add strategy for volumes
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Login <batazor111@gmail.com>
  • Loading branch information
batazor committed Dec 30, 2022
1 parent 599b656 commit 00edf03
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ops/Helm/shortlink-common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2 # The chart API version (requir
appVersion: "1.0.0" # The version of the app that this contains (optional)
name: shortlink-common # The name of the chart (required)
description: Shortlink common templates # A single-sentence description of this project (optional)
version: 0.2.7 # A SemVer 2 version (required)
version: 0.2.8 # A SemVer 2 version (required)
kubeVersion: ">= 1.22.0 || >= v1.22.0-0" # A SemVer range of compatible Kubernetes versions (optional)
keywords:
- shortlink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ spec:
requests:
cpu: 10m
memory: 32Mi
volumeMounts:
{{- range .Values.deploy.volumes }}
- name: {{ include "helpers.fullname" $ }}-{{ .name }}
mountPath: {{ .mountPath | quote }}
{{- end }}
{{- include "shortlink-common.volumeMounts" . | indent 6 }}
# -- Node labels and tolerations for pod assignment
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
Expand All @@ -97,17 +93,5 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- range .Values.deploy.volumes }}
- name: {{ include "helpers.fullname" $ }}-{{ .name }}
{{- if eq .type "secret" }}
secret:
secretName: {{ include "helpers.fullname" $ }}-{{ .name }}
{{- else if eq .type "emptyDir" }}
emptyDir: {}
{{- else if eq .type "configMap" }}
configMap:
name: {{ include "helpers.fullname" $ }}-{{ .name }}
{{- end }}
{{- end }}
{{- include "shortlink-common.volumes" . | indent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{/* vim: set filetype=mustache: */}}

{{- define "shortlink-common.volumeMounts" }}
volumeMounts:
{{- range .Values.deploy.volumes }}
- name: {{ include "helpers.fullname" $ }}-{{ .name }}
mountPath: {{ .mountPath | quote }}
{{- end }}
{{- end }}

{{- define "shortlink-common.volumes" }}
volumes:
{{- range .Values.deploy.volumes }}
- name: {{ include "helpers.fullname" $ }}-{{ .name }}
{{- if eq .type "secret" }}
secret:
secretName: {{ include "helpers.fullname" $ }}-{{ .name }}
{{- else if eq .type "emptyDir" }}
emptyDir: { }
{{- else if eq .type "configMap" }}
configMap:
name: {{ include "helpers.fullname" $ }}-{{ .name }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 00edf03

Please sign in to comment.