Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #29 from tomerpe/redis-metadata
Browse files Browse the repository at this point in the history
allow redis metadata injection
  • Loading branch information
kobi-co authored Jul 26, 2023
2 parents f2366e8 + 3bc4383 commit 78a0c85
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 22 deletions.
2 changes: 1 addition & 1 deletion charts/opentelemetry-collector/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: aspecto-io-opentelemetry-collector
version: '1.5.0'
version: '1.5.1'
home: https://aspecto.io
type: application
description: helm chart of aspecto's opentelemetry tail sampling collector
Expand Down
36 changes: 25 additions & 11 deletions charts/opentelemetry-collector/templates/redis/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{{- $root := . -}}
{{- $globalMetadata := .Values.global.metadata -}}
{{- $globalMetadata := .Values.global.metadata -}}
{{- $globalSharedLabels := $globalMetadata.shared.labels -}}
{{- $globalObjectLabels := $globalMetadata.deployment.labels }}
{{- $globalSharedAnnotations := $globalMetadata.shared.annotations }}
{{- $globalObjectAnnotations := $globalMetadata.deployment.annotations }}
{{- $localMetadata := .Values.redis.metadata -}}
{{- $localData := .Values.redis -}}
{{- $localDataSpec := .Values.redis.specs -}}
{{- $localMetadata := .Values.redis.metadata -}}
{{- $localDataSpec := $localData.specs -}}
{{- $localMetadata := $localData.metadata -}}
{{- $localSharedAnnotations := $localMetadata.shared.annotations -}}
{{- $localObjectAnnotations := $localMetadata.deployment.annotations -}}
{{- $localSharedLabels := $localMetadata.shared.labels -}}
{{- $localObjectLabels := $localMetadata.deployment.labels -}}
{{- $globalSubLabels := $globalMetadata.pod.labels }}
{{- $globalSubAnnotations := $globalMetadata.pod.annotations }}
{{- $localSubAnnotations := $localMetadata.pod.annotations -}}
{{- $localSubLabels := $localMetadata.pod.labels -}}
{{- $resources := $localDataSpec.resources -}}
{{- if .Values.global.ignoreCpuLimits }}{{ $_ := unset $resources.limits "cpu" }}{{- end }}
{{- if and ($localData.enabled) (eq $localData.config.type "local") }}
Expand All @@ -17,20 +23,28 @@ kind: Deployment
metadata:
name: {{ $root.Values.global.name }}-redis-deployment
labels: {{ tpl ( toYaml $globalSharedLabels | nindent 4) $ }}
{{- if $globalObjectLabels }}{{ tpl ( toYaml $globalObjectLabels | nindent 4) . }}{{- end }}
{{- if $localMetadata.labels }}{{ tpl (toYaml $localMetadata.labels | nindent 4) . }}{{- end }}
{{- if $globalObjectLabels }}{{ tpl ( toYaml $globalObjectLabels | nindent 4) . }}{{- end }}
{{- if $localSharedLabels }}{{ toYaml $localSharedLabels | nindent 4 }}{{- end }}
{{- if $localObjectLabels }}{{ toYaml $localObjectLabels | nindent 4 }}{{- end }}
annotations: {{- if $globalSharedAnnotations }}{{ tpl ( toYaml $globalSharedAnnotations | nindent 4) $ }}{{- end }}
{{- if $globalObjectAnnotations }}{{ tpl ( toYaml $globalObjectAnnotations | nindent 4) . }}{{- end }}
{{- if $localMetadata.annotations }}{{ tpl (toYaml $localMetadata.annotations | nindent 4) . }}{{- end }}
{{- if $globalObjectAnnotations }}{{ tpl ( toYaml $globalObjectAnnotations | nindent 4) . }}{{- end }}
{{- if $localSharedAnnotations }}{{ toYaml $localSharedAnnotations | nindent 4 }}{{- end }}
{{- if $localObjectAnnotations }}{{ toYaml $localObjectAnnotations | nindent 4 }}{{- end }}
spec:
selector:
matchLabels:
app: redis
{{- toYaml .Values.redis.metadata.pod.labels | nindent 6 }}
replicas: {{ $localDataSpec.replicas }}
template:
metadata:
labels:
app: redis
labels: {{ tpl ( toYaml $globalSharedLabels | nindent 8) $ }}
{{- if $globalSubLabels }}{{ tpl ( toYaml $globalSubLabels | nindent 8) . }}{{- end }}
{{- if $localSharedLabels }}{{ toYaml $localSharedLabels | nindent 8 }}{{- end }}
{{- if $localSubLabels }}{{ toYaml $localSubLabels | nindent 8 }}{{- end }}
annotations: {{ tpl ( toYaml $globalSharedAnnotations | nindent 8 ) $ }}
{{- if $globalSubAnnotations }}{{ tpl ( toYaml $globalSubAnnotations | nindent 8) . }}{{- end }}
{{- if $localSharedAnnotations }}{{ toYaml $localSharedAnnotations | nindent 8 }}{{- end }}
{{- if $localSubAnnotations }}{{ toYaml $localSubAnnotations | nindent 8 }}{{- end }}
spec:
containers:
- name: redis
Expand Down
15 changes: 7 additions & 8 deletions charts/opentelemetry-collector/templates/redis/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@
{{- $globalObjectLabels := $globalMetadata.service.labels }}
{{- $globalSharedAnnotations := $globalMetadata.shared.annotations }}
{{- $globalObjectAnnotations := $globalMetadata.service.annotations }}
{{- $localMetadata := .Values.redis.metadata -}}
{{- $localData := .Values.redis -}}
{{- $localDataSpec := .Values.redis.specs -}}
{{- $localMetadata := .Values.redis.metadata -}}

