forked from grafana/cortex-tools
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: add query-scheduler Signed-off-by: Joao Marques <[email protected]> * improve apiVersion for pdb Signed-off-by: nschad <[email protected]> * fix changelog Signed-off-by: nschad <[email protected]> * add query-scheduler to test-deployment Signed-off-by: nschad <[email protected]> * fix query-scheduler to test-deployment Signed-off-by: nschad <[email protected]> Co-authored-by: nschad <[email protected]>
- Loading branch information
1 parent
6a47771
commit f5b4a98
Showing
12 changed files
with
401 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
{{/* | ||
query-scheduler fullname | ||
*/}} | ||
{{- define "cortex.querySchedulerFullname" -}} | ||
{{ include "cortex.fullname" . }}-query-scheduler | ||
{{- end }} | ||
|
||
{{/* | ||
query-scheduler common labels | ||
*/}} | ||
{{- define "cortex.querySchedulerLabels" -}} | ||
{{ include "cortex.labels" . }} | ||
app.kubernetes.io/component: query-scheduler | ||
{{- end }} | ||
|
||
{{/* | ||
query-scheduler selector labels | ||
*/}} | ||
{{- define "cortex.querySchedulerSelectorLabels" -}} | ||
{{ include "cortex.selectorLabels" . }} | ||
app.kubernetes.io/component: query-scheduler | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
{{- if .Values.query_scheduler.enabled }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "cortex.querySchedulerFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.querySchedulerLabels" . | nindent 4 }} | ||
annotations: | ||
{{- toYaml .Values.query_scheduler.annotations | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.query_scheduler.replicas }} | ||
selector: | ||
matchLabels: | ||
{{- include "cortex.querySchedulerSelectorLabels" . | nindent 6 }} | ||
strategy: | ||
{{- toYaml .Values.query_scheduler.strategy | nindent 4 }} | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "cortex.querySchedulerLabels" . | nindent 8 }} | ||
{{- with .Values.query_scheduler.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
annotations: | ||
{{- if .Values.useExternalConfig }} | ||
checksum/config: {{ .Values.externalConfigVersion }} | ||
{{- else }} | ||
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} | ||
{{- end }} | ||
{{- with .Values.query_scheduler.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ template "cortex.serviceAccountName" . }} | ||
{{- if .Values.query_scheduler.priorityClassName }} | ||
priorityClassName: {{ .Values.query_scheduler.priorityClassName }} | ||
{{- end }} | ||
{{- if .Values.query_scheduler.securityContext.enabled }} | ||
securityContext: {{- omit .Values.query_scheduler.securityContext "enabled" | toYaml | nindent 8 }} | ||
{{- end }} | ||
initContainers: | ||
{{- toYaml .Values.query_scheduler.initContainers | nindent 8 }} | ||
{{- if .Values.image.pullSecrets }} | ||
imagePullSecrets: | ||
{{- range .Values.image.pullSecrets }} | ||
- name: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
- name: query-scheduler | ||
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: | ||
- "-target=query-scheduler" | ||
- "-config.file=/etc/cortex/cortex.yaml" | ||
{{- range $key, $value := .Values.query_scheduler.extraArgs }} | ||
- "-{{ $key }}={{ $value }}" | ||
{{- end }} | ||
volumeMounts: | ||
{{- if .Values.query_scheduler.extraVolumeMounts }} | ||
{{- toYaml .Values.query_scheduler.extraVolumeMounts | nindent 12 }} | ||
{{- end }} | ||
- name: config | ||
mountPath: /etc/cortex | ||
- name: runtime-config | ||
mountPath: /etc/cortex-runtime-config | ||
ports: | ||
- name: http-metrics | ||
containerPort: {{ .Values.config.server.http_listen_port }} | ||
protocol: TCP | ||
- name: grpc | ||
containerPort: {{ .Values.config.server.grpc_listen_port }} | ||
protocol: TCP | ||
startupProbe: | ||
{{- toYaml .Values.query_scheduler.startupProbe | nindent 12 }} | ||
livenessProbe: | ||
{{- toYaml .Values.query_scheduler.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml .Values.query_scheduler.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml .Values.query_scheduler.resources | nindent 12 }} | ||
{{- if .Values.query_scheduler.containerSecurityContext.enabled }} | ||
securityContext: {{- omit .Values.query_scheduler.containerSecurityContext "enabled" | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.query_scheduler.env }} | ||
env: | ||
{{- toYaml .Values.query_scheduler.env | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.query_scheduler.lifecycle }} | ||
lifecycle: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.query_scheduler.extraContainers }} | ||
{{- toYaml .Values.query_scheduler.extraContainers | nindent 8 }} | ||
{{- end }} | ||
nodeSelector: | ||
{{- toYaml .Values.query_scheduler.nodeSelector | nindent 8 }} | ||
affinity: | ||
{{- toYaml .Values.query_scheduler.affinity | nindent 8 }} | ||
tolerations: | ||
{{- toYaml .Values.query_scheduler.tolerations | nindent 8 }} | ||
terminationGracePeriodSeconds: {{ .Values.query_scheduler.terminationGracePeriodSeconds }} | ||
volumes: | ||
- name: config | ||
secret: | ||
{{- if .Values.useExternalConfig }} | ||
secretName: {{ .Values.externalConfigSecretName }} | ||
{{- else }} | ||
secretName: {{ template "cortex.fullname" . }} | ||
{{- end }} | ||
- name: runtime-config | ||
configMap: | ||
name: {{ template "cortex.fullname" . }}-runtime-config | ||
{{- if .Values.query_scheduler.extraVolumes }} | ||
{{- toYaml .Values.query_scheduler.extraVolumes | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
14 changes: 14 additions & 0 deletions
14
templates/query-scheduler/query-scheduler-poddisruptionbudget.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{- if and (.Values.query_scheduler.enabled) (gt (int .Values.query_scheduler.replicas) 1) (.Values.query_scheduler.podDisruptionBudget) }} | ||
apiVersion: {{ include "cortex.pdbVersion" . }} | ||
kind: PodDisruptionBudget | ||
metadata: | ||
name: {{ include "cortex.querySchedulerFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.querySchedulerLabels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "cortex.querySchedulerSelectorLabels" . | nindent 6 }} | ||
{{- toYaml .Values.query_scheduler.podDisruptionBudget | nindent 2 }} | ||
{{- end }} |
42 changes: 42 additions & 0 deletions
42
templates/query-scheduler/query-scheduler-servicemonitor.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{{- if and .Values.query_scheduler.enabled .Values.query_scheduler.serviceMonitor.enabled }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ include "cortex.querySchedulerFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.querySchedulerLabels" . | nindent 4 }} | ||
{{- if .Values.query_scheduler.serviceMonitor.additionalLabels }} | ||
{{ toYaml .Values.query_scheduler.serviceMonitor.additionalLabels | indent 4 }} | ||
{{- end }} | ||
{{- if .Values.query_scheduler.serviceMonitor.annotations }} | ||
annotations: | ||
{{ toYaml .Values.query_scheduler.serviceMonitor.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "cortex.querySchedulerSelectorLabels" . | nindent 6 }} | ||
namespaceSelector: | ||
matchNames: | ||
- {{ .Release.Namespace | quote }} | ||
endpoints: | ||
- port: http-metrics | ||
{{- if .Values.query_scheduler.serviceMonitor.interval }} | ||
interval: {{ .Values.query_scheduler.serviceMonitor.interval }} | ||
{{- end }} | ||
{{- if .Values.query_scheduler.serviceMonitor.scrapeTimeout }} | ||
scrapeTimeout: {{ .Values.query_scheduler.serviceMonitor.scrapeTimeout }} | ||
{{- end }} | ||
{{- if .Values.query_scheduler.serviceMonitor.relabelings }} | ||
relabelings: | ||
{{- toYaml .Values.query_scheduler.serviceMonitor.relabelings | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.query_scheduler.serviceMonitor.metricRelabelings }} | ||
metricRelabelings: | ||
{{- toYaml .Values.query_scheduler.serviceMonitor.metricRelabelings | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.query_scheduler.serviceMonitor.extraEndpointSpec }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
25 changes: 25 additions & 0 deletions
25
templates/query-scheduler/query-scheduler-svc-headless.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{- if .Values.query_scheduler.enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "cortex.querySchedulerFullname" . }}-headless | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.querySchedulerLabels" . | nindent 4 }} | ||
{{- with .Values.query_scheduler.service.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
annotations: | ||
{{- toYaml .Values.query_scheduler.service.annotations | nindent 4 }} | ||
spec: | ||
type: ClusterIP | ||
clusterIP: None | ||
publishNotReadyAddresses: true | ||
ports: | ||
- port: {{ .Values.config.server.grpc_listen_port }} | ||
protocol: TCP | ||
name: grpc | ||
targetPort: grpc | ||
selector: | ||
{{- include "cortex.querySchedulerSelectorLabels" . | nindent 4 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{- if .Values.query_scheduler.enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "cortex.querySchedulerFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.querySchedulerLabels" . | nindent 4 }} | ||
{{- with .Values.query_scheduler.service.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
annotations: | ||
{{- toYaml .Values.query_scheduler.service.annotations | nindent 4 }} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: {{ .Values.config.server.http_listen_port }} | ||
protocol: TCP | ||
name: http-metrics | ||
targetPort: http-metrics | ||
selector: | ||
{{- include "cortex.querySchedulerSelectorLabels" . | nindent 4 }} | ||
{{- end }} |
Oops, something went wrong.