-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use grype-offline-db from kubescape quay, add cronjob
Signed-off-by: Matthias Bertschy <[email protected]>
- Loading branch information
Showing
4 changed files
with
244 additions
and
97 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
charts/kubescape-operator/templates/grype-offline-db/cronjob.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{{- if not (.Capabilities.APIVersions.Has "batch/v1") }} | ||
{{- fail "`batch/v1 not supported`" }} | ||
{{- end }} | ||
{{- if and .Values.grypeOfflineDB.enabled (eq .Values.grypeOfflineDB.image.tag "latest") }} | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ .Values.grypeOfflineDB.name }} | ||
namespace: {{ .Values.ksNamespace }} | ||
labels: | ||
{{- include "kubescape-operator.labels" (dict "Chart" .Chart "Release" .Release "Values" .Values "app" .Values.grypeOfflineDB.name "tier" .Values.global.namespaceTier) | nindent 4 }} | ||
armo.tier: "kubescape-scan" | ||
kubescape.io/tier: "core" | ||
spec: | ||
schedule: "5 0 * * *" | ||
successfulJobsHistoryLimit: 3 | ||
failedJobsHistoryLimit: 1 | ||
jobTemplate: | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "kubescape-operator.labels" (dict "Chart" .Chart "Release" .Release "Values" .Values "app" .Values.grypeOfflineDB.name "tier" .Values.global.namespaceTier) | nindent 12 }} | ||
armo.tier: "kubescape-scan" | ||
kubescape.io/tier: "core" | ||
spec: | ||
{{- if .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
- name: {{ toYaml .Values.imagePullSecrets }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Values.grypeOfflineDB.name }} | ||
image: "{{ .Values.serviceDiscovery.configMapUpdate.image.repository }}:{{ .Values.serviceDiscovery.configMapUpdate.image.tag }}" | ||
imagePullPolicy: IfNotPresent | ||
resources: | ||
{{ toYaml .Values.serviceDiscovery.resources | indent 14 }} | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
readOnlyRootFilesystem: true | ||
runAsNonRoot: true | ||
runAsUser: 100 | ||
command: ["/bin/sh", "-c"] | ||
args: | ||
- | | ||
kubectl rollout restart deployment -n {{ .Values.ksNamespace }} {{ .Values.grypeOfflineDB.name }} | ||
{{- if .Values.volumeMounts }} | ||
{{ toYaml .Values.volumeMounts | indent 14 }} | ||
{{- end }} | ||
{{- if .Values.grypeOfflineDB.volumeMounts }} | ||
{{ toYaml .Values.grypeOfflineDB.volumeMounts | indent 14 }} | ||
{{- end }} | ||
restartPolicy: Never | ||
serviceAccountName: {{ .Values.serviceDiscovery.name }} | ||
nodeSelector: | ||
{{- if .Values.grypeOfflineDB.nodeSelector }} | ||
{{- toYaml .Values.grypeOfflineDB.nodeSelector | nindent 12 }} | ||
{{- else if .Values.customScheduling.nodeSelector }} | ||
{{- toYaml .Values.customScheduling.nodeSelector | nindent 12 }} | ||
{{- end }} | ||
affinity: | ||
{{- if .Values.grypeOfflineDB.affinity }} | ||
{{- toYaml .Values.grypeOfflineDB.affinity | nindent 12 }} | ||
{{- else if .Values.customScheduling.affinity }} | ||
{{- toYaml .Values.customScheduling.affinity | nindent 12 }} | ||
{{- end }} | ||
tolerations: | ||
{{- if .Values.grypeOfflineDB.tolerations }} | ||
{{- toYaml .Values.grypeOfflineDB.tolerations | nindent 12 }} | ||
{{- else if .Values.customScheduling.tolerations }} | ||
{{- toYaml .Values.customScheduling.tolerations | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.volumes }} | ||
{{ toYaml .Values.volumes | indent 10 }} | ||
{{- end }} | ||
{{- if .Values.grypeOfflineDB.volumes }} | ||
{{ toYaml .Values.grypeOfflineDB.volumes | indent 10 }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.