Skip to content

Commit

Permalink
Merge pull request #8 from GitGuardian/ctourriere/-/fix_cronjob_naming
Browse files Browse the repository at this point in the history
fix(cronjob): Fix cronjob naming
  • Loading branch information
FlorianPerucki authored Jan 13, 2025
2 parents 3ef604f + 17251ab commit 6762d41
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/nhi-scout/templates/_cronjob.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .cronjob_name }}-{{ include "nhi-scout.fullname" . }}
name: {{ include "nhi-scout.fullname" . }}-{{ .cronjob_name }}
labels:
{{- include "nhi-scout.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion charts/nhi-scout/templates/cronjob_inventory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
{{ $command = "fetch-and-send" -}}
{{- end }}

{{ include "nhi-scout.cronjob" (merge . (dict "cronjob_name" "inventory" "command" $command) ) }}
{{ include "nhi-scout.cronjob" (merge (dict "cronjob_name" "inventory" "command" $command) .) -}}
6 changes: 3 additions & 3 deletions charts/nhi-scout/templates/cronjob_sync.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ if .Values.inventory.config.gitguardian }}
{{ include "nhi-scout.cronjob" (merge . (dict "cronjob_name" "sync" "command" "sync-secrets") ) }}
{{ end }}
{{- if .Values.inventory.sync }}
{{ include "nhi-scout.cronjob" (merge (dict "cronjob_name" "sync" "command" "sync-secrets") .) -}}
{{- end }}
1 change: 1 addition & 0 deletions charts/nhi-scout/test_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# yaml-language-server: $schema=values.schema.json

inventory:
sync: false
config:
sources: {}
gitguardian: null
Expand Down
1 change: 0 additions & 1 deletion charts/nhi-scout/tests/base_cronjob_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ values:
- ../test_values.yaml
templates:
- cronjob_inventory.yaml
- cronjob_sync.yaml
set:
inventory.config.gitguardian.api_token: "foobar"
inventory.config.gitguardian.endpoint: "https://some-url.com"
Expand Down
2 changes: 1 addition & 1 deletion charts/nhi-scout/tests/inventory_cronjob_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tests:
of: CronJob
- matchRegex:
path: metadata.name
pattern: inventory-.*-nhi-scout$
pattern: .*-nhi-scout-inventory$

- it: should use the gitguardian command if set
set:
Expand Down
3 changes: 2 additions & 1 deletion charts/nhi-scout/tests/sync_cronjob_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ values:
templates:
- cronjob_sync.yaml
set:
inventory.sync: true
inventory.config.gitguardian.api_token: "foobar"
inventory.config.gitguardian.endpoint: "https://some-url.com"
tests:
Expand All @@ -17,7 +18,7 @@ tests:
of: CronJob
- matchRegex:
path: metadata.name
pattern: sync-.*-nhi-scout$
pattern: .*-nhi-scout-sync$

- it: should use the gitguardian command if set
asserts:
Expand Down

0 comments on commit 6762d41

Please sign in to comment.