Skip to content

Commit 47d0120

Browse files
authored
Merge pull request #484 from EndPositive/maintanance/helmchart-values-consistency-hooks
Refactor hook HelmCharts to introduce consistency in HelmChart Values
2 parents 0b102d6 + ec2756f commit 47d0120

28 files changed

Lines changed: 156 additions & 135 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -613,13 +613,13 @@ jobs:
613613
- name: "Hooks (ReadAndWrite) Integration Tests"
614614
run: |
615615
helm -n integration-tests install update-category ./hooks/update-field/ \
616-
--set="image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-update-field" \
617-
--set="image.tag=sha-$(git rev-parse --short HEAD)" \
616+
--set="hook.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-update-field" \
617+
--set="hook.image.tag=sha-$(git rev-parse --short HEAD)" \
618618
--set="attribute.name=category" \
619619
--set="attribute.value=fancy-category"
620620
helm -n integration-tests install update-severity ./hooks/update-field/ \
621-
--set="image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-update-field" \
622-
--set="image.tag=sha-$(git rev-parse --short HEAD)" \
621+
--set="hook.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-update-field" \
622+
--set="hook.image.tag=sha-$(git rev-parse --short HEAD)" \
623623
--set="attribute.name=severity" \
624624
--set="attribute.value=high"
625625
helm -n integration-tests install test-scan ./scanners/test-scan/ \
@@ -642,9 +642,9 @@ jobs:
642642
--set="scanner.image.tag=sha-$(git rev-parse --short HEAD)"
643643
helm -n integration-tests install http-webhook ./demo-apps/http-webhook
644644
helm -n integration-tests install ro-hook ./hooks/generic-webhook/ \
645-
--set="image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-generic-webhook" \
645+
--set="hook.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-generic-webhook" \
646646
--set="webhookUrl=http://http-webhook/hallo-welt" \
647-
--set="image.tag=sha-$(git rev-parse --short HEAD)"
647+
--set="hook.image.tag=sha-$(git rev-parse --short HEAD)"
648648
cd tests/integration/
649649
npx jest --ci --color generic/read-only-hook.test.js
650650
helm -n integration-tests uninstall test-scan http-webhook ro-hook
@@ -772,8 +772,8 @@ jobs:
772772
helm -n integration-tests install http-webhook ./demo-apps/http-webhook --wait
773773
774774
helm -n integration-tests install notification-hook ./hooks/notification --values tests/integration/hooks/__testFiles__/notification-values.yaml \
775-
--set="image.repository=docker.io/${{env.DOCKER_NAMESPACE }}/hook-notification" \
776-
--set="image.tag=sha-$(git rev-parse --short HEAD)"
775+
--set="hook.image.repository=docker.io/${{env.DOCKER_NAMESPACE }}/hook-notification" \
776+
--set="hook.image.tag=sha-$(git rev-parse --short HEAD)"
777777
778778
cd tests/integration/
779779
npx jest --ci --color ./hooks/notification.test.js
@@ -848,8 +848,8 @@ jobs:
848848
kubectl create namespace cascading-tests
849849
# Install cascading-scans hook
850850
helm upgrade --install dssh ./hooks/cascading-scans/ -n cascading-tests \
851-
--set="image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-cascading-scans" \
852-
--set="image.tag=sha-$(git rev-parse --short HEAD)"
851+
--set="hook.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-cascading-scans" \
852+
--set="hook.image.tag=sha-$(git rev-parse --short HEAD)"
853853
# Install nmap
854854
helm -n cascading-tests install nmap ./scanners/nmap/ \
855855
--set="scanner.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/scanner-nmap" \
@@ -891,8 +891,8 @@ jobs:
891891
kubectl create namespace cascading-tests
892892
# Install cascading-scans hook
893893
helm upgrade --install dssh ./hooks/cascading-scans/ -n cascading-tests --wait \
894-
--set="image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-cascading-scans" \
895-
--set="image.tag=sha-$(git rev-parse --short HEAD)"
894+
--set="hook.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/hook-cascading-scans" \
895+
--set="hook.image.tag=sha-$(git rev-parse --short HEAD)"
896896
# Install unsafe-https
897897
helm upgrade --install unsafe-https ./demo-apps/unsafe-https/ -n cascading-tests --wait
898898
# Install nmap

