diff --git a/deployments/helm/.helmignore b/deployments/helm/.helmignore index 0e8a0eb36..63cec6436 100644 --- a/deployments/helm/.helmignore +++ b/deployments/helm/.helmignore @@ -21,3 +21,4 @@ .idea/ *.tmproj .vscode/ +.github diff --git a/deployments/helm/templates/_helpers.tpl b/deployments/helm/templates/_helpers.tpl index 9290a143b..efcdb0e30 100644 --- a/deployments/helm/templates/_helpers.tpl +++ b/deployments/helm/templates/_helpers.tpl @@ -23,6 +23,18 @@ If release name contains chart name it will be used as a full name. {{- end }} {{- end }} +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts +*/}} +{{- define "beyla.namespace" -}} +{{- if .Values.namespaceOverride }} +{{- .Values.namespaceOverride }} +{{- else }} +{{- .Release.Namespace }} +{{- end }} +{{- end }} + + {{/* Create chart name and version as used by the chart label. */}} diff --git a/deployments/helm/templates/cluster-role-binding.yaml b/deployments/helm/templates/cluster-role-binding.yaml index 5846945cd..2b8141236 100644 --- a/deployments/helm/templates/cluster-role-binding.yaml +++ b/deployments/helm/templates/cluster-role-binding.yaml @@ -17,4 +17,4 @@ roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: {{ include "beyla.fullname" . }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/deployments/helm/templates/cluster-role.yaml b/deployments/helm/templates/cluster-role.yaml index 94ddccc77..118a877ac 100644 --- a/deployments/helm/templates/cluster-role.yaml +++ b/deployments/helm/templates/cluster-role.yaml @@ -16,4 +16,4 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["list", "watch"] -{{- end }} \ No newline at end of file +{{- end }} diff --git a/deployments/helm/templates/configmap.yaml b/deployments/helm/templates/configmap.yaml new file mode 100644 index 000000000..f1b011b21 --- /dev/null +++ b/deployments/helm/templates/configmap.yaml @@ -0,0 +1,16 @@ +{{- if (not .Values.useExistingConfigMap) }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "beyla.fullname" . }} + namespace: {{ include "beyla.namespace" . }} + labels: + {{- include "beyla.labels" . | nindent 4 }} + {{- with .Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +data: + beyla-config.yml: | + {{- toYaml .Values.configmapData | nindent 4}} +{{- end }} diff --git a/deployments/helm/templates/daemon-set.yml b/deployments/helm/templates/daemon-set.yml index 561ee024e..7921c3566 100644 --- a/deployments/helm/templates/daemon-set.yml +++ b/deployments/helm/templates/daemon-set.yml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: DaemonSet metadata: name: {{ include "beyla.fullname" . }} + namespace: {{ include "beyla.namespace" .}} labels: {{- include "beyla.labels" . | nindent 2 }} {{- with .Values.annotations }} @@ -24,7 +25,11 @@ spec: volumes: - name: beyla-config configMap: - name: beyla-config + {{- if .Values.useExistingConfigMap }} + name: {{ .Values.useExistingConfigMap }} + {{- else }} + name: {{ include "beyla.fullname" . }} + {{- end }} containers: - name: beyla image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -39,11 +44,14 @@ spec: value: "/config/beyla-config.yml" - name: BEYLA_PRINT_TRACES value: "true" - - name: BEYLA_OPEN_PORT - value: "8443" - - name: OTEL_EXPORTER_OTLP_ENDPOINT - value: "http://grafana-agent:4318" - - name: BEYLA_LOG_LEVEL - value: "DEBUG" - name: OTEL_RESOURCE_ATTRIBUTES - value: "deployment.environment=production" \ No newline at end of file + value: "deployment.environment=production" + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: "{{ $value }}" + {{- end }} + {{- range $key, $value := .Values.envValueFrom }} + - name: {{ $key | quote }} + valueFrom: + {{- tpl (toYaml $value) $ | nindent 10 }} + {{- end }} \ No newline at end of file diff --git a/deployments/helm/templates/serviceaccount.yaml b/deployments/helm/templates/serviceaccount.yaml index 4137cc097..54c876a29 100644 --- a/deployments/helm/templates/serviceaccount.yaml +++ b/deployments/helm/templates/serviceaccount.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "beyla.serviceAccountName" . }} + namespace: {{ include "beyla.namespace" .}} labels: {{- include "beyla.labels" . | nindent 4 }} {{- with .Values.serviceAccount.labels }} diff --git a/deployments/helm/values.yaml b/deployments/helm/values.yaml index 5fac64a4a..c8ea512a2 100644 --- a/deployments/helm/values.yaml +++ b/deployments/helm/values.yaml @@ -5,8 +5,11 @@ image: tag: "main" imagePullSecrets: [] + nameOverride: "" fullnameOverride: "" +## Override the deployment namespace +namespaceOverride: "" ## DaemonSet annotations # annotations: {} @@ -117,3 +120,40 @@ nodeSelector: {} tolerations: [] affinity: {} + + +createConfigmap: true +## or use an existing configmap +# useExistingConfigMap: name-of-some-configmap + +## More configuration options available at https://grafana.com/docs/beyla/latest/configure/options/ +configmapData: + open_port: 8443 + routes: + unmatched: heuristic + log_level: debug + otel_traces_export: + endpoint: http://grafana-agent:4318 + ## or alternatively use + # grafana: + # otlp: + # cloud_zone: prod-eu-west-0 + # cloud_instance_id: 123456 + # cloud_api_key: + discovery: + services: + - k8s_namespace: default + attributes: + kubernetes: + enable: true + +## Env variables that will override configmap values +## For example: +## BEYLA_BPF_WAKEUP_LEN: 100 +env: {} + +envValueFrom: {} + # ENV_NAME: + # secretKeyRef: + # name: secret-name + # key: value_key