Skip to content

Commit

Permalink
Adding init container option to delay the start of the daemonset
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Schendel <[email protected]>
  • Loading branch information
amitschendel committed Jan 19, 2025
1 parent f085cc3 commit 5f1f9fd
Show file tree
Hide file tree
Showing 2 changed files with 15 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.initContainer }}
initContainers:
- name: init-delay
image: "busybox:latest"
command:
- /bin/sh
- -c
- |
SLEEP_TIME=$(( $RANDOM % 120 ))
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
2 changes: 2 additions & 0 deletions charts/kubescape-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ nodeAgent:

nodeSelector:
kubernetes.io/os: linux

initContainer: false

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

0 comments on commit 5f1f9fd

Please sign in to comment.