hooks/cascading-scans/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,6 @@ zap-http zap-baseline-scan non-invasive medium
119119

120120
| Key | Type | Default | Description |
121121
|-----|------|---------|-------------|
122-
| hookJob.ttlSecondsAfterFinished | string | `nil` | Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/ |
123-
| image.repository | string | `"docker.io/securecodebox/hook-cascading-scans"` | Hook image repository |
124-
| image.tag | string | defaults to the charts version | The image Tag defaults to the charts version if not defined. |
122+
| hook.image.repository | string | `"docker.io/securecodebox/hook-cascading-scans"` | Hook image repository |
123+
| hook.image.tag | string | defaults to the charts version | The image Tag defaults to the charts version if not defined. |
124+
| hook.ttlSecondsAfterFinished | string | `nil` | Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/ |

hooks/cascading-scans/templates/cascading-scans-hook.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ metadata:
1010
{{- include "cascading-scans.labels" . | nindent 4 }}
1111
spec:
1212
type: ReadOnly
13-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.Version }}"
13+
image: "{{ .Values.hook.image.repository }}:{{ .Values.hook.image.tag | default .Chart.Version }}"
1414
imagePullSecrets:
1515
- name: "securecodebox"
16-
ttlSecondsAfterFinished: {{ .Values.hookJob.ttlSecondsAfterFinished }}
16+
ttlSecondsAfterFinished: {{ .Values.hook.ttlSecondsAfterFinished }}
1717
serviceAccountName: cascading-scans

hooks/cascading-scans/values.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# This is a YAML-formatted file.
77
# Declare variables to be passed into your templates.
88

9-
image:
10-
# image.repository -- Hook image repository
11-
repository: docker.io/securecodebox/hook-cascading-scans
12-
# image.tag -- The image Tag defaults to the charts version if not defined.
13-
# @default -- defaults to the charts version
14-
tag: null
9+
hook:
10+
image:
11+
# hook.image.repository -- Hook image repository
12+
repository: docker.io/securecodebox/hook-cascading-scans
13+
# hook.image.tag -- The image Tag defaults to the charts version if not defined.
14+
# @default -- defaults to the charts version
15+
tag: null
1516

16-
hookJob:
17-
# hookJob.ttlSecondsAfterFinished -- Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/
17+
# hook.ttlSecondsAfterFinished -- Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/
1818
ttlSecondsAfterFinished: null

hooks/finding-post-processing/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The `override` field specifies the desired fields and values that need to be upd
5454

5555
| Key | Type | Default | Description |
5656
|-----|------|---------|-------------|
57-
| hookJob.ttlSecondsAfterFinished | string | `nil` | Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/ |
58-
| image.repository | string | `"docker.io/securecodebox/hook-finding-post-processing"` | Hook image repository |
59-
| image.tag | string | defaults to the charts version | The image Tag defaults to the charts version if not defined. |
57+
| hook.image.repository | string | `"docker.io/securecodebox/hook-finding-post-processing"` | Hook image repository |
58+
| hook.image.tag | string | defaults to the charts version | The image Tag defaults to the charts version if not defined. |
59+
| hook.ttlSecondsAfterFinished | string | `nil` | Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/ |
6060
| rules | list | `[]` | |

hooks/finding-post-processing/templates/finding-post-processing-hook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
{{- include "finding-post-processing.labels" . | nindent 4 }}
1111
spec:
1212
type: ReadAndWrite
13-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.Version }}"
13+
image: "{{ .Values.hook.image.repository }}:{{ .Values.hook.image.tag | default .Chart.Version }}"
1414
env:
1515
- name: RULES
1616
value: {{ .Values.rules | toJson | quote }}

