-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Distributed binary helm chart #1410
Closed
khaines
wants to merge
6
commits into
cortexproject:master
from
khaines:khaines/helm-distributed-binary
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
19efc2e
Add helm chart
cyriltovena 353e431
splitting chart into single binary and distributed binary sets of tem…
khaines 4c0c445
adding helm targets back to makefile
khaines 1129ab6
adding service templates for distributed mode
khaines 5c4ba61
minor typo updates from template render tests
khaines 1dc18c2
correcting typos in statefulset generator template
khaines File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ cmd/cortex/cortex | |
.pkg | ||
.cache | ||
images/ | ||
requirements.lock | ||
*.tgz |
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,22 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,13 @@ | ||
name: cortex | ||
version: 0.0.1 | ||
appVersion: 0.0.1 | ||
kubeVersion: "^1.10.0-0" | ||
description: "Cortex: A multitenant, horizontally scalable Prometheus as a Service." | ||
home: https://github.com/cortexproject/ | ||
icon: https://github.com/cortexproject/cortex/blob/master/imgs/logo.png?raw=true | ||
sources: | ||
- https://github.com/cortexproject/cortex | ||
maintainers: | ||
- name: Cortex Maintainers | ||
email: cortex-users@lists.cncf.io | ||
engine: gotpl |
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,3 @@ | ||
Verify the application is working by running these commands: | ||
kubectl port-forward service/{{ include "cortex.fullname" . }} {{ .Values.service.port }} | ||
curl http://127.0.0.1:{{ .Values.service.port }}/api/prom/api/v1/labels |
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,43 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "cortex.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "cortex.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "cortex.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account | ||
*/}} | ||
{{- define "cortex.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{ default (include "cortex.fullname" .) .Values.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.name }} | ||
{{- 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,45 @@ | ||
|
||
{{- define "cortex.service" -}} | ||
{{ $root := .root }} | ||
{{ $role := .role}} | ||
{{ $settings := .settings }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "cortex.fullname" $root }}-{{ $role }} | ||
labels: | ||
app: {{ template "cortex.name" $root }} | ||
chart: {{ template "cortex.chart" $root }} | ||
release: {{ $root.Release.Name }} | ||
heritage: {{ $root.Release.Service }} | ||
{{- with $root.Values.service.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
annotations: | ||
{{- toYaml $root.Values.service.annotations | nindent 4 }} | ||
spec: | ||
type: {{ $settings.serviceType }} | ||
{{- if (and (eq $settings.serviceType "ClusterIP") (not (empty $settings.clusterIP))) }} | ||
clusterIP: {{ $settings.clusterIP }} | ||
{{- end }} | ||
ports: | ||
{{- if $settings.http_listen_port }} | ||
- port: {{ $settings.http_listen_port }} | ||
protocol: TCP | ||
name: http-metrics | ||
targetPort: http-metrics | ||
{{- end }} | ||
{{- if $settings.grpc_listen_port }} | ||
- port: {{ $settings.grpc_listen_port }} | ||
protocol: TCP | ||
name: grpc | ||
targetPort: grpc | ||
{{- end }} | ||
{{- if (and (eq $settings.serviceType "NodePort") (not (empty $settings.nodePort))) }} | ||
nodePort: {{ $settings.nodePort }} | ||
{{- end }} | ||
selector: | ||
app: {{ template "cortex.name" $root }} | ||
release: {{ $root.Release.Name }} | ||
role: {{ $role }} | ||
{{- 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,96 @@ | ||
{{ if .Values.distributedMode.enabled }} | ||
{{ $root := . }} | ||
{{ range $role, $settings := .Values.distributedMode.deployments }} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "cortex.fullname" $root }}-{{$role}} | ||
labels: | ||
app: {{ template "cortex.name" $root }} | ||
chart: {{ template "cortex.chart" $root }} | ||
role: {{ $role }} | ||
release: {{ $root.Release.Name }} | ||
heritage: {{ $root.Release.Service }} | ||
annotations: | ||
{{- toYaml $root.Values.annotations | nindent 4 }} | ||
spec: | ||
podManagementPolicy: {{ $root.Values.podManagementPolicy }} | ||
replicas: {{ $settings.replicas }} | ||
selector: | ||
matchLabels: | ||
app: {{ template "cortex.name" $root }} | ||
release: {{ $root.Release.Name }} | ||
role: {{ $role }} | ||
serviceName: {{ template "cortex.fullname" $root }}-headless | ||
updateStrategy: | ||
{{- toYaml $root.Values.updateStrategy | nindent 4 }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ template "cortex.name" $root }} | ||
name: {{ template "cortex.name" $root }} | ||
role: {{ $role }} | ||
release: {{ $root.Release.Name }} | ||
{{- with $root.Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") $root | sha256sum }} | ||
{{- with $root.Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ template "cortex.serviceAccountName" $root }} | ||
{{- if $root.Values.priorityClassName }} | ||
priorityClassName: {{ $root.Values.priorityClassName }} | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml $root.Values.securityContext | nindent 8 }} | ||
containers: | ||
- name: {{ $root.Chart.Name }}-{{ $role }} | ||
image: "{{ $root.Values.image.repository }}:{{ $root.Values.image.tag }}" | ||
imagePullPolicy: {{ $root.Values.image.pullPolicy }} | ||
args: | ||
- "-config.file=/etc/cortex/cortex.yaml" | ||
{{- range $key, $value := $settings.extraArgs }} | ||
- "-{{ $key }}={{ $value }}" | ||
{{- end }} | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/cortex | ||
ports: | ||
{{- if $settings.http_listen_port }} | ||
- name: http-metrics | ||
containerPort: {{ $settings.http_listen_port }} | ||
protocol: TCP | ||
{{- end }} | ||
{{- if $settings.grpc_listen_port }} | ||
- name: grpc | ||
containerPort: {{ $settings.grpc_listen_port }} | ||
protocol: TCP | ||
{{- end }} | ||
livenessProbe: | ||
{{- toYaml $root.Values.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml $root.Values.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml $settings.resources | nindent 12 }} | ||
securityContext: | ||
readOnlyRootFilesystem: true | ||
env: | ||
- name: JAEGER_AGENT_HOST | ||
value: "{{ $root.Values.tracing.jaegerAgentHost }}" | ||
nodeSelector: | ||
{{- toYaml $root.nodeSelector | nindent 8 }} | ||
affinity: | ||
{{- toYaml $root.affinity | nindent 8 }} | ||
tolerations: | ||
{{- toYaml $root.tolerations | nindent 8 }} | ||
terminationGracePeriodSeconds: {{ $settings.terminationGracePeriodSeconds | default "30" }} | ||
volumes: | ||
- name: config | ||
secret: | ||
secretName: {{ template "cortex.fullname" $root }} | ||
{{- 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,17 @@ | ||
{{ if .Values.distributedMode.enabled }} | ||
{{ $root := . }} | ||
{{ range $role, $settings := .Values.distributedMode.deployments }} | ||
{{ if .enableService}} | ||
--- | ||
{{ $context := dict "root" $root "role" $role "settings" $settings}} | ||
{{ template "cortex.service" $context }} | ||
{{- end }} | ||
{{- end }} | ||
{{ range $role, $settings := .Values.distributedMode.statefulsets }} | ||
{{ if .enableService}} | ||
--- | ||
{{ $context := dict "root" $root "role" $role "settings" $settings}} | ||
{{ template "cortex.service" $context }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} #if .Values.distributedMode.enabled |
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,120 @@ | ||
{{ if .Values.distributedMode.enabled }} | ||
{{ $root := . }} | ||
{{ range $role, $settings := .Values.distributedMode.statefulsets }} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ template "cortex.fullname" $root }}-{{$role}} | ||
labels: | ||
app: {{ template "cortex.name" $root }} | ||
chart: {{ template "cortex.chart" $root }} | ||
role: {{ $role }} | ||
release: {{ $root.Release.Name }} | ||
heritage: {{ $root.Release.Service }} | ||
annotations: | ||
{{- toYaml $root.Values.annotations | nindent 4 }} | ||
spec: | ||
podManagementPolicy: {{ $root.Values.podManagementPolicy }} | ||
replicas: {{ $settings.replicas }} | ||
selector: | ||
matchLabels: | ||
app: {{ template "cortex.name" $root }} | ||
release: {{ $root.Release.Name }} | ||
role: {{ $role }} | ||
serviceName: {{ template "cortex.fullname" $root }}-headless | ||
updateStrategy: | ||
{{- toYaml $root.Values.updateStrategy | nindent 4 }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ template "cortex.name" $root }} | ||
name: {{ template "cortex.name" $root }} | ||
role: {{ $role }} | ||
release: {{ $root.Release.Name }} | ||
{{- with $root.Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") $root | sha256sum }} | ||
{{- with $root.Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ template "cortex.serviceAccountName" $root }} | ||
{{- if $root.Values.priorityClassName }} | ||
priorityClassName: {{ $root.Values.priorityClassName }} | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml $root.Values.securityContext | nindent 8 }} | ||
containers: | ||
- name: {{ $root.Chart.Name }}-{{ $role }} | ||
image: "{{ $root.Values.image.repository }}:{{ $root.Values.image.tag }}" | ||
imagePullPolicy: {{ $root.Values.image.pullPolicy }} | ||
args: | ||
- "-config.file=/etc/cortex/cortex.yaml" | ||
{{- range $key, $value := $settings.extraArgs }} | ||
- "-{{ $key }}={{ $value }}" | ||
{{- end }} | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/cortex | ||
- name: storage | ||
mountPath: "/data" | ||
subPath: {{ $root.Values.persistence.subPath }} | ||
ports: | ||
{{- if $settings.http_listen_port }} | ||
- name: http-metrics | ||
containerPort: {{ $settings.http_listen_port }} | ||
protocol: TCP | ||
{{- end }} | ||
{{- if $settings.grpc_listen_port }} | ||
- name: grpc | ||
containerPort: {{ $settings.grpc_listen_port }} | ||
protocol: TCP | ||
{{- end }} | ||
livenessProbe: | ||
{{- toYaml $root.Values.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml $root.Values.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml $settings.resources | nindent 12 }} | ||
securityContext: | ||
readOnlyRootFilesystem: true | ||
env: | ||
- name: JAEGER_AGENT_HOST | ||
value: "{{ $root.Values.tracing.jaegerAgentHost }}" | ||
nodeSelector: | ||
{{- toYaml $root.nodeSelector | nindent 8 }} | ||
affinity: | ||
{{- toYaml $root.affinity | nindent 8 }} | ||
tolerations: | ||
{{- toYaml $root.tolerations | nindent 8 }} | ||
terminationGracePeriodSeconds: {{ $settings.terminationGracePeriodSeconds | default "30" }} | ||
volumes: | ||
- name: config | ||
secret: | ||
secretName: {{ template "cortex.fullname" $root }} | ||
{{- if not $root.Values.persistence.enabled }} | ||
- name: storage | ||
emptyDir: {} | ||
{{- else if $root.Values.persistence.existingClaim }} | ||
- name: storage | ||
persistentVolumeClaim: | ||
claimName: {{ $root.Values.persistence.existingClaim }} | ||
{{- else }} | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: storage | ||
annotations: | ||
{{- toYaml $root.Values.persistence.annotations | nindent 8 }} | ||
spec: | ||
accessModes: | ||
{{- toYaml $root.Values.persistence.accessModes | nindent 8 }} | ||
resources: | ||
requests: | ||
storage: {{ $root.Values.persistence.size | quote }} | ||
storageClassName: {{ $root.Values.persistence.storageClassName }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be wrapped in an
if
like grafana/loki#621