diff --git a/charts/gdscan/Chart.yaml b/charts/gdscan/Chart.yaml index d30df41..90de154 100644 --- a/charts/gdscan/Chart.yaml +++ b/charts/gdscan/Chart.yaml @@ -5,5 +5,5 @@ maintainers: - name: G DATA CyberDefense AG email: oem@gdata.de type: application -version: 0.1.9 +version: 0.1.10 appVersion: "1.0.2" diff --git a/charts/gdscan/templates/_helpers.tpl b/charts/gdscan/templates/_helpers.tpl index 04d95c8..993a912 100644 --- a/charts/gdscan/templates/_helpers.tpl +++ b/charts/gdscan/templates/_helpers.tpl @@ -50,3 +50,31 @@ app.kubernetes.io/name: {{ include "gdscan.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} + +{{- define "common.names.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- define "vaas.claimName" -}} +{{- if and .Values.persistence.existingClaim }} + {{- printf "%s" (tpl .Values.persistence.existingClaim $) -}} +{{- else -}} + {{- printf "%s" (include "common.names.fullname" .) -}} +{{- end -}} +{{- end -}} diff --git a/charts/gdscan/templates/deployment.yaml b/charts/gdscan/templates/deployment.yaml index e8cb32c..c9f4cfa 100644 --- a/charts/gdscan/templates/deployment.yaml +++ b/charts/gdscan/templates/deployment.yaml @@ -22,8 +22,16 @@ spec: spec: volumes: - name: samples + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "vaas.claimName" . }} + {{- else }} emptyDir: + sizeLimit: {{ .Values.persistence.size | quote }} + {{- if .Values.persistence.memory }} medium : "Memory" + {{- end }} + {{- end }} - name: scan-socket emptyDir: {} {{- with .Values.imagePullSecrets }} diff --git a/charts/gdscan/templates/persistent-volume-claim.yaml b/charts/gdscan/templates/persistent-volume-claim.yaml new file mode 100644 index 0000000..4da9e80 --- /dev/null +++ b/charts/gdscan/templates/persistent-volume-claim.yaml @@ -0,0 +1,17 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "gdscan.selectorLabels" . | nindent 4 }} +spec: + accessModes: + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} \ No newline at end of file diff --git a/charts/gdscan/templates/secret.yaml b/charts/gdscan/templates/secret.yaml index 11db3ef..1709c83 100644 --- a/charts/gdscan/templates/secret.yaml +++ b/charts/gdscan/templates/secret.yaml @@ -1,3 +1,4 @@ +{{- if .Values.imagePullSecrets }} apiVersion: v1 kind: Secret metadata: @@ -5,4 +6,5 @@ metadata: namespace: {{ .Release.Namespace }} data: .dockerconfigjson: {{ required "You need to set the dockerconfigjson for the private registry" .Values.secret.dockerconfigjson }} -type: kubernetes.io/dockerconfigjson \ No newline at end of file +type: kubernetes.io/dockerconfigjson +{{- end -}} \ No newline at end of file diff --git a/charts/gdscan/values.yaml b/charts/gdscan/values.yaml index e0094a3..fe283df 100644 --- a/charts/gdscan/values.yaml +++ b/charts/gdscan/values.yaml @@ -71,3 +71,10 @@ nodeSelector: {} tolerations: [] affinity: {} + +persistence: + enabled: false + memory: false + accessModes: + - ReadWriteMany + size: 5Gi diff --git a/charts/myvalues.yaml b/charts/myvalues.yaml new file mode 100644 index 0000000..9e8d64f --- /dev/null +++ b/charts/myvalues.yaml @@ -0,0 +1,4 @@ +secret: + dockerconfigjson: "ewogICAgImF1dGhzIjogewogICAgICAgICJnaGNyLmlvIjogewogICAgICAgICAgICAiYXV0aCI6ICJSMlJoZEdGSGFYUm9kV0pDYjNRNloyaHdYMHQyYmxwSldXRmpPVFoxUW5reGRHZE1jM1Z5VEVWUlUydFlia0UxTkRReWIxZHdTQT09IgogICAgICAgIH0KICAgIH0KfQ==" +persistencs: + enabled: true