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,21 @@
{{/*
nginx auth Secret name
*/}}
{{- define "mimir.gateway.nginx.authSecret" -}}
{{ .Values.gateway.nginx.basicAuth.existingSecret | default (include "mimir.resourceName" (dict "ctx" . "component" "gateway-nginx") ) }}
{{- end }}
{{/*
Name of the gateway Service resource
*/}}
{{- define "mimir.gateway.service.name" -}}
{{ .Values.gateway.service.nameOverride | default (include "mimir.resourceName" (dict "ctx" . "component" "gateway") ) }}
{{- end }}
{{/*
Returns "true" or "false" strings if the gateway component (nginx or GEM gateway) should be deployed
*/}}
{{- define "mimir.gateway.isEnabled" -}}
{{- or .Values.gateway.enabledNonEnterprise .Values.enterprise.enabled -}}
{{- end }}
@@ -0,0 +1,196 @@
{{- if (eq (include "mimir.gateway.isEnabled" .) "true") }}
{{- with .Values.gateway }}
{{- $isGEMGateway := $.Values.enterprise.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
{{- toYaml .annotations | nindent 4 }}
labels:
{{- include "mimir.labels" (dict "ctx" $ "component" "gateway") | nindent 4 }}
name: {{ include "mimir.resourceName" (dict "ctx" $ "component" "gateway") }}
namespace: {{ $.Release.Namespace | quote }}
spec:
{{- if not .autoscaling.enabled }}
replicas: {{ .replicas }}
{{- end }}
selector:
matchLabels:
{{- include "mimir.selectorLabels" (dict "ctx" $ "component" "gateway") | nindent 6 }}
{{- with .strategy }}
strategy:
{{ toYaml . | trim | indent 4 }}
{{- end }}
template:
metadata:
labels:
{{- include "mimir.podLabels" (dict "ctx" $ "component" "gateway") | nindent 8 }}
annotations:
{{- $annotations := include "mimir.podAnnotations" (dict "ctx" $ "component" "gateway") | fromYaml -}}
{{- if not $isGEMGateway -}}
{{- $annotations = (dict "checksum/config" (include (print $.Template.BasePath "/gateway/nginx-configmap.yaml") $ | sha256sum )) | mergeOverwrite $annotations -}}
{{- end -}}
{{- $annotations | toYaml | nindent 8 }}
namespace: {{ $.Release.Namespace | quote }}
spec:
serviceAccountName: {{ include "mimir.serviceAccountName" $ }}
{{- if .priorityClassName }}
priorityClassName: {{ .priorityClassName }}
{{- end }}
securityContext:
{{- include "mimir.lib.podSecurityContext" (dict "ctx" $ "component" "gateway") | nindent 8 }}
{{- with .initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if $.Values.image.pullSecrets }}
imagePullSecrets:
{{- range $.Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
containers:
{{- if $isGEMGateway }}
- name: gateway
image: {{ include "mimir.imageReference" $ | quote }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
args:
- "-target=gateway"
- "-config.expand-env=true"
- "-config.file=/etc/mimir/mimir.yaml"
{{- range $key, $value := .extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
volumeMounts:
{{- with .extraVolumeMounts }}
{{ toYaml . | nindent 12}}
{{- end }}
{{- if $.Values.global.extraVolumeMounts }}
{{ toYaml $.Values.global.extraVolumeMounts | nindent 12 }}
{{- end }}
- name: config
mountPath: /etc/mimir
- name: runtime-config
mountPath: /var/{{ include "mimir.name" $ }}
- name: license
mountPath: /license
- name: tmp
mountPath: /data
- name: active-queries
mountPath: /active-query-tracker
{{- else }}
- name: gateway
image: {{ .nginx.image.registry }}/{{ .nginx.image.repository }}:{{ .nginx.image.tag }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
{{- with .extraArgs }}
args:
{{- range $key, $value := . }}
- "-{{ $key }} {{ $value }}"
{{- end }}
{{- end }}
volumeMounts:
{{- if .extraVolumeMounts }}
{{ toYaml .extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if $.Values.global.extraVolumeMounts }}
{{ toYaml $.Values.global.extraVolumeMounts | nindent 12 }}
{{- end }}
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
{{- if .nginx.basicAuth.enabled }}
- name: auth
mountPath: /etc/nginx/secrets
{{- end }}
- name: tmp
mountPath: /tmp
- name: docker-entrypoint-d-override
mountPath: /docker-entrypoint.d
{{- end }}
ports:
- name: http-metrics
containerPort: {{ include "mimir.serverHttpListenPort" $ }}
protocol: TCP
readinessProbe:
{{- toYaml .readinessProbe | nindent 12 }}
resources:
{{- toYaml .resources | nindent 12 }}
securityContext:
{{- toYaml .containerSecurityContext | nindent 12 }}
{{- $jaeger_queue_size := dig "jaegerReporterMaxQueueSize" nil . }}
{{- if or $.Values.global.extraEnv .env $jaeger_queue_size }}
env:
{{- with $.Values.global.extraEnv }}
{{ toYaml . | nindent 12 }}
{{- end }}
{{- with .env }}
{{ toYaml . | nindent 12 }}
{{- end }}
{{- if $jaeger_queue_size }}
- name: "JAEGER_REPORTER_MAX_QUEUE_SIZE"
value: {{$jaeger_queue_size | toString | toYaml }}
{{- end }}
{{- end }}
{{- if or $.Values.global.extraEnvFrom .extraEnvFrom }}
envFrom:
{{- with $.Values.global.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with .extraContainers }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- with .nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "mimir.lib.topologySpreadConstraints" (dict "ctx" $ "component" "gateway") | nindent 6 }}
{{- with .tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .terminationGracePeriodSeconds }}
volumes:
- name: config
{{- include "mimir.configVolume" $ | nindent 10 }}
- name: runtime-config
configMap:
name: {{ include "mimir.fullname" $ }}-runtime
{{- if not $isGEMGateway }}
- name: nginx-config
configMap:
name: {{ include "mimir.fullname" $ }}-gateway-nginx
- name: docker-entrypoint-d-override
emptyDir: {}
{{- end }}
{{- if .nginx.basicAuth.enabled }}
- name: auth
secret:
secretName: {{ include "mimir.gateway.nginx.authSecret" $ }}
{{- end }}
- name: tmp
emptyDir: {}
{{- if $isGEMGateway }}
- name: license
secret:
secretName: {{ tpl $.Values.license.secretName $ }}
- name: storage
emptyDir: {}
- name: active-queries
emptyDir: {}
{{- end -}}
{{- if .extraVolumes }}
{{- toYaml .extraVolumes | nindent 8 }}
{{- end }}
{{- if $.Values.global.extraVolumes }}
{{- toYaml $.Values.global.extraVolumes | nindent 8 }}
{{- end }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,44 @@
{{- if and (eq (include "mimir.gateway.isEnabled" .) "true") .Values.gateway.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.gateway.ingress.nameOverride | default (include "mimir.resourceName" (dict "ctx" . "component" "gateway") ) }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "gateway") | nindent 4 }}
{{- with .Values.gateway.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ .Release.Namespace | quote }}
spec:
{{- with .Values.gateway.ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end -}}
{{- with .Values.gateway.ingress.tls }}
tls:
{{- range . }}
- hosts:
{{- range .hosts }}
- {{ tpl . $ | quote }}
{{- end }}
{{- with .secretName }}
secretName: {{ . }}
{{- end }}
{{- end }}
{{- end }}
rules:
{{- range .Values.gateway.ingress.hosts }}
- host: {{ tpl .host $ | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: {{ include "mimir.gateway.service.name" $ }}
port:
number: {{ $.Values.gateway.service.port }}
{{- end }}
{{- end }}
{{- end -}}
@@ -0,0 +1,3 @@
{{- if eq (include "mimir.gateway.isEnabled" .) "true" -}}
{{- include "mimir.lib.podDisruptionBudget" (dict "ctx" $ "component" "gateway") }}
{{- end -}}
@@ -0,0 +1,25 @@
{{- if .Values.gateway.route.enabled }}
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway") }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "gateway") | nindent 4 }}
{{- with .Values.gateway.route.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ .Release.Namespace | quote }}
spec:
host: {{ tpl .Values.gateway.route.host $ | quote }}
to:
kind: Service
name: {{ include "mimir.gateway.service.name" . }}
weight: 100
port:
targetPort: http-metrics
{{- with .Values.gateway.route.tls }}
tls:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,3 @@
{{- if and (eq (include "mimir.gateway.isEnabled" .) "true") (not .Values.gateway.enabledNonEnterprise) -}}
{{- include "mimir.lib.serviceMonitor" (dict "ctx" $ "component" "gateway") }}
{{- end -}}
@@ -0,0 +1,40 @@
{{- if eq (include "mimir.gateway.isEnabled" .) "true" -}}
{{- with .Values.gateway -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "mimir.gateway.service.name" $ }}
labels:
{{- include "mimir.labels" (dict "ctx" $ "component" "gateway") | nindent 4 }}
{{- with .service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- toYaml .service.annotations | nindent 4 }}
namespace: {{ $.Release.Namespace | quote }}
spec:
type: {{ .service.type }}
{{- with .service.clusterIP }}
clusterIP: {{ . }}
{{- end }}
{{- if and (eq "LoadBalancer" .service.type) .service.loadBalancerIP }}
loadBalancerIP: {{ .service.loadBalancerIP }}
{{- end }}
ports:
- port: {{ .service.port }}
protocol: TCP
name: http-metrics
targetPort: http-metrics
{{- if and (eq "NodePort" .service.type) .service.nodePort }}
nodePort: {{ .service.nodePort }}
{{- end }}
{{- with .service.legacyPort }}
- port: {{ . }}
protocol: TCP
name: legacy-http-metrics
targetPort: http-metrics
{{- end }}
selector:
{{- include "mimir.selectorLabels" (dict "ctx" $ "component" "gateway") | nindent 4 }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,35 @@
{{- if .Values.gateway.autoscaling.enabled }}
{{- if eq (include "mimir.hpa.version" .) "autoscaling/v2" }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway") }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "gateway") | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway") }}
minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
metrics:
{{- with .Values.gateway.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ . }}
{{- end }}
{{- with .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ . }}
{{- end }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,31 @@
{{- if .Values.gateway.autoscaling.enabled }}
{{- if eq (include "mimir.hpa.version" .) "autoscaling/v2beta1" }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway") }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "gateway") | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway") }}
minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
metrics:
{{- with .Values.gateway.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ . }}
{{- end }}
{{- with .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ . }}
{{- end }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,12 @@
{{- if and (not .Values.enterprise.enabled) .Values.gateway.enabledNonEnterprise -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway-nginx") }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "gateway-nginx") | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
data:
nginx.conf: |
{{- tpl .Values.gateway.nginx.config.file . | nindent 4 }}
{{- end -}}
@@ -0,0 +1,14 @@
{{- if not .Values.enterprise.enabled -}}
{{- if and .Values.gateway.enabledNonEnterprise .Values.gateway.nginx.basicAuth.enabled (not .Values.gateway.nginx.basicAuth.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway-nginx") }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "gateway-nginx") | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
stringData:
.htpasswd: |
{{- tpl .Values.gateway.nginx.basicAuth.htpasswd $ | nindent 4 }}
{{- end -}}
{{- end -}}