Skip to content

Commit

Permalink
feat(kargo): new template to generate a cronjob to inspect volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbourianes-kalisio committed Aug 22, 2024
1 parent 497e6e6 commit 9c489b9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added a new template in the `kargo` chart to generate a suspended cronjob allowing to inspect volumes: `kargo.volume-inspector-cronjob`.
- Added new `trakkar` chart to deploy [traccar](https://www.traccar.org/) <-> kano gateway.

### Changed
Expand Down
43 changes: 43 additions & 0 deletions charts/kargo/templates/_volume-inspector-cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{/*
Builds a suspended cronjob to inspect k8s volumes.
@param .context The caller's context
@param .args The parameters for the inspector. The template expects the following:
- name The name to give to the cronjob
- volumeMounts The list of volumeMounts for the container
- volumes The list of volumes to back volumeMounts
- image An object defining the image to pull, cf. kargo.images.image template
*/}}
{{- define "kargo.volume-inspector-cronjob" -}}
apiVersion: {{ .context.Capabilities.APIVersions.Has "batch/v1" | ternary "batch/v1" "batch/v1beta1" }}
kind: CronJob
metadata:
name: {{ .args.name }}
namespace: {{ .context.Release.Namespace | quote }}
spec:
suspend: true
schedule: "0 0 * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
ttlSecondsAfterFinished: 3600
template:
spec:
{{- include "kargo.images.pullSecrets" (dict "images" (list .args.image) "context" .context) | indent 10 }}
containers:
- name: {{ .args.name }}
image: {{ include "kargo.images.image" ( dict "imageRoot" .args.image "global" .context ) }}
command:
- /bin/sh
args:
- -c
- while true; do sleep 30; done
{{- if .args.volumeMounts }}
volumeMounts:
{{- include "kargo.tplvalues.render" ( dict "value" .args.volumeMounts "context" .context ) | nindent 14 }}
{{- end }}
restartPolicy: Never
{{- if .args.volumes }}
volumes:
{{- include "kargo.tplvalues.render" ( dict "value" .args.volumes "context" .context ) | nindent 10 }}
{{- end }}
{{- end -}}

0 comments on commit 9c489b9

Please sign in to comment.