forked from falcosecurity/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new(event-generator): initial commit
Signed-off-by: Aldo Lacuku <[email protected]>
- Loading branch information
Showing
8 changed files
with
354 additions
and
0 deletions.
There are no files selected for viewing
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,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,24 @@ | ||
apiVersion: v2 | ||
name: event-generator | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "0.9.0" |
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,69 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "event-generator.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 "event-generator.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 "event-generator.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "event-generator.labels" -}} | ||
helm.sh/chart: {{ include "event-generator.chart" . }} | ||
{{ include "event-generator.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "event-generator.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "event-generator.name" . | quote }} | ||
app.kubernetes.io/instance: {{ .Release.Name | quote }} | ||
app.kubernetes.io/part-of: {{ include "event-generator.name" . | quote }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "event-generator.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "event-generator.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "grpc.unixSocketDir" -}} | ||
{{- if and .Values.config.grpc.enabled .Values.config.grpc.bindAddress (hasPrefix "unix://" .Values.config.grpc.bindAddress) -}} | ||
{{- .Values.config.grpc.bindAddress | trimPrefix "unix://" | dir -}} | ||
{{- end -}} | ||
{{- end -}} |
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,15 @@ | ||
{{- if .Values.config.loop -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "event-generator.fullname" . }} | ||
labels: | ||
{{- include "event-generator.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicasCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "event-generator.selectorLabels" . | nindent 6 }} | ||
template: | ||
{{- include "event-generator.podTemplate" . | nindent 4 }} | ||
{{- end -}} |
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,12 @@ | ||
{{- if not .Values.config.loop -}} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ include "event-generator.fullname" . }} | ||
labels: | ||
{{- include "event-generator.labels" . | nindent 4 }} | ||
spec: | ||
backoffLimit: 1 | ||
template: | ||
{{- include "event-generator.podTemplate" . | nindent 4 }} | ||
{{- end -}} |
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,66 @@ | ||
{{- define "event-generator.podTemplate" -}} | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
labels: | ||
{{- include "event-generator.selectorLabels" . | nindent 4 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "event-generator.fullname" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 4 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 8 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: | ||
- /bin/event-generator | ||
- {{ .Values.config.command }} | ||
{{- if .Values.config.actions }} | ||
- {{ .Values.config.actions }} | ||
{{- end }} | ||
{{- if .Values.config.loop }} | ||
- --loop | ||
{{- end }} | ||
{{- if .Values.config.grpc.enabled }} | ||
- --grpc-unix-socket={{- .Values.config.grpc.bindAddress }} | ||
{{- end }} | ||
env: | ||
- name: FALCO_EVENT_GENERATOR_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
{{- if .Values.config.grpc.enabled }} | ||
volumeMounts: | ||
- mountPath: {{ include "grpc.unixSocketDir" . }} | ||
name: unix-socket-dir | ||
{{- end }} | ||
{{- if .Values.config.grpc.enabled }} | ||
volumes: | ||
- hostPath: | ||
path: {{ include "grpc.unixSocketDir" . }} | ||
name: unix-socket-dir | ||
{{- 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 }} | ||
{{- if not .Values.config.loop }} | ||
restartPolicy: Never | ||
{{- end }} | ||
{{- end -}} |
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,76 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "event-generator.fullname" . }} | ||
labels: | ||
{{- include "event-generator.labels" . | nindent 4 }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "event-generator.fullname" . }} | ||
labels: | ||
{{- include "event-generator.labels" . | nindent 4 }} | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- configmaps | ||
- services | ||
- serviceaccounts | ||
- pods | ||
verbs: | ||
- list | ||
- get | ||
- create | ||
- delete | ||
- apiGroups: | ||
- apps | ||
- extensions | ||
resources: | ||
- deployments | ||
verbs: | ||
- list | ||
- get | ||
- create | ||
- delete | ||
- apiGroups: | ||
- rbac.authorization.k8s.io | ||
resources: | ||
- roles | ||
- rolebindings | ||
verbs: | ||
- get | ||
- list | ||
- create | ||
- delete | ||
# These are only so the event generator can create roles that have these properties. | ||
# It will result in a falco alert for the rules "ClusterRole With Wildcard Created", "ClusterRole With Pod Exec Created" | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods/exec | ||
verbs: | ||
- get | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- '*' | ||
verbs: | ||
- get | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ include "event-generator.fullname" . }} | ||
labels: | ||
{{- include "event-generator.labels" . | nindent 4 }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "event-generator.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
kind: ClusterRole | ||
name: {{ include "event-generator.fullname" . }} | ||
apiGroup: rbac.authorization.k8s.io | ||
--- |
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,69 @@ | ||
# Default values for event-generator. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
# -- Number of replicas of the event-generator (meaningful when installed as a deployment). | ||
replicasCount: 1 | ||
|
||
image: | ||
# -- Repository from where the image is pulled. | ||
repository: falcosecurity/event-generator | ||
# -- Pull policy for the event-generator image | ||
pullPolicy: IfNotPresent | ||
# -- Images' tag to select a development/custom version of event-generator instead of a release. | ||
# Overrides the image tag whose default is the chart appVersion. | ||
tag: "" | ||
|
||
# -- Secrets used to pull the image from a private repository. | ||
imagePullSecrets: [] | ||
# -- Used to override the chart name. | ||
nameOverride: "" | ||
# -- Used to override the chart full name. | ||
fullnameOverride: "" | ||
|
||
# -- Annotations to be added to the pod. | ||
podAnnotations: {} | ||
|
||
# -- Security context for the pod. | ||
podSecurityContext: {} | ||
# fsGroup: 2000 | ||
|
||
# -- Security context for the containers. | ||
securityContext: {} | ||
# capabilities: | ||
# drop: | ||
# - ALL | ||
# readOnlyRootFilesystem: true | ||
# runAsNonRoot: true | ||
# runAsUser: 1000 | ||
|
||
# -- Selectors to choose a given node where to run the pods. | ||
nodeSelector: {} | ||
|
||
# -- Tolerations to allow the pods to be scheduled on nodes whose taints the pod tolerates. | ||
tolerations: [] | ||
|
||
# -- Affinity, like the nodeSelector but with more expressive syntax. | ||
affinity: {} | ||
|
||
config: | ||
# -- The event-generator accepts two commands (run, test): | ||
# run: runs actions. | ||
# test: runs and tests actions. | ||
# For more info see: https://github.com/falcosecurity/event-generator | ||
command: test | ||
# -- Regular expression used to select the actions to be run. | ||
actions: "^syscall" | ||
# -- Runs in a loop the actions. | ||
# If set to "true" the event-generator is deployed using a k8s deployment otherwise a k8s job. | ||
loop: false | ||
# -- The length of time to wait before running an action. Non-zero values should contain | ||
# a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means no sleep. (default 100ms) | ||
sleep: "" | ||
|
||
grpc: | ||
# -- Set it to true if you are deploying in "test" mode. | ||
enabled: true | ||
# -- Path to the Falco grpc socket. | ||
bindAddress: "unix:///var/run/falco/falco.sock" | ||
|