Skip to content

Commit

Permalink
Merge pull request #39 from sergeysedoy97/feature/shared-pvc
Browse files Browse the repository at this point in the history
feat: add volume.shared
  • Loading branch information
LukasGentele authored Jun 2, 2021
2 parents 2802d72 + d8c5e1a commit 0f5bd14
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
8 changes: 8 additions & 0 deletions docs/pages/configuration/containers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ The `volume.readOnly` option expects a boolean which defines if the volume shoul
readOnly: false
```

### `volume.shared`
The `volume.shared` option expects a boolean which defines if the volume should be shared between pods.

#### Default for `volume.shared`
```yaml
shared: false
```

## `resources`
The `resources` section of a container allows you to configure resource restrictions for this container.

Expand Down
4 changes: 2 additions & 2 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ spec:
{{- $isVolumeOfThisComponent := false }}
{{- range $containerIndex, $container := $.Values.containers }}
{{- range $volumeMountIndex, $volumeMount := $container.volumeMounts }}
{{- if or $volumeMount.volume.readOnly $volume.secret $volume.configMap }}
{{- if or $volumeMount.volume.readOnly $volumeMount.volume.shared $volume.secret $volume.configMap }}
{{- if eq $volume.name $volumeMount.volume.name }}
{{- $isVolumeOfThisComponent = true }}
{{- end }}
Expand Down Expand Up @@ -454,7 +454,7 @@ spec:
{{- $isVolumeTemplateOfThisComponent := false }}
{{- range $containerIndex, $container := $.Values.containers }}
{{- range $volumeMountIndex, $volumeMount := $container.volumeMounts }}
{{- if $volumeMount.volume.readOnly }}
{{- if or $volumeMount.volume.readOnly $volumeMount.volume.shared }}
{{- else }}
{{- if eq $volume.name $volumeMount.volume.name }}
{{- $isVolumeTemplateOfThisComponent = true }}
Expand Down
25 changes: 19 additions & 6 deletions templates/volumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{- $createVolume := false }}
{{- range $containerIndex, $container := $.Values.containers }}
{{- range $volumeMountIndex, $volumeMount := $container.volumeMounts }}
{{- if $volumeMount.volume.readOnly }}
{{- if or $volumeMount.volume.readOnly $volumeMount.volume.shared }}
{{- if eq $volume.name $volumeMount.volume.name }}
{{- $createVolume = true }}
{{- end }}
Expand All @@ -20,21 +20,34 @@ metadata:
"app.kubernetes.io/name": "devspace-app"
"app.kubernetes.io/component": {{ $.Release.Name | quote }}
"app.kubernetes.io/managed-by": {{ $.Release.Service | quote }}
{{- if $volume.labels }}
{{- range $labelName, $labelValue := $volume.labels }}
{{ $labelName | quote }}: {{ $labelValue | quote }}
{{- end }}
{{- end }}
annotations:
"helm.sh/chart": "{{ $.Chart.Name }}-{{ $.Chart.Version }}"
{{- if $volume.annotations }}
{{- range $annotationName, $annotationValue := $volume.annotations }}
{{ $annotationName | quote }}: {{ $annotationValue | quote }}
{{- end }}
{{- end }}
spec:
{{- if $volume.storageClassName }}
storageClassName: {{ $volume.storageClassName }}
{{- end }}
{{- if $volume.volumeMode }}
volumeMode: {{ $volume.volumeMode }}
{{- end }}
{{- if $volume.volumeName }}
volumeName: {{ $volume.volumeName }}
{{- end }}
{{- if $volume.dataSource }}
dataSource:
{{ toYaml $volume.dataSource | indent 4 }}
{{- end }}
accessModes:
- ReadWriteOnce
{{- if $volume.accessModes }}
{{ toYaml $volume.accessModes | indent 4 }}
{{- else }}
- ReadWriteOnce
{{- end }}
resources:
requests:
storage: {{ $volume.size | quote }}
Expand Down

0 comments on commit 0f5bd14

Please sign in to comment.