Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/content/en/docs/reference/helm-chart.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions install/kubernetes/tetragon/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 34 additions & 2 deletions install/kubernetes/tetragon/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
{{/*
Resources names
*/}}
{{- define "tetragon.name" -}}
{{- default .Release.Name .Values.tetragon.nameOverride | trunc 63 | trimSuffix "-" }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is trimSuffix needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most k8s object names and ids must start and end with alphanumeric chars, this is common failsafe.

You could theoretically set your release name or nameOverride to amazing-tetragon-deployment-named-long-with-dashes-because-why-not (66 chars), truncated to 63 would result into amazing-tetragon-deployment-named-long-with-dashes-because-why-, which would fail

{{- end }}

{{- define "tetragon.configMapName" -}}
{{- printf "%s-config" (include "tetragon.name" .) | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "tetragon.clusterRole" -}}
{{- include "tetragon.name" . }}
{{- end }}

{{- define "tetragon-operator.name" -}}
{{- default (printf "%s-operator" .Release.Name) .Values.tetragonOperator.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "tetragon-operator.clusterRole" -}}
{{- include "tetragon-operator.name" . }}
{{- end }}

{{- define "tetragon-operator.roleBindingName" -}}
{{- printf "%s-rolebinding" (include "tetragon-operator.name" .) | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "tetragon-operator.configMapName" -}}
{{- printf "%s-config" (include "tetragon-operator.name" .) | trunc 63 | trimSuffix "-" }}
{{- end }}


{{/*
Common labels
*/}}
Expand Down Expand Up @@ -55,15 +87,15 @@ ServiceAccounts
{{- if .Values.serviceAccount.name -}}
{{- printf "%s" .Values.serviceAccount.name -}}
{{- else -}}
{{- printf "%s" .Release.Name -}}
{{- include "tetragon.name" . -}}
{{- end -}}
{{- end }}

{{- define "tetragon-operator.serviceAccount" -}}
{{- if .Values.tetragonOperator.serviceAccount.name -}}
{{- printf "%s" .Values.tetragonOperator.serviceAccount.name -}}
{{- else -}}
{{- printf "%s-operator-service-account" .Release.Name -}}
{{- printf "%s-service-account" (include "tetragon-operator.name" .) -}}
{{- end -}}
{{- end }}

Expand Down
2 changes: 1 addition & 1 deletion install/kubernetes/tetragon/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{.Release.Name}}
name: {{ include "tetragon.clusterRole" . }}
labels:
{{- include "tetragon.labels" . | nindent 4 }}
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}
name: {{ include "tetragon.clusterRole" . }}
labels:
{{- include "tetragon.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Release.Name }}
name: {{ include "tetragon.clusterRole" . }}
subjects:
- kind: ServiceAccount
namespace: {{ .Release.Namespace }}
Expand Down
4 changes: 2 additions & 2 deletions install/kubernetes/tetragon/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
{{- else }}
{{- include "tetragon.labels" . | nindent 4 }}
{{- end }}
name: {{ .Release.Name }}
name: {{ include "tetragon.name" . }}
namespace: {{ .Release.Namespace }}
spec:
selector:
Expand Down Expand Up @@ -86,7 +86,7 @@ spec:
{{- if .Values.tetragon.enabled }}
- name: tetragon-config
configMap:
name: {{ .Release.Name }}-config
name: {{ include "tetragon.configMapName" . }}
- name: bpf-maps
hostPath:
path: /sys/fs/bpf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{.Release.Name}}-operator
name: {{ include "tetragon-operator.clusterRole" . }}
labels:
{{- include "tetragon-operator.labels" . | nindent 4 }}
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-operator-rolebinding
name: {{ include "tetragon-operator.roleBindingName" . }}
labels:
{{- include "tetragon-operator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Release.Name }}-operator
name: {{ include "tetragon-operator.name" . }}
subjects:
- kind: ServiceAccount
namespace: {{ .Release.Namespace }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-operator-config
name: {{ include "tetragon-operator.configMapName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "tetragon-operator.labels" . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
{{- with .Values.tetragonOperator.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ .Release.Name }}-operator
name: {{ include "tetragon-operator.name" . }}
namespace: {{ .Release.Namespace }}
spec:
selector:
Expand All @@ -31,7 +31,7 @@ spec:
{{- end }}
spec:
containers:
- name: {{ .Release.Name }}-operator
- name: {{ include "tetragon-operator.name" . }}
command:
- /usr/bin/tetragon-operator
args:
Expand Down Expand Up @@ -103,7 +103,7 @@ spec:
volumes:
- name: tetragon-operator-config
configMap:
name: {{ .Release.Name }}-operator-config
name: {{ include "tetragon-operator.configMapName" . }}
{{- with .Values.tetragonOperator.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion install/kubernetes/tetragon/templates/operator_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-operator
name: {{ include "tetragon-operator.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "tetragon-operator.labels" . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-operator-rolebinding
name: {{ include "tetragon-operator.roleBindingName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "tetragon-operator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ .Release.Name }}-operator
name: {{ include "tetragon-operator.name" . }}
subjects:
- kind: ServiceAccount
namespace: {{ .Release.Namespace }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Release.Name }}-operator-metrics
name: {{ include "tetragon-operator.name" . }}-metrics
labels:
{{- include "tetragon-operator.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
{{- with .Values.tetragonOperator.prometheus.serviceMonitor.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ .Release.Name }}-operator
name: {{ include "tetragon-operator.name" . }}
namespace: {{ .Release.Namespace }}
spec:
endpoints:
Expand Down
2 changes: 1 addition & 1 deletion install/kubernetes/tetragon/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{- else }}
{{- include "tetragon.labels" . | nindent 4 }}
{{- end }}
name: {{ .Release.Name }}
name: {{ include "tetragon.name" . }}
namespace: {{ .Release.Namespace }}
spec:
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
{{- with .Values.tetragon.prometheus.serviceMonitor.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ .Release.Name }}
name: {{ include "tetragon.name" . }}
namespace: {{ .Release.Namespace }}
spec:
endpoints:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
name: {{ include "tetragon.configMapName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "tetragon.labels" . | nindent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions install/kubernetes/tetragon/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ exportDirectory: "/var/run/cilium/tetragon"
hostNetwork: true
tetragon:
enabled: true
nameOverride: ""
image:
override: ~
repository: quay.io/cilium/tetragon
Expand Down Expand Up @@ -240,6 +241,8 @@ tetragon:
tetragonOperator:
# -- Enables the Tetragon Operator.
enabled: true
# -- The name of the Tetragon Operator deployment.
nameOverride: ""
# -- Number of replicas to run for the tetragon-operator deployment
replicas: 1
# -- Lease handling for an automated failover when running multiple replicas
Expand Down
Loading