Skip to content

Commit

Permalink
Merge pull request #597 from kubescape/feature/init-container
Browse files Browse the repository at this point in the history
Adding init container option to delay the start of the daemonset
  • Loading branch information
matthyx authored Jan 20, 2025
2 parents f085cc3 + 509b827 commit deab7e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions charts/kubescape-operator/templates/node-agent/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ spec:
serviceAccountName: {{ .Values.nodeAgent.name }}
automountServiceAccountToken: true
hostPID: true
{{- if .Values.nodeAgent.startupJitterContainer.enabled }}
initContainers:
- name: startup-jitter
image: "busybox:latest"
command:
- /bin/sh
- -c
- |
SLEEP_TIME=$(( $RANDOM % {{ .Values.nodeAgent.startupJitterContainer.maxStartupJitter }} ))
echo "Pod $(hostname) will sleep for $SLEEP_TIME seconds"
sleep $SLEEP_TIME
echo "Pod $(hostname) finished sleeping after $SLEEP_TIME seconds"
{{- end }}
volumes:
{{- if .Values.nodeAgent.volumes }}
{{- toYaml .Values.nodeAgent.volumes | nindent 8 }}
Expand Down
6 changes: 6 additions & 0 deletions charts/kubescape-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,12 @@ nodeAgent:

nodeSelector:
kubernetes.io/os: linux

startupJitterContainer:
enabled: false
maxStartupJitter: 60



# +++++++++++++++++++++++++++++++ ClamAV ++++++++++++++++++++++++++++++++++++++++++++++++
clamav:
Expand Down

0 comments on commit deab7e5

Please sign in to comment.