-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add purger components to cortex (#407)
* add purger components to cortex Signed-off-by: AlexandreRoux <[email protected]> * edit CHANGELOG.md and README.md Signed-off-by: AlexandreRoux <[email protected]> * Update CHANGELOG.md Co-authored-by: Niclas Schad <[email protected]> Signed-off-by: AlexandreRoux <[email protected]> * correct CHANGELOG.md Signed-off-by: AlexandreRoux <[email protected]> Signed-off-by: AlexandreRoux <[email protected]> Co-authored-by: Niclas Schad <[email protected]>
- Loading branch information
1 parent
858b6e2
commit aa230b6
Showing
12 changed files
with
362 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
{{/* | ||
purger fullname | ||
*/}} | ||
{{- define "cortex.purgerFullname" -}} | ||
{{ include "cortex.fullname" . }}-purger | ||
{{- end }} | ||
|
||
{{/* | ||
purger common labels | ||
*/}} | ||
{{- define "cortex.purgerLabels" -}} | ||
{{ include "cortex.labels" . }} | ||
app.kubernetes.io/component: purger | ||
{{- end }} | ||
|
||
{{/* | ||
purger selector labels | ||
*/}} | ||
{{- define "cortex.purgerSelectorLabels" -}} | ||
{{ include "cortex.selectorLabels" . }} | ||
app.kubernetes.io/component: purger | ||
{{- 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,109 @@ | ||
{{- if .Values.purger.enabled }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "cortex.purgerFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.purgerLabels" . | nindent 4 }} | ||
annotations: | ||
{{- toYaml .Values.purger.annotations | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.purger.replicas }} | ||
selector: | ||
matchLabels: | ||
{{- include "cortex.purgerSelectorLabels" . | nindent 6 }} | ||
strategy: | ||
{{- toYaml .Values.purger.strategy | nindent 4 }} | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "cortex.purgerLabels" . | nindent 8 }} | ||
{{- with .Values.purger.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
annotations: | ||
checksum/config: {{ include "cortex.configChecksum" . }} | ||
{{- with .Values.query_frontend.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ .Values.purger.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }} | ||
{{- if .Values.purger.securityContext.enabled }} | ||
securityContext: {{- omit .Values.purger.securityContext "enabled" | toYaml | nindent 8 }} | ||
{{- end }} | ||
initContainers: | ||
{{- toYaml .Values.purger.initContainers | nindent 8 }} | ||
{{- if .Values.image.pullSecrets }} | ||
imagePullSecrets: | ||
{{- range .Values.image.pullSecrets }} | ||
- name: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
- name: purger | ||
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: | ||
- "-target=purger" | ||
- "-config.file=/etc/cortex/cortex.yaml" | ||
{{- range $key, $value := .Values.purger.extraArgs }} | ||
- "-{{ $key }}={{ $value }}" | ||
{{- end }} | ||
volumeMounts: | ||
{{- if .Values.purger.extraVolumeMounts }} | ||
{{- toYaml .Values.purger.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.purger.startupProbe | nindent 12 }} | ||
livenessProbe: | ||
{{- toYaml .Values.purger.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml .Values.purger.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml .Values.purger.resources | nindent 12 }} | ||
{{- if .Values.purger.containerSecurityContext.enabled }} | ||
securityContext: {{- omit .Values.purger.containerSecurityContext "enabled" | toYaml | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.purger.env }} | ||
env: | ||
{{- toYaml .Values.purger.env | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.purger.lifecycle }} | ||
lifecycle: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.purger.extraContainers }} | ||
{{- toYaml .Values.purger.extraContainers | nindent 8}} | ||
{{- end }} | ||
nodeSelector: | ||
{{- toYaml .Values.purger.nodeSelector | nindent 8 }} | ||
{{- if .Values.purger.topologySpreadConstraints }} | ||
topologySpreadConstraints: | ||
{{- toYaml .Values.purger.topologySpreadConstraints | nindent 8}} | ||
{{- end }} | ||
affinity: | ||
{{- toYaml .Values.purger.affinity | nindent 8 }} | ||
tolerations: | ||
{{- toYaml .Values.purger.tolerations | nindent 8 }} | ||
terminationGracePeriodSeconds: {{ .Values.purger.terminationGracePeriodSeconds }} | ||
volumes: | ||
{{- include "cortex.configVolume" . | nindent 8 }} | ||
- name: runtime-config | ||
configMap: | ||
name: {{ template "cortex.fullname" . }}-runtime-config | ||
{{- if .Values.purger.extraVolumes }} | ||
{{- toYaml .Values.purger.extraVolumes | nindent 8}} | ||
{{- end }} | ||
{{- 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,42 @@ | ||
{{- if .Values.purger.serviceMonitor.enabled }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ include "cortex.purgerFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.purgerLabels" . | nindent 4 }} | ||
{{- if .Values.purger.serviceMonitor.additionalLabels }} | ||
{{ toYaml .Values.purger.serviceMonitor.additionalLabels | indent 4 }} | ||
{{- end }} | ||
{{- if .Values.purger.serviceMonitor.annotations }} | ||
annotations: | ||
{{ toYaml .Values.purger.serviceMonitor.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "cortex.purgerSelectorLabels" . | nindent 6 }} | ||
namespaceSelector: | ||
matchNames: | ||
- {{ .Release.Namespace | quote }} | ||
endpoints: | ||
- port: http-metrics | ||
{{- if .Values.purger.serviceMonitor.interval }} | ||
interval: {{ .Values.purger.serviceMonitor.interval }} | ||
{{- end }} | ||
{{- if .Values.purger.serviceMonitor.scrapeTimeout }} | ||
scrapeTimeout: {{ .Values.purger.serviceMonitor.scrapeTimeout }} | ||
{{- end }} | ||
{{- if .Values.purger.serviceMonitor.relabelings }} | ||
relabelings: | ||
{{- toYaml .Values.purger.serviceMonitor.relabelings | nindent 4 }} | ||
{{- end }} | ||
{{- if .Values.purger.serviceMonitor.metricRelabelings }} | ||
metricRelabelings: | ||
{{- toYaml .Values.purger.serviceMonitor.metricRelabelings | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.purger.serviceMonitor.extraEndpointSpec }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- 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,25 @@ | ||
{{- if .Values.purger.enabled -}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "cortex.purgerFullname" . }}-headless | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.purgerLabels" . | nindent 4 }} | ||
{{- with .Values.purger.service.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
annotations: | ||
{{- toYaml .Values.purger.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.purgerSelectorLabels" . | 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,25 @@ | ||
{{- if eq .Values.config.storage.engine "blocks" -}} | ||
{{- if .Values.purger.enabled -}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "cortex.purgerFullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "cortex.purgerLabels" . | nindent 4 }} | ||
{{- with .Values.purger.service.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
annotations: | ||
{{- toYaml .Values.purger.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.purgerSelectorLabels" . | nindent 4 }} | ||
{{- end -}} | ||
{{- 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
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
Oops, something went wrong.