Add falco chart
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
{{- if eq .Values.controller.kind "daemonset" }}
|
||||
Falco agents are spinning up on each node in your cluster. After a few
|
||||
seconds, they are going to start monitoring your containers looking for
|
||||
security issues.
|
||||
{{printf "\n" }}
|
||||
{{- end}}
|
||||
{{- if .Values.integrations }}
|
||||
WARNING: The following integrations have been deprecated and removed
|
||||
- gcscc
|
||||
- natsOutput
|
||||
- snsOutput
|
||||
- pubsubOutput
|
||||
Consider to use falcosidekick (https://github.com/falcosecurity/falcosidekick) as replacement.
|
||||
{{- else }}
|
||||
No further action should be required.
|
||||
{{- end }}
|
||||
{{printf "\n" }}
|
||||
|
||||
{{- if not .Values.falcosidekick.enabled }}
|
||||
Tip:
|
||||
You can easily forward Falco events to Slack, Kafka, AWS Lambda and more with falcosidekick.
|
||||
Full list of outputs: https://github.com/falcosecurity/charts/tree/master/charts/falcosidekick.
|
||||
You can enable its deployment with `--set falcosidekick.enabled=true` or in your values.yaml.
|
||||
See: https://github.com/falcosecurity/charts/blob/master/charts/falcosidekick/values.yaml for configuration values.
|
||||
|
||||
{{- end}}
|
||||
|
||||
|
||||
{{- if (has .Values.driver.kind (list "module" "modern-bpf")) -}}
|
||||
{{- println }}
|
||||
WARNING(drivers):
|
||||
{{- printf "\nThe driver kind: \"%s\" is an alias and might be removed in the future.\n" .Values.driver.kind -}}
|
||||
{{- $driver := "" -}}
|
||||
{{- if eq .Values.driver.kind "module" -}}
|
||||
{{- $driver = "kmod" -}}
|
||||
{{- else if eq .Values.driver.kind "modern-bpf" -}}
|
||||
{{- $driver = "modern_ebpf" -}}
|
||||
{{- end -}}
|
||||
{{- printf "Please use \"%s\" instead." $driver}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and (not (empty .Values.falco.load_plugins)) (or .Values.falcoctl.artifact.follow.enabled .Values.falcoctl.artifact.install.enabled) }}
|
||||
|
||||
WARNING:
|
||||
{{ printf "It seems you are loading the following plugins %v, please make sure to install them by adding the correct reference to falcoctl.config.artifact.install.refs: %v" .Values.falco.load_plugins .Values.falcoctl.config.artifact.install.refs -}}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,411 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "falco.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "falco.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "falco.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Allow the release namespace to be overridden
|
||||
*/}}
|
||||
{{- define "falco.namespace" -}}
|
||||
{{- default .Release.Namespace .Values.namespaceOverride -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "falco.labels" -}}
|
||||
helm.sh/chart: {{ include "falco.chart" . }}
|
||||
{{ include "falco.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "falco.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "falco.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Renders a value that contains template.
|
||||
Usage:
|
||||
{{ include "falco.renderTemplate" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||
*/}}
|
||||
{{- define "falco.renderTemplate" -}}
|
||||
{{- if typeIs "string" .value }}
|
||||
{{- tpl .value .context }}
|
||||
{{- else }}
|
||||
{{- tpl (.value | toYaml) .context }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "falco.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "falco.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Return the proper Falco image name
|
||||
*/}}
|
||||
{{- define "falco.image" -}}
|
||||
{{- with .Values.image.registry -}}
|
||||
{{- . }}/
|
||||
{{- end -}}
|
||||
{{- .Values.image.repository }}:
|
||||
{{- .Values.image.tag | default .Chart.AppVersion -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Falco driver loader image name
|
||||
*/}}
|
||||
{{- define "falco.driverLoader.image" -}}
|
||||
{{- with .Values.driver.loader.initContainer.image.registry -}}
|
||||
{{- . }}/
|
||||
{{- end -}}
|
||||
{{- .Values.driver.loader.initContainer.image.repository }}:
|
||||
{{- .Values.driver.loader.initContainer.image.tag | default .Chart.AppVersion -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Falcoctl image name
|
||||
*/}}
|
||||
{{- define "falcoctl.image" -}}
|
||||
{{ printf "%s/%s:%s" .Values.falcoctl.image.registry .Values.falcoctl.image.repository .Values.falcoctl.image.tag }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Extract the unixSocket's directory path
|
||||
*/}}
|
||||
{{- define "falco.unixSocketDir" -}}
|
||||
{{- if and .Values.falco.grpc.enabled .Values.falco.grpc.bind_address (hasPrefix "unix://" .Values.falco.grpc.bind_address) -}}
|
||||
{{- .Values.falco.grpc.bind_address | trimPrefix "unix://" | dir -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for rbac.
|
||||
*/}}
|
||||
{{- define "rbac.apiVersion" -}}
|
||||
{{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }}
|
||||
{{- print "rbac.authorization.k8s.io/v1" -}}
|
||||
{{- else -}}
|
||||
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Build http url for falcosidekick.
|
||||
*/}}
|
||||
{{- define "falcosidekick.url" -}}
|
||||
{{- if not .Values.falco.http_output.url -}}
|
||||
{{- $falcoName := include "falco.fullname" . -}}
|
||||
{{- $listenPort := .Values.falcosidekick.listenport | default "2801" -}}
|
||||
{{- if .Values.falcosidekick.fullfqdn -}}
|
||||
{{- printf "http://%s-falcosidekick.%s.svc.cluster.local:%s" $falcoName .Release.Namespace $listenPort -}}
|
||||
{{- else -}}
|
||||
{{- printf "http://%s-falcosidekick:%s" $falcoName $listenPort -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Values.falco.http_output.url -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Set appropriate falco configuration if falcosidekick has been configured.
|
||||
*/}}
|
||||
{{- define "falco.falcosidekickConfig" -}}
|
||||
{{- if .Values.falcosidekick.enabled -}}
|
||||
{{- $_ := set .Values.falco "json_output" true -}}
|
||||
{{- $_ := set .Values.falco "json_include_output_property" true -}}
|
||||
{{- $_ := set .Values.falco.http_output "enabled" true -}}
|
||||
{{- $_ := set .Values.falco.http_output "url" (include "falcosidekick.url" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get port from .Values.falco.grpc.bind_addres.
|
||||
*/}}
|
||||
{{- define "grpc.port" -}}
|
||||
{{- $error := "unable to extract listenPort from .Values.falco.grpc.bind_address. Make sure it is in the correct format" -}}
|
||||
{{- if and .Values.falco.grpc.enabled .Values.falco.grpc.bind_address (not (hasPrefix "unix://" .Values.falco.grpc.bind_address)) -}}
|
||||
{{- $tokens := split ":" .Values.falco.grpc.bind_address -}}
|
||||
{{- if $tokens._1 -}}
|
||||
{{- $tokens._1 -}}
|
||||
{{- else -}}
|
||||
{{- fail $error -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- fail $error -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Disable the syscall source if some conditions are met.
|
||||
By default the syscall source is always enabled in falco. If no syscall source is enabled, falco
|
||||
exits. Here we check that no producers for syscalls event has been configured, and if true
|
||||
we just disable the sycall source.
|
||||
*/}}
|
||||
{{- define "falco.configSyscallSource" -}}
|
||||
{{- $userspaceDisabled := true -}}
|
||||
{{- $gvisorDisabled := (ne .Values.driver.kind "gvisor") -}}
|
||||
{{- $driverDisabled := (not .Values.driver.enabled) -}}
|
||||
{{- if or (has "-u" .Values.extra.args) (has "--userspace" .Values.extra.args) -}}
|
||||
{{- $userspaceDisabled = false -}}
|
||||
{{- end -}}
|
||||
{{- if and $driverDisabled $userspaceDisabled $gvisorDisabled }}
|
||||
- --disable-source
|
||||
- syscall
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
We need the falco binary in order to generate the configuration for gVisor. This init container
|
||||
is deployed within the Falco pod when gVisor is enabled. The image is the same as the one of Falco we are
|
||||
deploying and the configuration logic is a bash script passed as argument on the fly. This solution should
|
||||
be temporary and will stay here until we move this logic to the falcoctl tool.
|
||||
*/}}
|
||||
{{- define "falco.gvisor.initContainer" -}}
|
||||
- name: {{ .Chart.Name }}-gvisor-init
|
||||
image: {{ include "falco.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
args:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
root={{ .Values.driver.gvisor.runsc.root }}
|
||||
config={{ .Values.driver.gvisor.runsc.config }}
|
||||
|
||||
echo "* Configuring Falco+gVisor integration...".
|
||||
# Check if gVisor is configured on the node.
|
||||
echo "* Checking for /host${config} file..."
|
||||
if [[ -f /host${config} ]]; then
|
||||
echo "* Generating the Falco configuration..."
|
||||
/usr/bin/falco --gvisor-generate-config=${root}/falco.sock > /host${root}/pod-init.json
|
||||
sed -E -i.orig '/"ignore_missing" : true,/d' /host${root}/pod-init.json
|
||||
if [[ -z $(grep pod-init-config /host${config}) ]]; then
|
||||
echo "* Updating the runsc config file /host${config}..."
|
||||
echo " pod-init-config = \"${root}/pod-init.json\"" >> /host${config}
|
||||
fi
|
||||
# Endpoint inside the container is different from outside, add
|
||||
# "/host" to the endpoint path inside the container.
|
||||
echo "* Setting the updated Falco configuration to /gvisor-config/pod-init.json..."
|
||||
sed 's/"endpoint" : "\/run/"endpoint" : "\/host\/run/' /host${root}/pod-init.json > /gvisor-config/pod-init.json
|
||||
else
|
||||
echo "* File /host${config} not found."
|
||||
echo "* Please make sure that the gVisor is configured in the current node and/or the runsc root and config file path are correct"
|
||||
exit -1
|
||||
fi
|
||||
echo "* Falco+gVisor correctly configured."
|
||||
exit 0
|
||||
volumeMounts:
|
||||
- mountPath: /host{{ .Values.driver.gvisor.runsc.path }}
|
||||
name: runsc-path
|
||||
readOnly: true
|
||||
- mountPath: /host{{ .Values.driver.gvisor.runsc.root }}
|
||||
name: runsc-root
|
||||
- mountPath: /host{{ .Values.driver.gvisor.runsc.config }}
|
||||
name: runsc-config
|
||||
- mountPath: /gvisor-config
|
||||
name: falco-gvisor-config
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- define "falcoctl.initContainer" -}}
|
||||
- name: falcoctl-artifact-install
|
||||
image: {{ include "falcoctl.image" . }}
|
||||
imagePullPolicy: {{ .Values.falcoctl.image.pullPolicy }}
|
||||
args:
|
||||
- artifact
|
||||
- install
|
||||
{{- with .Values.falcoctl.artifact.install.args }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.falcoctl.artifact.install.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- if .Values.falcoctl.artifact.install.securityContext }}
|
||||
{{- toYaml .Values.falcoctl.artifact.install.securityContext | nindent 4 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: {{ .Values.falcoctl.config.artifact.install.pluginsDir }}
|
||||
name: plugins-install-dir
|
||||
- mountPath: {{ .Values.falcoctl.config.artifact.install.rulesfilesDir }}
|
||||
name: rulesfiles-install-dir
|
||||
- mountPath: /etc/falcoctl
|
||||
name: falcoctl-config-volume
|
||||
{{- with .Values.falcoctl.artifact.install.mounts.volumeMounts }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.falcoctl.artifact.install.env }}
|
||||
{{- include "falco.renderTemplate" ( dict "value" .Values.falcoctl.artifact.install.env "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "falcoctl.sidecar" -}}
|
||||
- name: falcoctl-artifact-follow
|
||||
image: {{ include "falcoctl.image" . }}
|
||||
imagePullPolicy: {{ .Values.falcoctl.image.pullPolicy }}
|
||||
args:
|
||||
- artifact
|
||||
- follow
|
||||
{{- with .Values.falcoctl.artifact.follow.args }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.falcoctl.artifact.follow.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- if .Values.falcoctl.artifact.follow.securityContext }}
|
||||
{{- toYaml .Values.falcoctl.artifact.follow.securityContext | nindent 4 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: {{ .Values.falcoctl.config.artifact.follow.pluginsDir }}
|
||||
name: plugins-install-dir
|
||||
- mountPath: {{ .Values.falcoctl.config.artifact.follow.rulesfilesDir }}
|
||||
name: rulesfiles-install-dir
|
||||
- mountPath: /etc/falcoctl
|
||||
name: falcoctl-config-volume
|
||||
{{- with .Values.falcoctl.artifact.follow.mounts.volumeMounts }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.falcoctl.artifact.follow.env }}
|
||||
{{- include "falco.renderTemplate" ( dict "value" .Values.falcoctl.artifact.follow.env "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Build configuration for k8smeta plugin and update the relevant variables.
|
||||
* The configuration that needs to be built up is the initconfig section:
|
||||
init_config:
|
||||
collectorPort: 0
|
||||
collectorHostname: ""
|
||||
nodeName: ""
|
||||
The falco chart exposes this configuriotino through two variable:
|
||||
* collectors.kubenetetes.collectorHostname;
|
||||
* collectors.kubernetes.collectorPort;
|
||||
If those two variable are not set, then we take those values from the k8smetacollector subchart.
|
||||
The hostname is built using the name of the service that exposes the collector endpoints and the
|
||||
port is directly taken form the service's port that exposes the gRPC endpoint.
|
||||
We reuse the helpers from the k8smetacollector subchart, by passing down the variables. There is a
|
||||
hardcoded values that is the chart name for the k8s-metacollector chart.
|
||||
|
||||
* The falcoctl configuration is updated to allow plugin artifacts to be installed. The refs in the install
|
||||
section are updated by adding the reference for the k8s meta plugin that needs to be installed.
|
||||
NOTE: It seems that the named templates run during the validation process. And then again during the
|
||||
render fase. In our case we are setting global variable that persist during the various phases.
|
||||
We need to make the helper idempotent.
|
||||
*/}}
|
||||
{{- define "k8smeta.configuration" -}}
|
||||
{{- if and .Values.collectors.kubernetes.enabled .Values.driver.enabled -}}
|
||||
{{- $hostname := "" -}}
|
||||
{{- if .Values.collectors.kubernetes.collectorHostname -}}
|
||||
{{- $hostname = .Values.collectors.kubernetes.collectorHostname -}}
|
||||
{{- else -}}
|
||||
{{- $collectorContext := (dict "Release" .Release "Values" (index .Values "k8s-metacollector") "Chart" (dict "Name" "k8s-metacollector")) -}}
|
||||
{{- $hostname = printf "%s.%s.svc" (include "k8s-metacollector.fullname" $collectorContext) (include "k8s-metacollector.namespace" $collectorContext) -}}
|
||||
{{- end -}}
|
||||
{{- $hasConfig := false -}}
|
||||
{{- range .Values.falco.plugins -}}
|
||||
{{- if eq (get . "name") "k8smeta" -}}
|
||||
{{ $hasConfig = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not $hasConfig -}}
|
||||
{{- $listenPort := default (index .Values "k8s-metacollector" "service" "ports" "broker-grpc" "port") .Values.collectors.kubernetes.collectorPort -}}
|
||||
{{- $listenPort = int $listenPort -}}
|
||||
{{- $pluginConfig := dict "name" "k8smeta" "library_path" "libk8smeta.so" "init_config" (dict "collectorHostname" $hostname "collectorPort" $listenPort "nodeName" "${FALCO_K8S_NODE_NAME}") -}}
|
||||
{{- $newConfig := append .Values.falco.plugins $pluginConfig -}}
|
||||
{{- $_ := set .Values.falco "plugins" ($newConfig | uniq) -}}
|
||||
{{- $loadedPlugins := append .Values.falco.load_plugins "k8smeta" -}}
|
||||
{{- $_ = set .Values.falco "load_plugins" ($loadedPlugins | uniq) -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set .Values.falcoctl.config.artifact.install "refs" ((append .Values.falcoctl.config.artifact.install.refs .Values.collectors.kubernetes.pluginRef) | uniq)}}
|
||||
{{- $_ = set .Values.falcoctl.config.artifact "allowedTypes" ((append .Values.falcoctl.config.artifact.allowedTypes "plugin") | uniq)}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Based on the user input it populates the driver configuration in the falco config map.
|
||||
*/}}
|
||||
{{- define "falco.engineConfiguration" -}}
|
||||
{{- if .Values.driver.enabled -}}
|
||||
{{- $supportedDrivers := list "kmod" "ebpf" "modern_ebpf" "gvisor" -}}
|
||||
{{- $aliasDrivers := list "module" "modern-bpf" -}}
|
||||
{{- if and (not (has .Values.driver.kind $supportedDrivers)) (not (has .Values.driver.kind $aliasDrivers)) -}}
|
||||
{{- fail (printf "unsupported driver kind: \"%s\". Supported drivers %s, alias %s" .Values.driver.kind $supportedDrivers $aliasDrivers) -}}
|
||||
{{- end -}}
|
||||
{{- if or (eq .Values.driver.kind "kmod") (eq .Values.driver.kind "module") -}}
|
||||
{{- $kmodConfig := dict "kind" "kmod" "kmod" (dict "buf_size_preset" .Values.driver.kmod.bufSizePreset "drop_failed_exit" .Values.driver.kmod.dropFailedExit) -}}
|
||||
{{- $_ := set .Values.falco "engine" $kmodConfig -}}
|
||||
{{- else if eq .Values.driver.kind "ebpf" -}}
|
||||
{{- $ebpfConfig := dict "kind" "ebpf" "ebpf" (dict "buf_size_preset" .Values.driver.ebpf.bufSizePreset "drop_failed_exit" .Values.driver.ebpf.dropFailedExit "probe" .Values.driver.ebpf.path) -}}
|
||||
{{- $_ := set .Values.falco "engine" $ebpfConfig -}}
|
||||
{{- else if or (eq .Values.driver.kind "modern_ebpf") (eq .Values.driver.kind "modern-bpf") -}}
|
||||
{{- $ebpfConfig := dict "kind" "modern_ebpf" "modern_ebpf" (dict "buf_size_preset" .Values.driver.modernEbpf.bufSizePreset "drop_failed_exit" .Values.driver.modernEbpf.dropFailedExit "cpus_for_each_buffer" .Values.driver.modernEbpf.cpusForEachBuffer) -}}
|
||||
{{- $_ := set .Values.falco "engine" $ebpfConfig -}}
|
||||
{{- else if eq .Values.driver.kind "gvisor" -}}
|
||||
{{- $root := printf "/host%s/k8s.io" .Values.driver.gvisor.runsc.root -}}
|
||||
{{- $gvisorConfig := dict "kind" "gvisor" "gvisor" (dict "config" "/gvisor-config/pod-init.json" "root" $root) -}}
|
||||
{{- $_ := set .Values.falco "engine" $gvisorConfig -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
It returns "true" if the driver loader has to be enabled, otherwise false.
|
||||
*/}}
|
||||
{{- define "driverLoader.enabled" -}}
|
||||
{{- if or (eq .Values.driver.kind "modern_ebpf") (eq .Values.driver.kind "modern-bpf") (eq .Values.driver.kind "gvisor") (not .Values.driver.enabled) (not .Values.driver.loader.enabled) -}}
|
||||
false
|
||||
{{- else -}}
|
||||
true
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- with .Values.certs }}
|
||||
{{- if and .server.key .server.crt .ca.crt }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" $ }}-certs
|
||||
namespace: {{ include "falco.namespace" $ }}
|
||||
labels:
|
||||
{{- include "falco.labels" $ | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{ $key := .server.key }}
|
||||
server.key: {{ $key | b64enc | quote }}
|
||||
{{ $crt := .server.crt }}
|
||||
server.crt: {{ $crt | b64enc | quote }}
|
||||
falco.pem: {{ print $key $crt | b64enc | quote }}
|
||||
ca.crt: {{ .ca.crt | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if and .Values.certs.client.key .Values.certs.client.crt .Values.certs.ca.crt }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" . }}-client-certs
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "falco.labels" $ | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{ $key := .Values.certs.client.key }}
|
||||
client.key: {{ $key | b64enc | quote }}
|
||||
{{ $crt := .Values.certs.client.crt }}
|
||||
client.crt: {{ $crt | b64enc | quote }}
|
||||
falcoclient.pem: {{ print $key $crt | b64enc | quote }}
|
||||
ca.crt: {{ .Values.certs.ca.crt | b64enc | quote }}
|
||||
ca.pem: {{ .Values.certs.ca.crt | b64enc | quote }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" . }}
|
||||
namespace: {{ include "falco.namespace" . }}
|
||||
labels:
|
||||
{{- include "falco.labels" . | nindent 4 }}
|
||||
data:
|
||||
falco.yaml: |-
|
||||
{{- include "falco.falcosidekickConfig" . }}
|
||||
{{- include "k8smeta.configuration" . -}}
|
||||
{{- include "falco.engineConfiguration" . -}}
|
||||
{{- toYaml .Values.falco | nindent 4 }}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- if eq .Values.controller.kind "daemonset" }}
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" . }}
|
||||
namespace: {{ include "falco.namespace" . }}
|
||||
labels:
|
||||
{{- include "falco.labels" . | nindent 4 }}
|
||||
{{- if .Values.controller.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.controller.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "falco.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
{{- include "falco.podTemplate" . | nindent 4 }}
|
||||
{{- with .Values.controller.daemonset.updateStrategy }}
|
||||
updateStrategy:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- if eq .Values.controller.kind "deployment" }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" . }}
|
||||
namespace: {{ include "falco.namespace" . }}
|
||||
labels:
|
||||
{{- include "falco.labels" . | nindent 4 }}
|
||||
{{- if .Values.controller.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.controller.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: {{ .Values.controller.deployment.replicas }}
|
||||
{{- if .Values.controller.deployment.revisionHistoryLimit }}
|
||||
revisionHistoryLimit: {{ .Values.controller.deployment.revisionHistoryLimit }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "falco.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
{{- include "falco.podTemplate" . | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,13 @@
|
||||
{{- if or .Values.falcoctl.artifact.install.enabled .Values.falcoctl.artifact.follow.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" . }}-falcoctl
|
||||
namespace: {{ include "falco.namespace" . }}
|
||||
labels:
|
||||
{{- include "falco.labels" . | nindent 4 }}
|
||||
data:
|
||||
falcoctl.yaml: |-
|
||||
{{- include "k8smeta.configuration" . -}}
|
||||
{{- toYaml .Values.falcoctl.config | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.falco.grpc.enabled .Values.falco.grpc.bind_address (not (hasPrefix "unix://" .Values.falco.grpc.bind_address)) }}
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" . }}-grpc
|
||||
namespace: {{ include "falco.namespace" . }}
|
||||
labels:
|
||||
{{- include "falco.labels" . | nindent 4 }}
|
||||
spec:
|
||||
clusterIP: None
|
||||
selector:
|
||||
{{- include "falco.selectorLabels" . | nindent 4 }}
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ include "grpc.port" . }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,421 @@
|
||||
{{- define "falco.podTemplate" -}}
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" . }}
|
||||
labels:
|
||||
{{- include "falco.selectorLabels" . | nindent 4 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
checksum/rules: {{ include (print $.Template.BasePath "/rules-configmap.yaml") . | sha256sum }}
|
||||
{{- if and .Values.certs (not .Values.certs.existingSecret) }}
|
||||
checksum/certs: {{ include (print $.Template.BasePath "/certs-secret.yaml") . | sha256sum }}
|
||||
{{- end }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "falco.serviceAccountName" . }}
|
||||
{{- with .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
{{- if .Values.driver.enabled }}
|
||||
{{- if and (eq .Values.driver.kind "ebpf") .Values.driver.ebpf.hostNetwork }}
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.podPriorityClassName }}
|
||||
priorityClassName: {{ .Values.podPriorityClassName }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.driver.kind "gvisor" }}
|
||||
hostNetwork: true
|
||||
hostPID: true
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: {{ include "falco.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 8 }}
|
||||
securityContext:
|
||||
{{- include "falco.securityContext" . | nindent 8 }}
|
||||
args:
|
||||
- /usr/bin/falco
|
||||
{{- include "falco.configSyscallSource" . | indent 8 }}
|
||||
{{- with .Values.collectors }}
|
||||
{{- if .enabled }}
|
||||
{{- if .containerd.enabled }}
|
||||
- --cri
|
||||
- /run/containerd/containerd.sock
|
||||
{{- end }}
|
||||
{{- if .crio.enabled }}
|
||||
- --cri
|
||||
- /run/crio/crio.sock
|
||||
{{- end }}
|
||||
- -pk
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.extra.args }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: FALCO_K8S_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
{{- if .Values.extra.env }}
|
||||
{{- include "falco.renderTemplate" ( dict "value" .Values.extra.env "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
tty: {{ .Values.tty }}
|
||||
{{- if .Values.falco.webserver.enabled }}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: {{ .Values.healthChecks.livenessProbe.initialDelaySeconds }}
|
||||
timeoutSeconds: {{ .Values.healthChecks.livenessProbe.timeoutSeconds }}
|
||||
periodSeconds: {{ .Values.healthChecks.livenessProbe.periodSeconds }}
|
||||
httpGet:
|
||||
path: {{ .Values.falco.webserver.k8s_healthz_endpoint }}
|
||||
port: {{ .Values.falco.webserver.listen_port }}
|
||||
{{- if .Values.falco.webserver.ssl_enabled }}
|
||||
scheme: HTTPS
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
initialDelaySeconds: {{ .Values.healthChecks.readinessProbe.initialDelaySeconds }}
|
||||
timeoutSeconds: {{ .Values.healthChecks.readinessProbe.timeoutSeconds }}
|
||||
periodSeconds: {{ .Values.healthChecks.readinessProbe.periodSeconds }}
|
||||
httpGet:
|
||||
path: {{ .Values.falco.webserver.k8s_healthz_endpoint }}
|
||||
port: {{ .Values.falco.webserver.listen_port }}
|
||||
{{- if .Values.falco.webserver.ssl_enabled }}
|
||||
scheme: HTTPS
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if or .Values.falcoctl.artifact.install.enabled .Values.falcoctl.artifact.follow.enabled }}
|
||||
{{- if has "rulesfile" .Values.falcoctl.config.artifact.allowedTypes }}
|
||||
- mountPath: /etc/falco
|
||||
name: rulesfiles-install-dir
|
||||
{{- end }}
|
||||
{{- if has "plugin" .Values.falcoctl.config.artifact.allowedTypes }}
|
||||
- mountPath: /usr/share/falco/plugins
|
||||
name: plugins-install-dir
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- mountPath: /root/.falco
|
||||
name: root-falco-fs
|
||||
{{- if or .Values.driver.enabled .Values.mounts.enforceProcMount }}
|
||||
- mountPath: /host/proc
|
||||
name: proc-fs
|
||||
{{- end }}
|
||||
{{- if and .Values.driver.enabled (not .Values.driver.loader.enabled) }}
|
||||
readOnly: true
|
||||
- mountPath: /host/boot
|
||||
name: boot-fs
|
||||
readOnly: true
|
||||
- mountPath: /host/lib/modules
|
||||
name: lib-modules
|
||||
- mountPath: /host/usr
|
||||
name: usr-fs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.driver.enabled }}
|
||||
- mountPath: /host/etc
|
||||
name: etc-fs
|
||||
readOnly: true
|
||||
{{- end -}}
|
||||
{{- if and .Values.driver.enabled (or (eq .Values.driver.kind "kmod") (eq .Values.driver.kind "module")) }}
|
||||
- mountPath: /host/dev
|
||||
name: dev-fs
|
||||
readOnly: true
|
||||
- name: sys-fs
|
||||
mountPath: /sys/module/falco
|
||||
{{- end }}
|
||||
{{- if and .Values.driver.enabled (and (eq .Values.driver.kind "ebpf") (contains "falco-no-driver" .Values.image.repository)) }}
|
||||
- name: debugfs
|
||||
mountPath: /sys/kernel/debug
|
||||
{{- end }}
|
||||
{{- with .Values.collectors }}
|
||||
{{- if .enabled }}
|
||||
{{- if .docker.enabled }}
|
||||
- mountPath: /host/var/run/docker.sock
|
||||
name: docker-socket
|
||||
{{- end }}
|
||||
{{- if .containerd.enabled }}
|
||||
- mountPath: /host/run/containerd/containerd.sock
|
||||
name: containerd-socket
|
||||
{{- end }}
|
||||
{{- if .crio.enabled }}
|
||||
- mountPath: /host/run/crio/crio.sock
|
||||
name: crio-socket
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- mountPath: /etc/falco/falco.yaml
|
||||
name: falco-yaml
|
||||
subPath: falco.yaml
|
||||
{{- if .Values.customRules }}
|
||||
- mountPath: /etc/falco/rules.d
|
||||
name: rules-volume
|
||||
{{- end }}
|
||||
{{- if or .Values.certs.existingSecret (and .Values.certs.server.key .Values.certs.server.crt .Values.certs.ca.crt) }}
|
||||
- mountPath: /etc/falco/certs
|
||||
name: certs-volume
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if or .Values.certs.existingSecret (and .Values.certs.client.key .Values.certs.client.crt .Values.certs.ca.crt) }}
|
||||
- mountPath: /etc/falco/certs/client
|
||||
name: client-certs-volume
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- include "falco.unixSocketVolumeMount" . | nindent 8 -}}
|
||||
{{- with .Values.mounts.volumeMounts }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.driver.kind "gvisor" }}
|
||||
- mountPath: /usr/local/bin/runsc
|
||||
name: runsc-path
|
||||
readOnly: true
|
||||
- mountPath: /host{{ .Values.driver.gvisor.runsc.root }}
|
||||
name: runsc-root
|
||||
- mountPath: /host{{ .Values.driver.gvisor.runsc.config }}
|
||||
name: runsc-config
|
||||
- mountPath: /gvisor-config
|
||||
name: falco-gvisor-config
|
||||
{{- end }}
|
||||
{{- if .Values.falcoctl.artifact.follow.enabled }}
|
||||
{{- include "falcoctl.sidecar" . | nindent 4 }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
{{- with .Values.extra.initContainers }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.driver.kind "gvisor" }}
|
||||
{{- include "falco.gvisor.initContainer" . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if eq (include "driverLoader.enabled" .) "true" }}
|
||||
{{- include "falco.driverLoader.initContainer" . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.falcoctl.artifact.install.enabled }}
|
||||
{{- include "falcoctl.initContainer" . | nindent 4 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if or .Values.falcoctl.artifact.install.enabled .Values.falcoctl.artifact.follow.enabled }}
|
||||
- name: plugins-install-dir
|
||||
emptyDir: {}
|
||||
- name: rulesfiles-install-dir
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
- name: root-falco-fs
|
||||
emptyDir: {}
|
||||
{{- if .Values.driver.enabled }}
|
||||
- name: boot-fs
|
||||
hostPath:
|
||||
path: /boot
|
||||
- name: lib-modules
|
||||
hostPath:
|
||||
path: /lib/modules
|
||||
- name: usr-fs
|
||||
hostPath:
|
||||
path: /usr
|
||||
- name: etc-fs
|
||||
hostPath:
|
||||
path: /etc
|
||||
{{- end }}
|
||||
{{- if and .Values.driver.enabled (or (eq .Values.driver.kind "kmod") (eq .Values.driver.kind "module")) }}
|
||||
- name: dev-fs
|
||||
hostPath:
|
||||
path: /dev
|
||||
- name: sys-fs
|
||||
hostPath:
|
||||
path: /sys/module/falco
|
||||
{{- end }}
|
||||
{{- if and .Values.driver.enabled (and (eq .Values.driver.kind "ebpf") (contains "falco-no-driver" .Values.image.repository)) }}
|
||||
- name: debugfs
|
||||
hostPath:
|
||||
path: /sys/kernel/debug
|
||||
{{- end }}
|
||||
{{- with .Values.collectors }}
|
||||
{{- if .enabled }}
|
||||
{{- if .docker.enabled }}
|
||||
- name: docker-socket
|
||||
hostPath:
|
||||
path: {{ .docker.socket }}
|
||||
{{- end }}
|
||||
{{- if .containerd.enabled }}
|
||||
- name: containerd-socket
|
||||
hostPath:
|
||||
path: {{ .containerd.socket }}
|
||||
{{- end }}
|
||||
{{- if .crio.enabled }}
|
||||
- name: crio-socket
|
||||
hostPath:
|
||||
path: {{ .crio.socket }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.driver.enabled .Values.mounts.enforceProcMount }}
|
||||
- name: proc-fs
|
||||
hostPath:
|
||||
path: /proc
|
||||
{{- end }}
|
||||
{{- if eq .Values.driver.kind "gvisor" }}
|
||||
- name: runsc-path
|
||||
hostPath:
|
||||
path: {{ .Values.driver.gvisor.runsc.path }}/runsc
|
||||
type: File
|
||||
- name: runsc-root
|
||||
hostPath:
|
||||
path: {{ .Values.driver.gvisor.runsc.root }}
|
||||
- name: runsc-config
|
||||
hostPath:
|
||||
path: {{ .Values.driver.gvisor.runsc.config }}
|
||||
type: File
|
||||
- name: falco-gvisor-config
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
- name: falcoctl-config-volume
|
||||
configMap:
|
||||
name: {{ include "falco.fullname" . }}-falcoctl
|
||||
items:
|
||||
- key: falcoctl.yaml
|
||||
path: falcoctl.yaml
|
||||
- name: falco-yaml
|
||||
configMap:
|
||||
name: {{ include "falco.fullname" . }}
|
||||
items:
|
||||
- key: falco.yaml
|
||||
path: falco.yaml
|
||||
{{- if .Values.customRules }}
|
||||
- name: rules-volume
|
||||
configMap:
|
||||
name: {{ include "falco.fullname" . }}-rules
|
||||
{{- end }}
|
||||
{{- if or .Values.certs.existingSecret (and .Values.certs.server.key .Values.certs.server.crt .Values.certs.ca.crt) }}
|
||||
- name: certs-volume
|
||||
secret:
|
||||
{{- if .Values.certs.existingSecret }}
|
||||
secretName: {{ .Values.certs.existingSecret }}
|
||||
{{- else }}
|
||||
secretName: {{ include "falco.fullname" . }}-certs
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.certs.existingSecret (and .Values.certs.client.key .Values.certs.client.crt .Values.certs.ca.crt) }}
|
||||
- name: client-certs-volume
|
||||
secret:
|
||||
{{- if .Values.certs.existingClientSecret }}
|
||||
secretName: {{ .Values.certs.existingClientSecret }}
|
||||
{{- else }}
|
||||
secretName: {{ include "falco.fullname" . }}-client-certs
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- include "falco.unixSocketVolume" . | nindent 4 -}}
|
||||
{{- with .Values.mounts.volumes }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "falco.driverLoader.initContainer" -}}
|
||||
- name: {{ .Chart.Name }}-driver-loader
|
||||
image: {{ include "falco.driverLoader.image" . }}
|
||||
imagePullPolicy: {{ .Values.driver.loader.initContainer.image.pullPolicy }}
|
||||
args:
|
||||
{{- with .Values.driver.loader.initContainer.args }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.driver.kind "ebpf" }}
|
||||
- ebpf
|
||||
{{- end }}
|
||||
{{- with .Values.driver.loader.initContainer.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- if .Values.driver.loader.initContainer.securityContext }}
|
||||
{{- toYaml .Values.driver.loader.initContainer.securityContext | nindent 4 }}
|
||||
{{- else if (or (eq .Values.driver.kind "kmod") (eq .Values.driver.kind "module")) }}
|
||||
privileged: true
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /root/.falco
|
||||
name: root-falco-fs
|
||||
- mountPath: /host/proc
|
||||
name: proc-fs
|
||||
readOnly: true
|
||||
- mountPath: /host/boot
|
||||
name: boot-fs
|
||||
readOnly: true
|
||||
- mountPath: /host/lib/modules
|
||||
name: lib-modules
|
||||
- mountPath: /host/usr
|
||||
name: usr-fs
|
||||
readOnly: true
|
||||
- mountPath: /host/etc
|
||||
name: etc-fs
|
||||
readOnly: true
|
||||
env:
|
||||
{{- if .Values.driver.loader.initContainer.env }}
|
||||
{{- include "falco.renderTemplate" ( dict "value" .Values.driver.loader.initContainer.env "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "falco.securityContext" -}}
|
||||
{{- $securityContext := dict -}}
|
||||
{{- if .Values.driver.enabled -}}
|
||||
{{- if (or (eq .Values.driver.kind "kmod") (eq .Values.driver.kind "module")) -}}
|
||||
{{- $securityContext := set $securityContext "privileged" true -}}
|
||||
{{- end -}}
|
||||
{{- if eq .Values.driver.kind "ebpf" -}}
|
||||
{{- if .Values.driver.ebpf.leastPrivileged -}}
|
||||
{{- $securityContext := set $securityContext "capabilities" (dict "add" (list "SYS_ADMIN" "SYS_RESOURCE" "SYS_PTRACE")) -}}
|
||||
{{- else -}}
|
||||
{{- $securityContext := set $securityContext "privileged" true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if (or (eq .Values.driver.kind "modern_ebpf") (eq .Values.driver.kind "modern-bpf")) -}}
|
||||
{{- if .Values.driver.modernEbpf.leastPrivileged -}}
|
||||
{{- $securityContext := set $securityContext "capabilities" (dict "add" (list "BPF" "SYS_RESOURCE" "PERFMON" "SYS_PTRACE")) -}}
|
||||
{{- else -}}
|
||||
{{- $securityContext := set $securityContext "privileged" true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not (empty (.Values.containerSecurityContext)) -}}
|
||||
{{- toYaml .Values.containerSecurityContext }}
|
||||
{{- else -}}
|
||||
{{- toYaml $securityContext }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- define "falco.unixSocketVolumeMount" -}}
|
||||
{{- if and .Values.falco.grpc.enabled .Values.falco.grpc.bind_address (hasPrefix "unix://" .Values.falco.grpc.bind_address) }}
|
||||
- mountPath: {{ include "falco.unixSocketDir" . }}
|
||||
name: grpc-socket-dir
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "falco.unixSocketVolume" -}}
|
||||
{{- if and .Values.falco.grpc.enabled .Values.falco.grpc.bind_address (hasPrefix "unix://" .Values.falco.grpc.bind_address) }}
|
||||
- name: grpc-socket-dir
|
||||
hostPath:
|
||||
path: {{ include "falco.unixSocketDir" . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- if .Values.customRules }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" . }}-rules
|
||||
namespace: {{ include "falco.namespace" . }}
|
||||
labels:
|
||||
{{- include "falco.labels" . | nindent 4 }}
|
||||
data:
|
||||
{{- range $file, $content := .Values.customRules }}
|
||||
{{ $file }}: |-
|
||||
{{ $content | indent 4}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,43 @@
|
||||
{{- if and .Values.scc.create (.Capabilities.APIVersions.Has "security.openshift.io/v1") }}
|
||||
apiVersion: security.openshift.io/v1
|
||||
kind: SecurityContextConstraints
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/description: |
|
||||
This provides the minimum requirements Falco to run in Openshift.
|
||||
name: {{ include "falco.serviceAccountName" . }}
|
||||
namespace: {{ include "falco.namespace" . }}
|
||||
labels:
|
||||
{{- include "falco.labels" . | nindent 4 }}
|
||||
allowHostDirVolumePlugin: true
|
||||
allowHostIPC: false
|
||||
allowHostNetwork: true
|
||||
allowHostPID: true
|
||||
allowHostPorts: false
|
||||
allowPrivilegeEscalation: true
|
||||
allowPrivilegedContainer: true
|
||||
allowedCapabilities: []
|
||||
allowedUnsafeSysctls: []
|
||||
defaultAddCapabilities: []
|
||||
fsGroup:
|
||||
type: RunAsAny
|
||||
groups: []
|
||||
priority: 0
|
||||
readOnlyRootFilesystem: false
|
||||
requiredDropCapabilities: []
|
||||
runAsUser:
|
||||
type: RunAsAny
|
||||
seLinuxContext:
|
||||
type: RunAsAny
|
||||
seccompProfiles:
|
||||
- '*'
|
||||
supplementalGroups:
|
||||
type: RunAsAny
|
||||
users:
|
||||
- system:serviceaccount:{{ include "falco.namespace" . }}:{{ include "falco.serviceAccountName" . }}
|
||||
volumes:
|
||||
- hostPath
|
||||
- emptyDir
|
||||
- secret
|
||||
- configMap
|
||||
{{- end }}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "falco.serviceAccountName" . }}
|
||||
namespace: {{ include "falco.namespace" . }}
|
||||
labels:
|
||||
{{- include "falco.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- with $dot := . }}
|
||||
{{- range $service := $dot.Values.services }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "falco.fullname" $dot }}-{{ $service.name }}
|
||||
namespace: {{ include "falco.namespace" $dot }}
|
||||
labels:
|
||||
{{- include "falco.labels" $dot | nindent 4 }}
|
||||
spec:
|
||||
{{- with $service }}
|
||||
{{- omit . "name" "selector" | toYaml | nindent 2 }}
|
||||
{{- end}}
|
||||
selector:
|
||||
{{- include "falco.selectorLabels" $dot | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user