-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(signoz-otel-gateway): add signoz-otel-gateway chart (#480)
#### Features - Add `signoz-otel-gateway` chart
- Loading branch information
1 parent
5ac01ff
commit c2c12a4
Showing
15 changed files
with
745 additions
and
5 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
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
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
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,6 @@ | ||
dependencies: | ||
- name: postgresql | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 15.0.0 | ||
digest: sha256:565cf5a1350794bca648c3f1e3dd374908e478fc9994caeae4564d72220e56bb | ||
generated: "2024-06-06T21:47:55.218828+05:30" |
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,20 @@ | ||
apiVersion: v2 | ||
name: signoz-otel-gateway | ||
description: A Helm chart for deploying SigNoz Opentelemetry Gateway | ||
type: application | ||
version: 0.0.1 | ||
appVersion: "v0.0.16" | ||
home: https://signoz.io/ | ||
icon: https://signoz.io/img/SigNozLogo-orange.svg | ||
dependencies: | ||
- name: postgresql | ||
version: 15.0.0 | ||
repository: https://charts.bitnami.com/bitnami | ||
condition: postgresql.enabled | ||
maintainers: | ||
- name: SigNoz | ||
email: [email protected] | ||
url: https://signoz.io | ||
- name: prashant-shahi | ||
email: [email protected] | ||
url: https://prashantshahi.dev |
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,193 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "signoz-otel-gateway.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 "signoz-otel-gateway.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 "signoz-otel-gateway.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "signoz-otel-gateway.labels" -}} | ||
helm.sh/chart: {{ include "signoz-otel-gateway.chart" . }} | ||
{{ include "signoz-otel-gateway.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "signoz-otel-gateway.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "signoz-otel-gateway.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "signoz-otel-gateway.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "signoz-otel-gateway.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a list of all ports | ||
*/}} | ||
{{- define "signoz-otel-gateway.ports" -}} | ||
{{- $serviceType := deepCopy .Values.service.type -}} | ||
{{- $ports := deepCopy .Values.service.ports -}} | ||
{{- range $key, $port := $ports -}} | ||
{{- if $port.enabled }} | ||
- name: {{ $key }} | ||
port: {{ $port.servicePort }} | ||
targetPort: {{ $key }} | ||
protocol: {{ $port.protocol }} | ||
{{- if (eq $serviceType "ClusterIP") }} | ||
nodePort: null | ||
{{- else if (eq $serviceType "NodePort") }} | ||
nodePort: {{ $port.nodePort }} | ||
{{- end }} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create config map | ||
*/}} | ||
{{- define "signoz-otel-gateway.config" -}} | ||
{{- $config := omit .Values.config "create" -}} | ||
{{- range $key, $value := $config }} | ||
{{- $fmted := $value | toString }} | ||
{{- if not (eq $fmted "") }} | ||
{{ $key }}: {{ $fmted | toYaml }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
|
||
{{- define "secretkeyref" -}} | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .name }} | ||
key: {{ .key }} | ||
{{- end -}} | ||
|
||
{{- define "fieldkeyref" -}} | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: {{ .path }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create env | ||
*/}} | ||
{{- define "signoz-otel-gateway.env" -}} | ||
{{/* | ||
====== GENERATED ENVIRONMENT VARIABLES ====== | ||
*/}} | ||
{{- $genEnv := dict -}} | ||
{{- $_ := set $genEnv "SIGNOZ_COMPONENT" "signoz-otel-gateway" -}} | ||
{{- $_ := set $genEnv "OTEL_SERVICE_NAME" "signoz-otel-gateway" -}} | ||
{{- $_ := set $genEnv "OTEL_RESOURCE_ATTRIBUTES" "signoz.component=$(SIGNOZ_COMPONENT),k8s.pod.uid=$(K8S_POD_UID),k8s.pod.ip=$(K8S_POD_IP)" -}} | ||
{{/* | ||
====== FIELD ENVIRONMENT VARIABLES ====== | ||
*/}} | ||
{{- $fieldEnv := dict -}} | ||
{{- range $key, $value := (dict "K8S_NODE_NAME" "spec.nodeName" "K8S_POD_IP" "status.podIP" "K8S_POD_NAME" "metadata.name" "K8S_POD_UID" "metadata.uid" "K8S_NAMESPACE" "metadata.namespace") -}} | ||
{{- $_ := set $fieldEnv $key (include "fieldkeyref" (dict "path" $value)) -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
====== SECRET ENVIRONMENT VARIABLES ====== | ||
*/}} | ||
{{- $prefix := (include "signoz-otel-gateway.fullname" .) }} | ||
{{- $secretEnv := dict -}} | ||
{{- if .Values.externalSecrets.create -}} | ||
{{- range $key, $value := .Values.externalSecrets.secrets -}} | ||
{{- if $value.env -}} | ||
{{- range $ikey, $ivalue := $value.env -}} | ||
{{- $_ := set $secretEnv (upper (printf "OTELGATEWAY_%s" $ikey)) (include "secretkeyref" (dict "name" (printf "%s-%s" $prefix $key) "key" $ivalue)) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{/* | ||
====== USER ENVIRONMENT VARIABLES ====== | ||
*/}} | ||
{{- $userEnv := dict -}} | ||
{{- range $key, $val := .Values.env }} | ||
{{- $upper := upper $key -}} | ||
{{- $var := printf "OTELGATEWAY_%s" $upper -}} | ||
{{- $_ := set $userEnv $var $val -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
====== MERGE AND RENDER ENV BLOCK ====== | ||
*/}} | ||
|
||
{{- $completeEnv := mergeOverwrite $genEnv $fieldEnv $userEnv $secretEnv -}} | ||
{{- template "signoz-otel-gateway.renderEnv" $completeEnv -}} | ||
|
||
{{- end -}} | ||
|
||
{{/* | ||
Given a dictionary of variable=value pairs including value and valueFrom, render a container env block. | ||
Environment variables are sorted alphabetically | ||
*/}} | ||
{{- define "signoz-otel-gateway.renderEnv" -}} | ||
|
||
{{- $dict := . -}} | ||
|
||
{{- range keys . | sortAlpha }} | ||
{{- $val := pluck . $dict | first -}} | ||
{{- $valueType := printf "%T" $val -}} | ||
{{ if eq $valueType "map[string]interface {}" }} | ||
- name: {{ . }} | ||
{{ toYaml $val | indent 2 -}} | ||
{{- else if eq $valueType "string" }} | ||
{{- if regexMatch "valueFrom" $val }} | ||
- name: {{ . }} | ||
{{ $val | indent 2 }} | ||
{{- else }} | ||
- name: {{ . }} | ||
value: {{ $val | quote }} | ||
{{- end }} | ||
{{- else }} | ||
- name: {{ . }} | ||
value: {{ $val | quote }} | ||
{{- end }} | ||
{{- 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,11 @@ | ||
{{- if .Values.config.create }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "signoz-otel-gateway.fullname" . }} | ||
labels: | ||
{{- include "signoz-otel-gateway.labels" . | nindent 4 }} | ||
data: | ||
config.yaml: |- | ||
{{- omit .Values.config "create" | toYaml | 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,100 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "signoz-otel-gateway.fullname" . }} | ||
labels: | ||
{{- include "signoz-otel-gateway.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "signoz-otel-gateway.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} | ||
{{- with .Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "signoz-otel-gateway.labels" . | nindent 8 }} | ||
{{- with .Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "signoz-otel-gateway.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
initContainers: | ||
- name: migrate | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: | ||
- /usr/local/bin/otelgateway | ||
args: | ||
- migrate | ||
env: | ||
{{- include "signoz-otel-gateway.env" . | nindent 12 }} | ||
containers: | ||
- name: gateway | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
{{- range $key, $port := .Values.service.ports }} | ||
{{- if $port.enabled }} | ||
- name: {{ $key }} | ||
containerPort: {{ $port.containerPort }} | ||
protocol: {{ $port.protocol }} | ||
{{- end }} | ||
{{- end }} | ||
command: | ||
- /usr/local/bin/otelgateway | ||
args: | ||
- collector | ||
{{- if .Values.config.create }} | ||
- --config=file:/conf/config.yaml | ||
{{- end }} | ||
{{- range .Values.args }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
env: | ||
{{- include "signoz-otel-gateway.env" . | nindent 12 }} | ||
livenessProbe: | ||
{{- toYaml .Values.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml .Values.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumeMounts: | ||
{{- if .Values.config.create }} | ||
- name: config | ||
mountPath: /conf | ||
{{- end }} | ||
{{- with .Values.volumeMounts }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: {{ include "signoz-otel-gateway.fullname" . }} | ||
{{- with .Values.volumes }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
Oops, something went wrong.