2022-12-17 01:00:54 +00:00
{{- if .Values.node.enabled }}
apiVersion : apps/v1
kind : DaemonSet
metadata :
name : {{ include "falcon-sensor.fullname" . }}
labels :
app : "{{ include " falcon-sensor.name" . }}"
app.kubernetes.io/name : {{ include "falcon-sensor.name" . }}
app.kubernetes.io/instance : {{ .Release.Name }}
app.kubernetes.io/managed-by : {{ .Release.Service }}
app.kubernetes.io/component : "kernel_sensor"
crowdstrike.com/provider : crowdstrike
helm.sh/chart : {{ include "falcon-sensor.chart" . }}
{{- if .Values.node.daemonset.labels }}
{{- range $key, $value := .Values.node.daemonset.labels }}
{{ $key }} : {{ $value | quote }}
{{- end }}
{{- end }}
{{- if .Values.node.daemonset.annotations }}
annotations :
{{- range $key, $value := .Values.node.daemonset.annotations }}
{{ $key }} : {{ $value | quote }}
{{- end }}
{{- end }}
namespace : {{ .Release.Namespace }}
spec :
selector :
matchLabels :
app.kubernetes.io/name : {{ include "falcon-sensor.name" . }}
app.kubernetes.io/instance : {{ .Release.Name }}
app.kubernetes.io/component : "kernel_sensor"
crowdstrike.com/provider : crowdstrike
updateStrategy :
type : {{ .Values.node.daemonset.updateStrategy }}
{{- if and (eq .Values.node.daemonset.updateStrategy "RollingUpdate") (ne (int .Values.node.daemonset.maxUnavailable) 1) }}
rollingUpdate :
maxUnavailable : {{ .Values.node.daemonset.maxUnavailable }}
{{- end }}
template :
metadata :
annotations :
{{ .Values.node.daemonset.podAnnotationKey }} : disabled
{{- range $key, $value := .Values.node.podAnnotations }}
{{ $key }} : {{ $value | quote }}
{{- end }}
labels :
app : "{{ include " falcon-sensor.name" . }}"
app.kubernetes.io/name : {{ include "falcon-sensor.name" . }}
app.kubernetes.io/instance : {{ .Release.Name }}
app.kubernetes.io/managed-by : {{ .Release.Service }}
app.kubernetes.io/component : "kernel_sensor"
crowdstrike.com/provider : crowdstrike
helm.sh/chart : {{ include "falcon-sensor.chart" . }}
{{- if .Values.node.daemonset.labels }}
{{- range $key, $value := .Values.node.daemonset.labels }}
{{ $key }} : {{ $value | quote }}
{{- end }}
{{- end }}
spec :
{{- if and (.Values.node.image.pullSecrets) (.Values.node.image.registryConfigJSON) }}
{{- fail "node.image.pullSecrets and node.image.registryConfigJSON cannot be used together." }}
2023-10-20 22:27:12 +00:00
{{- else }}
2022-12-17 01:00:54 +00:00
{{- if or (.Values.node.image.pullSecrets) (.Values.node.image.registryConfigJSON) }}
imagePullSecrets :
{{- if .Values.node.image.pullSecrets }}
- name : {{ .Values.node.image.pullSecrets }}
{{- end }}
{{- if .Values.node.image.registryConfigJSON }}
- name : {{ include "falcon-sensor.fullname" . }}-pull-secret
{{- end }}
{{- end }}
{{- end }}
2023-10-20 22:27:12 +00:00
{{- if .Values.node.daemonset.tolerations }}
2022-12-17 01:00:54 +00:00
tolerations :
{{- with .Values.node.daemonset.tolerations }}
{{- toYaml . | nindent 6 }}
{{- end }}
2023-10-20 22:27:12 +00:00
{{- end }}
2022-12-17 01:00:54 +00:00
nodeSelector :
kubernetes.io/os : linux
{{- if .Values.node.daemonset.nodeAffinity }}
affinity :
nodeAffinity :
{{- with .Values.node.daemonset.nodeAffinity }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
initContainers :
# This init container creates empty falconstore file so that when
# it's mounted into the sensor-node-container, k8s would just use it
# rather than creating a directory. Mounting falconstore file as
# a file volume ensures that AID is preserved across container
2023-04-11 13:41:46 +00:00
# restarts. Sensor versions 6.54+ have a helper binary to initialize falconstore.
2022-12-17 01:00:54 +00:00
- name : init-falconstore
image : "{{ include " falcon-sensor.image" . }}"
imagePullPolicy : "{{ .Values.node.image.pullPolicy }}"
2023-10-20 22:27:12 +00:00
command :
- /bin/bash
{{- if .Values.node.gke.autopilot }}
args :
- '-c'
- >-
echo "Running /opt/CrowdStrike/falcon-daemonset-init -i";
/opt/CrowdStrike/falcon-daemonset-init -i
{{- else }}
2023-04-11 13:41:46 +00:00
args : [ '-c' , 'if [ -x "/opt/CrowdStrike/falcon-daemonset-init" ]; then echo "Running falcon-daemonset-init -i" ; /opt/CrowdStrike/falcon-daemonset-init -i ; else if [ -d "/host_opt/CrowdStrike/falconstore" ] ; then echo "Re-creating /opt/CrowdStrike/falconstore as it is a directory instead of a file"; rm -rf /host_opt/CrowdStrike/falconstore; fi; mkdir -p /host_opt/CrowdStrike && touch /host_opt/CrowdStrike/falconstore; fi' ]
2022-12-17 01:00:54 +00:00
volumeMounts :
- name : falconstore-dir
2023-04-11 13:41:46 +00:00
mountPath : /host_opt
2023-10-20 22:27:12 +00:00
{{- end }}
2023-10-31 13:41:58 +00:00
resources :
requests :
cpu : 10m
ephemeral-storage : 10Mi
memory : 50Mi
limits :
cpu : 10m
ephemeral-storage : 10Mi
memory : 50Mi
2022-12-17 01:00:54 +00:00
securityContext :
runAsUser : 0
privileged : true
allowPrivilegeEscalation : true
2023-10-20 22:27:12 +00:00
{{- if .Values.node.gke.autopilot }}
readOnlyRootFilesystem : true
capabilities :
add :
- SYS_ADMIN
- SYS_PTRACE
- SYS_CHROOT
- DAC_READ_SEARCH
{{- else }}
readOnlyRootFilesystem : false
{{- end }}
2022-12-17 01:00:54 +00:00
containers :
- name : falcon-node-sensor
image : "{{ include " falcon-sensor.image" . }}"
imagePullPolicy : "{{ .Values.node.image.pullPolicy }}"
# Various pod security context settings. Bear in mind that many of these have an impact
# on the Falcon Sensor working correctly.
#
# - User that the container will execute as. Typically necessary to run as root (0).
# - Runs the Falcon Sensor containers as privileged containers. This is required when
# running the Falcon Linux Sensor on Kubernetes nodes to properly run in the node's
# kernel and to actually protect the node.
securityContext :
runAsUser : 0
privileged : true
readOnlyRootFilesystem : false
allowPrivilegeEscalation : true
2023-10-20 22:27:12 +00:00
{{- if .Values.node.gke.autopilot }}
capabilities :
add :
- SYS_ADMIN
- SETGID
- SETUID
- SYS_PTRACE
- SYS_CHROOT
- DAC_OVERRIDE
- SETPCAP
- DAC_READ_SEARCH
- BPF
- PERFMON
- SYS_RESOURCE
- NET_RAW
- CHOWN
{{- end }}
{{- if (eq .Values.node.backend "bpf") }}
{{- include "falcon-sensor.daemonsetResources" . | nindent 8 }}
{{- end }}
2022-12-17 01:00:54 +00:00
envFrom :
- configMapRef :
name : {{ include "falcon-sensor.fullname" . }}-config
volumeMounts :
- name : falconstore
mountPath : /opt/CrowdStrike/falconstore
volumes :
2023-10-20 22:27:12 +00:00
{{- if not .Values.node.gke.autopilot }}
2022-12-17 01:00:54 +00:00
- name : falconstore-dir
hostPath :
path : /opt
type : DirectoryOrCreate
2023-10-20 22:27:12 +00:00
{{- end }}
2022-12-17 01:00:54 +00:00
- name : falconstore
hostPath :
path : /opt/CrowdStrike/falconstore
serviceAccountName : {{ .Values.serviceAccount.name }}
terminationGracePeriodSeconds : {{ .Values.node.terminationGracePeriod }}
2023-10-20 22:27:12 +00:00
{{- if or .Values.node.daemonset.priorityClassName .Values.node.gke.autopilot }}
priorityClassName : {{ include "falcon-sensor.priorityClassName" . }}
2022-12-17 01:00:54 +00:00
{{- end }}
hostNetwork : true
hostPID : true
hostIPC : true
{{- end }}