added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -0,0 +1,17 @@
{{/*
Convert labels to string like: key1=value1, key2=value2, ...
Example:
customHeaders:
X-Scope-OrgID: tenant-1
becomes:
customHeaders: "X-Scope-OrgID=tenant-1"
Params:
map = map to convert to csv string
*/}}
{{- define "mimir.lib.mapToCSVString" -}}
{{- $list := list -}}
{{- range $k, $v := $.map -}}
{{- $list = append $list (printf "%s=%s" $k $v) -}}
{{- end -}}
{{ join "," $list }}
{{- end -}}
@@ -0,0 +1,23 @@
{{/*
Mimir common PodDisruptionBudget definition
Params:
ctx = . context
component = name of the component
*/}}
{{- define "mimir.lib.podDisruptionBudget" -}}
{{- $componentSection := include "mimir.componentSectionFromName" . | fromYaml }}
{{ with ($componentSection).podDisruptionBudget }}
apiVersion: {{ include "mimir.podDisruptionBudget.apiVersion" $.ctx }}
kind: PodDisruptionBudget
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" $.ctx "component" $.component) }}
labels:
{{- include "mimir.labels" (dict "ctx" $.ctx "component" $.component) | nindent 4 }}
namespace: {{ $.ctx.Release.Namespace | quote }}
spec:
selector:
matchLabels:
{{- include "mimir.selectorLabels" (dict "ctx" $.ctx "component" $.component) | nindent 6 }}
{{ toYaml . | indent 2 }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,13 @@
{{/*
Mimir common podSecurityContext
Params:
ctx = . context
component = name of the component
*/}}
{{- define "mimir.lib.podSecurityContext" -}}
{{- $componentSection := include "mimir.componentSectionFromName" . | fromYaml }}
{{- /* Some components have security context in the values.yalm as podSecurityContext and others as securityContext */}}
{{- $podSecurityContextSection := $componentSection.securityContext | default $componentSection.podSecurityContext -}}
{{- $defaultContext := deepCopy .ctx.Values.rbac.podSecurityContext }}
{{- $podSecurityContextSection | mustMergeOverwrite $defaultContext | toYaml -}}
{{- end -}}
@@ -0,0 +1,74 @@
{{/*
Mimir common ServiceMonitor definition
Params:
ctx = . context
component = name of the component
memberlist = true/false, whether component is part of memberlist
*/}}
{{- define "mimir.lib.serviceMonitor" -}}
{{- with .ctx.Values.metaMonitoring.serviceMonitor }}
{{- if .enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "mimir.resourceName" $ }}
namespace: {{ .namespace | default $.ctx.Release.Namespace | quote }}
labels:
{{- include "mimir.labels" $ | nindent 4 }}
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
namespaceSelector:
{{- if .namespaceSelector }}
{{- toYaml .namespaceSelector | nindent 4 }}
{{- else }}
matchNames:
- {{ $.ctx.Release.Namespace }}
{{- end }}
selector:
matchLabels:
{{- include "mimir.selectorLabels" $ | nindent 6 }}
matchExpressions:
- key: prometheus.io/service-monitor
operator: NotIn
values:
- "false"
endpoints:
- port: http-metrics
{{- with .interval }}
interval: {{ . }}
{{- end }}
{{- with .scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
relabelings:
- action: replace
sourceLabels: [job]
replacement: "{{ $.ctx.Release.Namespace }}/{{ $.component }}"
targetLabel: job
{{- if kindIs "string" .clusterLabel }}
- replacement: "{{ .clusterLabel | default (include "mimir.clusterName" $.ctx) }}"
targetLabel: cluster
{{- end }}
{{- with .relabelings }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .scheme }}
scheme: {{ . }}
{{- end }}
{{- with .tlsConfig }}
tlsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -0,0 +1,21 @@
{{- define "mimir.lib.topologySpreadConstraints" -}}
{{- $componentSection := include "mimir.componentSectionFromName" . | fromYaml -}}
{{- $topologySpreadConstraintsSection := $componentSection.topologySpreadConstraints -}}
{{- $selectorLabels := include "mimir.selectorLabels" . -}}
{{- if $topologySpreadConstraintsSection -}}
{{- $constraints := kindIs "slice" $topologySpreadConstraintsSection | ternary $topologySpreadConstraintsSection (list $topologySpreadConstraintsSection) -}}
topologySpreadConstraints:
{{- range $constraint := $constraints }}
- maxSkew: {{ $constraint.maxSkew }}
topologyKey: {{ $constraint.topologyKey }}
whenUnsatisfiable: {{ $constraint.whenUnsatisfiable }}
labelSelector:
{{- if $constraint.labelSelector -}}
{{- $constraint.labelSelector | toYaml | nindent 4 -}}
{{- else }}
matchLabels:
{{- $selectorLabels | nindent 6 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}