Unverified Commit 4a67a651 authored by alespour's avatar alespour Committed by GitHub

[chronograf] add recommended labels and startupProbe (#444)

* add recommended labels * add startup probe * enable startupProbe by default * bump version * fix legacyLabels check
parent 84bfa4ce
apiVersion: v1
name: chronograf
version: 1.2.3
version: 1.2.4
appVersion: 1.9.3
description: Open-source web application written in Go and React.js that provides
the tools to visualize your monitoring data and easily create alerting and automation
......
......@@ -14,3 +14,41 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "chronograf.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "chronograf.labels" -}}
helm.sh/chart: {{ include "chronograf.chart" . }}
{{ include "chronograf.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "chronograf.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chronograf.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Legacy labels check
*/}}
{{- define "chronograf.legacyLabels" -}}
{{- if (hasKey .Values "legacyLabels") -}}
{{ .Values.legacyLabels }}
{{- else -}}
{{ true }}
{{- end -}}
{{- end -}}
......@@ -3,10 +3,13 @@ kind: Deployment
metadata:
name: {{ template "chronograf.fullname" . }}
labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- end }}
{{- include "chronograf.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.service.replicas }}
strategy:
......@@ -16,11 +19,17 @@ spec:
{{- end }}
selector:
matchLabels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }}
{{- end }}
{{- include "chronograf.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }}
{{- end }}
{{- include "chronograf.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
......@@ -179,7 +188,7 @@ spec:
path: {{ .Values.env.BASE_PATH }}/ping
{{- else }}
path: /ping
{{- end}}
{{- end }}
port: api
readinessProbe:
httpGet:
......@@ -187,8 +196,19 @@ spec:
path: {{ .Values.env.BASE_PATH }}/ping
{{- else }}
path: /ping
{{- end}}
{{- end }}
port: api
{{- if .Values.startupProbe.enabled }}
startupProbe:
httpGet:
{{- if .Values.env.BASE_PATH }}
path: {{ .Values.env.BASE_PATH }}/ping
{{- else }}
path: /ping
{{- end }}
port: api
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds | default 5 }}
{{- end }}
volumeMounts:
- name: data
mountPath: /var/lib/chronograf
......
......@@ -8,10 +8,13 @@ kind: Ingress
metadata:
name: {{ template "chronograf.fullname" . }}
labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- end }}
{{- include "chronograf.labels" . | nindent 4 }}
annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
spec:
......
......@@ -4,10 +4,13 @@ kind: PersistentVolumeClaim
metadata:
name: {{ template "chronograf.fullname" . }}
labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- end }}
{{- include "chronograf.labels" . | nindent 4 }}
annotations:
{{- if .Values.persistence.keepPvc }}
"helm.sh/resource-policy": keep
......
......@@ -3,6 +3,8 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ template "chronograf.fullname" . }}
labels:
{{- include "chronograf.labels" . | nindent 4 }}
type: Opaque
data:
token_secret: {{ .Values.oauth.token_secret | b64enc | quote }}
......
......@@ -3,14 +3,20 @@ kind: Service
metadata:
name: {{ template "chronograf.fullname" . }}
labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- end }}
{{- include "chronograf.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: 80
targetPort: 8888
selector:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }}
{{- end }}
{{- include "chronograf.selectorLabels" . | nindent 4 }}
......@@ -57,6 +57,12 @@ tolerations: []
##
affinity: {}
## Customize probes
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
##
startupProbe:
enabled: true
## Configure the ingress object to hook into existing infastructure
## ref : http://kubernetes.io/docs/user-guide/ingress/
## OPTIONALLY you can set .Values.ingress.secretName to set which secret to use
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment