Skip to content

Commit

Permalink
Merge pull request #134 from gimlet-io/existing-secret-as-volume
Browse files Browse the repository at this point in the history
Support existing secret as volume
  • Loading branch information
laszlocph authored Jun 21, 2024
2 parents 3c6f666 + bf8c6b8 commit dd997da
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 11 deletions.
2 changes: 1 addition & 1 deletion charts/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ type: library
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.5.1
version: 0.6.0
3 changes: 3 additions & 0 deletions charts/common/templates/_volumesRef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ volumes:
{{- else if .existingConfigMap }}
configMap:
name: {{ .existingConfigMap }}
{{- else if .existingSecret }}
secret:
secretName: {{ .existingSecret }}
{{- else if .fileName }}
configMap:
name: {{ template "common.robustName" (printf "%s-%s" $.Release.Name .name) }}
Expand Down
6 changes: 3 additions & 3 deletions charts/cron-job/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: file://../common
version: 0.5.1
digest: sha256:ca23e74d63ca4339e8720d1af3709107d1d5831c5f9e78d9ae88107a2590c826
generated: "2024-02-01T13:22:33.441381+01:00"
version: 0.6.0
digest: sha256:b3a62bdb9852049c98123eeb95e79ceb12aaab1aab1a0e2f2d8437aa6d1a9e90
generated: "2024-06-21T08:14:31.489421+02:00"
2 changes: 1 addition & 1 deletion charts/cron-job/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ version: 0.69.0

dependencies:
- name: common
version: 0.5.1
version: 0.6.0
repository: file://../common
Binary file removed charts/cron-job/charts/common-0.5.1.tgz
Binary file not shown.
Binary file added charts/cron-job/charts/common-0.6.0.tgz
Binary file not shown.
6 changes: 3 additions & 3 deletions charts/onechart/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: file://../common
version: 0.5.1
digest: sha256:ca23e74d63ca4339e8720d1af3709107d1d5831c5f9e78d9ae88107a2590c826
generated: "2024-02-01T13:22:32.899733+01:00"
version: 0.6.0
digest: sha256:b3a62bdb9852049c98123eeb95e79ceb12aaab1aab1a0e2f2d8437aa6d1a9e90
generated: "2024-06-21T08:03:57.319388+02:00"
2 changes: 1 addition & 1 deletion charts/onechart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ version: 0.69.0

dependencies:
- name: common
version: 0.5.1
version: 0.6.0
repository: file://../common
Binary file removed charts/onechart/charts/common-0.5.1.tgz
Binary file not shown.
Binary file added charts/onechart/charts/common-0.6.0.tgz
Binary file not shown.
20 changes: 18 additions & 2 deletions charts/onechart/tests/deployment_volumes_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,30 @@ tests:
- name: volume-name
configMap:
name: my-configmap
- it: Should use an existing secret as volume
set:
volumes:
- existingSecret: my-secret
name: volume-name
path: /randomPath/app.creds
subPath: app.creds
asserts:
- template: deployment.yaml
documentIndex: 0
equal:
path: spec.template.spec.volumes
value:
- name: volume-name
secret:
secretName: my-secret
- template: deployment.yaml
documentIndex: 0
equal:
path: spec.template.spec.containers[0].volumeMounts
value:
- name: volume-name
mountPath: /randomPath/app.conf
subPath: app.conf
mountPath: /randomPath/app.creds
subPath: app.creds
- it: Should use a configmap with custom value
set:
volumes:
Expand Down
29 changes: 29 additions & 0 deletions charts/onechart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,35 @@
"fileContent",
"path"
]
},
{
"id": "#/properties/volumes/oneOf/6",
"title": "Mount an existing secret as a file",
"type": "object",
"properties": {
"existingSecret": {
"type": "string",
"title": "Name",
"description": "The name of the secret to mount",
"default": "data"
},
"path": {
"type": "string",
"title": "Path",
"description": "The mount path inside the container",
"default": "/data/dummy.conf"
},
"subPath": {
"type": "string",
"title": "subPath",
"description": "Mount single file",
"default": "dummy.conf"
}
},
"required": [
"existingSecret",
"path"
]
}
]
}
Expand Down
Binary file added common-0.6.0.tgz
Binary file not shown.
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ volumes:
- name: empty
path: /deleteme2
emptyDir: true
- existingSecret: my-secret
name: volume-name
path: /randomPath/app.creds
subPath: app.creds

vars:
var1: value1
Expand Down

0 comments on commit dd997da

Please sign in to comment.