From 07098f44e3af63e31d434b0ba2e6a88a5f213482 Mon Sep 17 00:00:00 2001 From: unglaublicherdude Date: Wed, 6 Jul 2022 09:44:32 +0200 Subject: [PATCH 1/4] adds a persistant volume --- charts/gdscan/templates/_helpers.tpl | 28 +++++++++++++++++++ charts/gdscan/templates/deployment.yaml | 7 +++++ .../templates/persistent-volume-claim.yaml | 17 +++++++++++ charts/gdscan/templates/secret.yaml | 4 ++- charts/gdscan/values.yaml | 7 +++++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 charts/gdscan/templates/persistent-volume-claim.yaml 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..b3d4184 100644 --- a/charts/gdscan/templates/deployment.yaml +++ b/charts/gdscan/templates/deployment.yaml @@ -22,8 +22,15 @@ spec: spec: volumes: - name: samples + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "vaas.claimName" . }} + {{- else }} emptyDir: + {{- 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..2509ab2 100644 --- a/charts/gdscan/values.yaml +++ b/charts/gdscan/values.yaml @@ -71,3 +71,10 @@ nodeSelector: {} tolerations: [] affinity: {} + +persistence: + enabled: false + memory: false + accessModes: + - ReadWriteOnce + size: 20Gi From 4ee23f89ec4f0b133e3636bd54ebdfdb023467b3 Mon Sep 17 00:00:00 2001 From: unglaublicherdude Date: Wed, 6 Jul 2022 10:59:44 +0200 Subject: [PATCH 2/4] adds size-limit for volumes changes accessmode --- charts/gdscan/templates/deployment.yaml | 1 + charts/gdscan/values.yaml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/charts/gdscan/templates/deployment.yaml b/charts/gdscan/templates/deployment.yaml index b3d4184..c9f4cfa 100644 --- a/charts/gdscan/templates/deployment.yaml +++ b/charts/gdscan/templates/deployment.yaml @@ -27,6 +27,7 @@ spec: claimName: {{ include "vaas.claimName" . }} {{- else }} emptyDir: + sizeLimit: {{ .Values.persistence.size | quote }} {{- if .Values.persistence.memory }} medium : "Memory" {{- end }} diff --git a/charts/gdscan/values.yaml b/charts/gdscan/values.yaml index 2509ab2..fe283df 100644 --- a/charts/gdscan/values.yaml +++ b/charts/gdscan/values.yaml @@ -76,5 +76,5 @@ persistence: enabled: false memory: false accessModes: - - ReadWriteOnce - size: 20Gi + - ReadWriteMany + size: 5Gi From f94e9a8564f118feeb775550e2b4dc0975a85c12 Mon Sep 17 00:00:00 2001 From: unglaublicherdude Date: Wed, 6 Jul 2022 11:00:51 +0200 Subject: [PATCH 3/4] increase version --- charts/gdscan/Chart.yaml | 2 +- charts/myvalues.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 charts/myvalues.yaml diff --git a/charts/gdscan/Chart.yaml b/charts/gdscan/Chart.yaml index d30df41..484a921 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.2.0 appVersion: "1.0.2" 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 From 3775a45ab372dc9dabcd73d12fcc7e04cbd54bfe Mon Sep 17 00:00:00 2001 From: unglaublicherdude Date: Wed, 6 Jul 2022 11:04:23 +0200 Subject: [PATCH 4/4] also increase gh-pages versions --- charts/gdscan/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gdscan/Chart.yaml b/charts/gdscan/Chart.yaml index 484a921..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.2.0 +version: 0.1.10 appVersion: "1.0.2"