Skip to content

Commit

Permalink
added per component deployment; fix storage service declaration; adde…
Browse files Browse the repository at this point in the history
Enhancements:
+ Allow enabling/disabling certain perforator microservices
+ Allow to deploy extra objects

Fixes:
+ Fix storage service declaration
+ Fix priority class placement

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

---

Pull Request resolved: #36
commit_hash:676c66b47dbe12c12a2052505056dd6f179447d1
  • Loading branch information
soanni86 authored and robot-piglet committed Feb 13, 2025
1 parent 972f4a1 commit 22dd441
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{/*
Renders a value that contains template.
Usage:
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "common.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ spec:
{{- if .Values.agent.useHostNetwork }}
hostNetwork: true
{{- end }}
{{- with .Values.agent.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
ports:
- containerPort: {{ .Values.agent.containerPorts.metrics }}
name: metrics
Expand Down Expand Up @@ -105,6 +102,9 @@ spec:
# it may be desirable to set a high priority class to ensure that a DaemonSet Pod
# preempts running Pods
# priorityClassName: important
{{- with .Values.agent.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
terminationGracePeriodSeconds: 30
volumes:
- name: sys
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- range .Values.extraDeploy }}
---
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.gc.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -8,4 +9,5 @@ data:
config.yaml: |- {{- tpl .Values.gc.config.custom . | nindent 4 }}
{{- else }}
config.yaml: |- {{- tpl (.Files.Get "config/gc.yaml") . | nindent 4 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.gc.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -129,4 +130,5 @@ spec:
{{- with .Values.gc.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.gc.metrics.enabled }}
{{- if and .Values.gc.enabled .Values.gc.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (.Values.gc.metrics.enabled) (.Values.gc.metrics.serviceMonitor.enabled) }}
{{- if and .Values.gc.enabled (and (.Values.gc.metrics.enabled) (.Values.gc.metrics.serviceMonitor.enabled)) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{{- $ca := genCA (printf "%s-storage-service-ca" (include "perforator.fullname" .)) 3650 }}
{{- $storageCert := genSignedCert (printf "%s-storage-service" (include "perforator.fullname" .)) nil (list (printf "%s-storage-service" (include "perforator.fullname" .))) 3650 $ca }}
{{- $hostname := .Values.storage.hostname }}
{{- if $hostname }}
{{- if contains ":" $hostname }}
{{- $hostname = index (regexSplit ":" $hostname -1) 0 }}
{{- end }}
{{- else }}
{{- $hostname = (printf "%s-storage-service" (include "perforator.fullname" .)) }}
{{- end }}
{{- $storageCert := genSignedCert $hostname nil (list $hostname) 3650 $ca }}
{{- $storageSecretName := printf "%s-storage-crt" (include "perforator.fullname" .) }}
apiVersion: v1
data:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.offlineprocessing.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -8,4 +9,5 @@ data:
config.yaml: |- {{- tpl .Values.offlineprocessing.config.custom . | nindent 4 }}
{{- else }}
config.yaml: |- {{- tpl (.Files.Get "config/offlineprocessing.yaml") . | nindent 4 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.offlineprocessing.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -127,4 +128,5 @@ spec:
{{- with .Values.offlineprocessing.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.proxy.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -8,4 +9,5 @@ data:
config.yaml: |- {{- tpl .Values.proxy.config.custom . | nindent 4 }}
{{- else }}
config.yaml: |- {{- tpl (.Files.Get "config/proxy.yaml") . | nindent 4 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.proxy.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -135,3 +136,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.proxy.metrics.enabled }}
{{- if and .Values.proxy.enabled .Values.proxy.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.proxy.enabled -}}
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -34,4 +35,5 @@ spec:
{{- range .Values.proxy.service.ipFamilies }}
ipFamilies:
- {{ . }}
{{- end}}
{{- end}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (.Values.proxy.metrics.enabled) (.Values.proxy.metrics.serviceMonitor.enabled) }}
{{- if and .Values.proxy.enabled (and (.Values.proxy.metrics.enabled) (.Values.proxy.metrics.serviceMonitor.enabled)) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.storage.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -8,4 +9,5 @@ data:
config.yaml: |- {{- tpl .Values.storage.config.custom . | nindent 4 }}
{{- else }}
config.yaml: |- {{- tpl (.Files.Get "config/storage.yaml") . | nindent 4 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.storage.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -135,4 +136,5 @@ spec:
{{- with .Values.storage.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.storage.metrics.enabled }}
{{- if and .Values.storage.enabled .Values.storage.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.storage.enabled -}}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -6,16 +7,16 @@ metadata:
{{- include "perforator.selectorLabels" . | nindent 4 }}
{{- include "perforator.storage.selectorLabels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
{{- with .Values.proxy.service.annotations }}
{{- with .Values.storage.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
{{- include "perforator.selectorLabels" . | nindent 4 }}
{{- include "perforator.storage.selectorLabels" . | nindent 4 }}
type: {{ .Values.proxy.service.type }}
{{- with .Values.proxy.service.loadBalancerIP }}
type: {{ .Values.storage.service.type }}
{{- with .Values.storage.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
ports:
Expand All @@ -28,4 +29,5 @@ spec:
{{- range .Values.storage.service.ipFamilies }}
ipFamilies:
- {{ . }}
{{- end}}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (.Values.storage.metrics.enabled) (.Values.storage.metrics.serviceMonitor.enabled) }}
{{- if and .Values.storage.enabled (and (.Values.storage.metrics.enabled) (.Values.storage.metrics.serviceMonitor.enabled)) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
5 changes: 5 additions & 0 deletions perforator/deploy/kubernetes/helm/perforator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
extraDeploy: []

# TODO: it might be better to use separate fields for database credentials for each perforator component.

Expand Down Expand Up @@ -262,6 +263,7 @@ agent:
metrics: 9156

storage:
enabled: true
config:
# Create a new user provided config for the storage.
useCustom: false
Expand Down Expand Up @@ -390,6 +392,7 @@ storage:
hostname: ""

proxy:
enabled: true
config:
# Create a new user provided config for the proxy.
useCustom: false
Expand Down Expand Up @@ -697,6 +700,7 @@ ingress:
# - example.com

gc:
enabled: true
config:
# Create a new user provided config for the gc.
useCustom: false
Expand Down Expand Up @@ -808,6 +812,7 @@ gc:
metrics: 85

offlineprocessing:
enabled: true
config:
#Create a new user provided config for the offlineprocessing.
useCustom: false
Expand Down
4 changes: 4 additions & 0 deletions perforator/deploy/kubernetes/helm/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ Internal changes:

Enhancements:
+ Add perforator-dev subchart, that allows to deploy postgresql, clickhouse, minio databases
+ Allow enabling/disabling certain perforator microservices
+ Allow to deploy extra objects

Fixes:
+ Fix storage service declaration
+ Fix priority class setting placement
+ Fix password secretes were deployed after the migration jobs, which in some cases caused chart installation failure

# 0.2.5
Expand Down

0 comments on commit 22dd441

Please sign in to comment.