Skip to content

Commit

Permalink
Allow to override config on a per component basis
Browse files Browse the repository at this point in the history
  • Loading branch information
simonswine committed Jun 21, 2022
1 parent 50529e3 commit 3a847fe
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@ deploy: $(BIN)/kind $(BIN)/helm docker-image/fire/build

.PHONY: deploy-micro-services
deploy-micro-services: $(BIN)/kind $(BIN)/helm docker-image/fire/build
$(call deploy,fire-micro-services,--values=deploy/helm/values-micro-services.yaml)
$(call deploy,fire-micro-services,--values=deploy/helm/fire/values-micro-services.yaml)
4 changes: 2 additions & 2 deletions deploy/helm/fire/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
1. Get to the application by running this commands:
kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ include "fire.fullname" . }} 4100:4100
2. Then you can visit http://127.0.0.1:4100 to use your application
kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ include "fire.fullname" . }} {{ .Values.fire.service.port }}:{{ .Values.fire.service.port }}
2. Then you can visit http://127.0.0.1:{{ .Values.fire.service.port }} to use your application
12 changes: 5 additions & 7 deletions deploy/helm/fire/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,14 @@ Create a list of components that should be deployed.
*/}}
{{- define "fire.components" -}}
{{- $full_name := (include "fire.fullname" .) }}
{{- range .Values.fire.stateful_set_targets }}
{{.}}: {kind: "StatefulSet", name: "{{$full_name}}-{{.}}"}
{{- end }}
{{- range .Values.fire.deployment_targets }}
{{.}}: {kind: "Deployment", name: "{{$full_name}}-{{.}}"}
{{- range $k, $v := .Values.fire.components }}
{{- $v := set $v "name" (printf "%s-%s" $full_name $k) }}
{{$k}}: {{ $v | toJson }}
{{- end }}
{{/*
If no deployment and statefulset are defined fall back to single binary
If no components are defined fall back to single binary statefulset
*/}}
{{- if and (eq (len .Values.fire.stateful_set_targets) 0) (eq (len .Values.fire.deployment_targets) 0) }}
{{- if eq (len .Values.fire.components) 0 }}
all: {kind: "StatefulSet", name: "{{$full_name}}"}
{{- end }}
{{- end }}
12 changes: 11 additions & 1 deletion deploy/helm/fire/templates/deployments-statefulsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ metadata:
spec:
{{- if eq $cfg.kind "StatefulSet" }}
serviceName: {{ $cfg.name }}-headless
{{- end }}
{{- if hasKey $cfg "replicaCount" }}
replicas: {{ $cfg.replicaCount }}
{{- end }}
selector:
matchLabels:
Expand Down Expand Up @@ -42,13 +45,20 @@ spec:
image: "{{ .Values.fire.image.repository }}:{{ .Values.fire.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.fire.image.pullPolicy }}
args:
- "-target={{ $component }}"
{{- if eq $component "agent" }}
- "-client.url=http://{{ include "fire.fullname" . }}-distributor.{{ .Release.Namespace }}.svc.cluster.local.:{{ .Values.fire.service.port }}"
{{- end }}
- "-config.file=/etc/fire/config.yaml"
{{- range $key, $value := .Values.fire.extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
{{- range $key, $value := $cfg.extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
ports:
- name: {{ .Values.fire.service.port_name }}
containerPort: 4100
containerPort: {{ .Values.fire.service.port }}
protocol: TCP
readinessProbe:
httpGet:
Expand Down
16 changes: 14 additions & 2 deletions deploy/helm/fire/values-micro-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,17 @@
# Declare variables to be passed into your templates.

fire:
deployment_targets: [querier, distributor,agent]
stateful_set_targets: [ingester]
components:
querier:
kind: Deployment
# TODO: Enable once the querier PR is merged
replicaCount: 0
distributor:
kind: Deployment
replicaCount: 2
agent:
kind: Deployment
replicaCount: 1
ingester:
kind: StatefulSet
replicaCount: 3
5 changes: 2 additions & 3 deletions deploy/helm/fire/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ fire:

affinity: {}

# run specific targets in specific styles
deployment_targets: []
stateful_set_targets: []
# run specific components separately
components: {}

config: |
scrape_configs:
Expand Down

0 comments on commit 3a847fe

Please sign in to comment.