diff --git a/stable/grafana/Chart.yaml b/stable/grafana/Chart.yaml index 36e0ff45f2..038656797d 100755 --- a/stable/grafana/Chart.yaml +++ b/stable/grafana/Chart.yaml @@ -1,5 +1,5 @@ name: grafana -version: 0.6.2 +version: 0.7.0 description: The leading tool for querying and visualizing time series and metrics. home: https://grafana.net icon: https://raw.githubusercontent.com/grafana/grafana/master/public/img/logo_transparent_400x.png diff --git a/stable/grafana/README.md b/stable/grafana/README.md index b12c356c53..e55c8a3e94 100644 --- a/stable/grafana/README.md +++ b/stable/grafana/README.md @@ -34,6 +34,8 @@ The command removes all the Kubernetes components associated with the chart and | `server.image` | Container image to run | grafana/grafana:4.6.3 | | `server.adminUser` | Admin user username | admin | | `server.adminPassword` | Admin user password | Randomly generated | +| `server.antiAffinity.enabled` | Enable anti affinity | false | +| `server.antiAffinity.type` | Hard or soft anti affinity | hard | | `server.persistentVolume.enabled` | Create a volume to store data | true | | `server.persistentVolume.size` | Size of persistent volume claim | 1Gi RW | | `server.persistentVolume.storageClass` | Type of persistent volume claim | `nil` (uses alpha storage class annotation) | @@ -41,6 +43,7 @@ The command removes all the Kubernetes components associated with the chart and | `server.persistentVolume.existingClaim` | Existing persistent volume claim | null | | `server.persistentVolume.subPath` | Subdirectory of pvc to mount | null | | `server.readinessProbe` | Server readiness probe | httpGet: {path: /api/health, port: 3000}, initialDelaySeconds: 30, timeoutSeconds: 30 | +| `server.replicaCount` | Desired number of grafana pods | 1 | | `server.resources` | Server resource requests and limits | requests: {cpu: 100m, memory: 100Mi} | | `server.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | null | | `server.service.annotations` | Service annotations | null | diff --git a/stable/grafana/templates/deployment.yaml b/stable/grafana/templates/deployment.yaml index 2acc8639e7..0cec966dfa 100644 --- a/stable/grafana/templates/deployment.yaml +++ b/stable/grafana/templates/deployment.yaml @@ -9,7 +9,7 @@ metadata: release: "{{ .Release.Name }}" name: {{ template "grafana.server.fullname" . }} spec: - replicas: 1 + replicas: {{ .Values.server.replicaCount }} template: metadata: annotations: @@ -29,6 +29,27 @@ spec: tolerations: {{ toYaml .Values.server.tolerations | indent 8 }} {{- end }} + {{- if .Values.server.antiAffinity.enabled }} + affinity: + podAntiAffinity: + {{- $antiAffinityType := default "hard" .Values.server.antiAffinity.type | lower }} + {{- if eq $antiAffinityType "hard" }} + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: "kubernetes.io/hostname" + labelSelector: + matchLabels: + app: {{ template "grafana.server.fullname" . }} + {{- end }} + {{- if eq $antiAffinityType "soft" }} + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + podAffinityTerm: + topologyKey: "kubernetes.io/hostname" + labelSelector: + matchLabels: + app: {{ template "grafana.server.fullname" . }} + {{- end }} + {{- end }} containers: - name: {{ template "grafana.name" . }} image: "{{ .Values.server.image }}" diff --git a/stable/grafana/values.yaml b/stable/grafana/values.yaml index 35ec0dc1c5..2f5ea6ec4e 100644 --- a/stable/grafana/values.yaml +++ b/stable/grafana/values.yaml @@ -12,6 +12,14 @@ server: nodeSelector: {} tolerations: [] + # Multiple replicas do not work with the default sqlite database, + # see http://docs.grafana.org/tutorials/ha_setup/. + replicaCount: 1 + + antiAffinity: + enabled: false + type: hard + ingress: ## If true, Grafana Ingress will be created ##