Skip to content

Commit

Permalink
Merge pull request #6 from nokia/helm-102
Browse files Browse the repository at this point in the history
Helm 102 - Configmap and env value for external secret
  • Loading branch information
Khushi Jain authored Feb 23, 2024
2 parents e037188 + 2d05fc2 commit 7c05f61
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 10 deletions.
1 change: 1 addition & 0 deletions deployments/helm/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
.idea/
*.tmproj
.vscode/
.github
12 changes: 12 additions & 0 deletions deployments/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/}}
Expand Down
2 changes: 1 addition & 1 deletion deployments/helm/templates/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "beyla.fullname" . }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion deployments/helm/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list", "watch"]
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions deployments/helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
24 changes: 16 additions & 8 deletions deployments/helm/templates/daemon-set.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}"
Expand All @@ -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"
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 }}
1 change: 1 addition & 0 deletions deployments/helm/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
40 changes: 40 additions & 0 deletions deployments/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ image:
tag: "main"

imagePullSecrets: []

nameOverride: ""
fullnameOverride: ""
## Override the deployment namespace
namespaceOverride: ""

## DaemonSet annotations
# annotations: {}
Expand Down Expand Up @@ -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

0 comments on commit 7c05f61

Please sign in to comment.