hooks/finding-post-processing/values.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,8 @@
66
# This is a YAML-formatted file.
77
# Declare variables to be passed into your templates.
88

9-
image:
10-
# image.repository -- Hook image repository
11-
repository: docker.io/securecodebox/hook-finding-post-processing
12-
# image.tag -- The image Tag defaults to the charts version if not defined.
13-
# @default -- defaults to the charts version
14-
tag: null
15-
16-
rules: []
9+
rules:
10+
[]
1711
#- matches:
1812
# anyOf:
1913
# - category: "Open Port"
@@ -28,6 +22,13 @@ rules: []
2822
# severity: "high"
2923
# description: "Telnet is bad"
3024

31-
hookJob:
32-
# hookJob.ttlSecondsAfterFinished -- Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/
25+
hook:
26+
image:
27+
# hook.image.repository -- Hook image repository
28+
repository: docker.io/securecodebox/hook-finding-post-processing
29+
# hook.image.tag -- The image Tag defaults to the charts version if not defined.
30+
# @default -- defaults to the charts version
31+
tag: null
32+
33+
# hook.ttlSecondsAfterFinished -- Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/
3334
ttlSecondsAfterFinished: null

hooks/generic-webhook/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ helm upgrade --install gwh secureCodeBox/generic-webhook --set webhookUrl="http:
2121

2222
| Key | Type | Default | Description |
2323
|-----|------|---------|-------------|
24-
| hookJob.ttlSecondsAfterFinished | string | `nil` | Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/ |
25-
| image.repository | string | `"docker.io/securecodebox/hook-generic-webhook"` | Hook image repository |
26-
| image.tag | string | defaults to the charts version | The image Tag defaults to the charts version if not defined. |
24+
| hook.image.repository | string | `"docker.io/securecodebox/hook-generic-webhook"` | Hook image repository |
25+
| hook.image.tag | string | defaults to the charts version | The image Tag defaults to the charts version if not defined. |
26+
| hook.ttlSecondsAfterFinished | string | `nil` | Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/ |
2727
| webhookUrl | string | `"http://example.com"` | The URL of your WebHook endpoint |

hooks/generic-webhook/templates/webhook-hook.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ metadata:
1010
{{- include "generic-webhook.labels" . | nindent 4 }}
1111
spec:
1212
type: ReadOnly
13-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.Version }}"
14-
ttlSecondsAfterFinished: {{ .Values.hookJob.ttlSecondsAfterFinished }}
13+
image: "{{ .Values.hook.image.repository }}:{{ .Values.hook.image.tag | default .Chart.Version }}"
14+
ttlSecondsAfterFinished: {{ .Values.hook.ttlSecondsAfterFinished }}
1515
env:
1616
- name: WEBHOOK_URL
1717
value: {{ .Values.webhookUrl | quote }}

hooks/generic-webhook/values.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
# webhookUrl -- The URL of your WebHook endpoint
1010
webhookUrl: "http://example.com"
1111

12-
image:
13-
# image.repository -- Hook image repository
14-
repository: docker.io/securecodebox/hook-generic-webhook
15-
# image.tag -- The image Tag defaults to the charts version if not defined.
16-
# @default -- defaults to the charts version
17-
tag: null
12+
hook:
13+
image:
14+
# hook.image.repository -- Hook image repository
15+
repository: docker.io/securecodebox/hook-generic-webhook
16+
# hook.image.tag -- The image Tag defaults to the charts version if not defined.
17+
# @default -- defaults to the charts version
18+
tag: null
1819

19-
hookJob:
20-
# hookJob.ttlSecondsAfterFinished -- Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/
20+
# hook.ttlSecondsAfterFinished -- Seconds after which the kubernetes job for the hook will be deleted. Requires the Kubernetes TTLAfterFinished controller: https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/
2121
ttlSecondsAfterFinished: null

0 commit comments

Comments
 (0)