{{- $localDataSpec := $localData.specs -}}
{{- $localMetadata := $localData.metadata -}}
{{- $localSharedAnnotations := $localMetadata.shared.annotations -}}
{{- $localSharedLabels := $localMetadata.shared.labels -}}
{{- if and ($localData.enabled) (eq $localData.config.type "local") }}
apiVersion: v1
kind: Service
metadata:
name: {{ $root.Values.global.name }}-redis
labels: {{ tpl ( toYaml $globalSharedLabels | nindent 4) $ }}
{{- if $globalObjectLabels }}{{ tpl ( toYaml $globalObjectLabels | nindent 4) . }}{{- end }}
{{- if $localMetadata.labels }}{{ tpl (toYaml $localMetadata.labels | nindent 4) . }}{{- end }}
{{- if $localSharedLabels }}{{ toYaml $localSharedLabels | nindent 4 }}{{- end }}
annotations: {{- if $globalSharedAnnotations }}{{ tpl ( toYaml $globalSharedAnnotations | nindent 4) $ }}{{- end }}
{{- if $globalObjectAnnotations }}{{ tpl ( toYaml $globalObjectAnnotations | nindent 4) . }}{{- end }}
{{- if $localMetadata.annotations }}{{ tpl (toYaml $localMetadata.annotations | nindent 4) . }}{{- end }}

{{- if $localSharedAnnotations }}{{ toYaml $localSharedAnnotations | nindent 4 }}{{- end }}
spec:
selector:
app: redis
{{- toYaml $localDataSpec.service.selector | nindent 4 }}
ports:
- protocol: TCP
port: {{ $localDataSpec.port }}
Expand Down
15 changes: 13 additions & 2 deletions charts/opentelemetry-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,16 @@ redis:

##### Only relevant when using type: local
metadata:
labels: {}
annotations: {}
shared:
annotations: {}
labels: {}
pod:
annotations: {}
labels:
app: redis
deployment:
annotations: {}
labels: {}
specs:
replicas: 1
image:
Expand All @@ -642,3 +650,6 @@ redis:
requests:
cpu: '0.5'
memory: 2Gi
service:
selector:
app: redis

0 comments on commit 78a0c85

Please sign in to comment.