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 apiVersion: v1
name: chronograf name: chronograf
version: 1.2.3 version: 1.2.4
appVersion: 1.9.3 appVersion: 1.9.3
description: Open-source web application written in Go and React.js that provides 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 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 ...@@ -14,3 +14,41 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $name := default .Chart.Name .Values.nameOverride -}} {{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- 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 ...@@ -3,10 +3,13 @@ kind: Deployment
metadata: metadata:
name: {{ template "chronograf.fullname" . }} name: {{ template "chronograf.fullname" . }}
labels: labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }} app: {{ template "chronograf.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}" release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}" heritage: "{{ .Release.Service }}"
{{- end }}
{{- include "chronograf.labels" . | nindent 4 }}
spec: spec:
replicas: {{ .Values.service.replicas }} replicas: {{ .Values.service.replicas }}
strategy: strategy:
...@@ -16,11 +19,17 @@ spec: ...@@ -16,11 +19,17 @@ spec:
{{- end }} {{- end }}
selector: selector:
matchLabels: matchLabels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }} app: {{ template "chronograf.fullname" . }}
{{- end }}
{{- include "chronograf.selectorLabels" . | nindent 6 }}
template: template:
metadata: metadata:
labels: labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }} app: {{ template "chronograf.fullname" . }}
{{- end }}
{{- include "chronograf.selectorLabels" . | nindent 8 }}
spec: spec:
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
...@@ -179,7 +188,7 @@ spec: ...@@ -179,7 +188,7 @@ spec:
path: {{ .Values.env.BASE_PATH }}/ping path: {{ .Values.env.BASE_PATH }}/ping
{{- else }} {{- else }}
path: /ping path: /ping
{{- end}} {{- end }}
port: api port: api
readinessProbe: readinessProbe:
httpGet: httpGet:
...@@ -187,8 +196,19 @@ spec: ...@@ -187,8 +196,19 @@ spec:
path: {{ .Values.env.BASE_PATH }}/ping path: {{ .Values.env.BASE_PATH }}/ping
{{- else }} {{- else }}
path: /ping path: /ping
{{- end}} {{- end }}
port: api 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: volumeMounts:
- name: data - name: data
mountPath: /var/lib/chronograf mountPath: /var/lib/chronograf
......
...@@ -8,10 +8,13 @@ kind: Ingress ...@@ -8,10 +8,13 @@ kind: Ingress
metadata: metadata:
name: {{ template "chronograf.fullname" . }} name: {{ template "chronograf.fullname" . }}
labels: labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }} app: {{ template "chronograf.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}" release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}" heritage: "{{ .Release.Service }}"
{{- end }}
{{- include "chronograf.labels" . | nindent 4 }}
annotations: annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }} {{ toYaml .Values.ingress.annotations | indent 4 }}
spec: spec:
......
...@@ -4,10 +4,13 @@ kind: PersistentVolumeClaim ...@@ -4,10 +4,13 @@ kind: PersistentVolumeClaim
metadata: metadata:
name: {{ template "chronograf.fullname" . }} name: {{ template "chronograf.fullname" . }}
labels: labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }} app: {{ template "chronograf.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}" release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}" heritage: "{{ .Release.Service }}"
{{- end }}
{{- include "chronograf.labels" . | nindent 4 }}
annotations: annotations:
{{- if .Values.persistence.keepPvc }} {{- if .Values.persistence.keepPvc }}
"helm.sh/resource-policy": keep "helm.sh/resource-policy": keep
......
...@@ -3,6 +3,8 @@ apiVersion: v1 ...@@ -3,6 +3,8 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ template "chronograf.fullname" . }} name: {{ template "chronograf.fullname" . }}
labels:
{{- include "chronograf.labels" . | nindent 4 }}
type: Opaque type: Opaque
data: data:
token_secret: {{ .Values.oauth.token_secret | b64enc | quote }} token_secret: {{ .Values.oauth.token_secret | b64enc | quote }}
......
...@@ -3,14 +3,20 @@ kind: Service ...@@ -3,14 +3,20 @@ kind: Service
metadata: metadata:
name: {{ template "chronograf.fullname" . }} name: {{ template "chronograf.fullname" . }}
labels: labels:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }} app: {{ template "chronograf.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}" release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}" heritage: "{{ .Release.Service }}"
{{- end }}
{{- include "chronograf.labels" . | nindent 4 }}
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
- port: 80 - port: 80
targetPort: 8888 targetPort: 8888
selector: selector:
{{- if eq "true" (include "chronograf.legacyLabels" .) }}
app: {{ template "chronograf.fullname" . }} app: {{ template "chronograf.fullname" . }}
{{- end }}
{{- include "chronograf.selectorLabels" . | nindent 4 }}
...@@ -57,6 +57,12 @@ tolerations: [] ...@@ -57,6 +57,12 @@ tolerations: []
## ##
affinity: {} 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 ## Configure the ingress object to hook into existing infastructure
## ref : http://kubernetes.io/docs/user-guide/ingress/ ## ref : http://kubernetes.io/docs/user-guide/ingress/
## OPTIONALLY you can set .Values.ingress.secretName to set which secret to use ## 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