From 95a5571017a217ce8fe2fff7d2524f70c06ae834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20J=2E=20Salmer=C3=B3n-Garc=C3=ADa?= Date: Wed, 31 Oct 2018 11:56:06 +0100 Subject: [PATCH] [stable/suitecrm] Add apache exporter (#8859) * [stable/suitecrm] Add apache exporter Signed-off-by: Javier J. Salmeron Garcia * [stable/suitecrm] Add podAnnotations Signed-off-by: Javier J. Salmeron Garcia * [stable/suitecrm] Add podAnnotations Signed-off-by: Javier J. Salmeron Garcia --- stable/suitecrm/Chart.yaml | 2 +- stable/suitecrm/README.md | 9 ++++++ stable/suitecrm/templates/_helpers.tpl | 10 +++++++ stable/suitecrm/templates/deployment.yaml | 36 +++++++++++++++++++++++ stable/suitecrm/values.yaml | 28 ++++++++++++++++++ 5 files changed, 84 insertions(+), 1 deletion(-) diff --git a/stable/suitecrm/Chart.yaml b/stable/suitecrm/Chart.yaml index b40de557cc..955e6c3fcd 100644 --- a/stable/suitecrm/Chart.yaml +++ b/stable/suitecrm/Chart.yaml @@ -1,5 +1,5 @@ name: suitecrm -version: 4.0.2 +version: 4.1.0 appVersion: 7.10.10 description: SuiteCRM is a completely open source enterprise-grade Customer Relationship Management (CRM) application. SuiteCRM is a software fork of the popular customer relationship management (CRM) system SugarCRM. keywords: diff --git a/stable/suitecrm/README.md b/stable/suitecrm/README.md index cf587c311a..b32bd5ddf8 100644 --- a/stable/suitecrm/README.md +++ b/stable/suitecrm/README.md @@ -86,6 +86,15 @@ The following table lists the configurable parameters of the SuiteCRM chart and | `persistence.accessMode` | PVC Access Mode for SuiteCRM volume | `ReadWriteOnce` | | `persistence.size` | PVC Storage Request for SuiteCRM volume | `8Gi` | | `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` | +| `podAnnotations` | Pod annotations | `{}` | +| `metrics.enabled` | Start a side-car prometheus exporter | `false` | +| `metrics.image.registry` | Apache exporter image registry | `docker.io` | +| `metrics.image.repository` | Apache exporter image name | `lusotycoon/apache-exporter` | +| `metrics.image.tag` | Apache exporter image tag | `v0.5.0` | +| `metrics.image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `nil` | +| `metrics.podAnnotations` | Additional annotations for Metrics exporter pod | `{prometheus.io/scrape: "true", prometheus.io/port: "9117"}` | +| `metrics.resources` | Exporter resource requests/limit | {} | The above parameters map to the env variables defined in [bitnami/suitecrm](http://github.com/bitnami/bitnami-docker-suitecrm). For more information please refer to the [bitnami/suitecrm](http://github.com/bitnami/bitnami-docker-suitecrm) image documentation. diff --git a/stable/suitecrm/templates/_helpers.tpl b/stable/suitecrm/templates/_helpers.tpl index 7bf975a9de..b3b4e56c4f 100644 --- a/stable/suitecrm/templates/_helpers.tpl +++ b/stable/suitecrm/templates/_helpers.tpl @@ -66,3 +66,13 @@ Also, we can't use a single if because lazy evaluation is not an option {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} {{- end -}} {{- end -}} + +{{/* +Return the proper image name (for the metrics image) +*/}} +{{- define "metrics.image" -}} +{{- $registryName := .Values.metrics.image.registry -}} +{{- $repositoryName := .Values.metrics.image.repository -}} +{{- $tag := .Values.metrics.image.tag | toString -}} +{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} diff --git a/stable/suitecrm/templates/deployment.yaml b/stable/suitecrm/templates/deployment.yaml index 05717254f2..0dd991547e 100644 --- a/stable/suitecrm/templates/deployment.yaml +++ b/stable/suitecrm/templates/deployment.yaml @@ -19,6 +19,15 @@ spec: app: {{ template "suitecrm.name" . }} release: "{{ .Release.Name }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +{{- if or .Values.podAnnotations .Values.metrics.enabled }} + annotations: + {{- if .Values.podAnnotations }} +{{ toYaml .Values.podAnnotations | indent 8 }} + {{- end }} + {{- if .Values.metrics.podAnnotations }} +{{ toYaml .Values.metrics.podAnnotations | indent 8 }} + {{- end }} +{{- end }} spec: {{- if .Values.image.pullSecrets }} imagePullSecrets: @@ -26,6 +35,10 @@ spec: - name: {{ . }} {{- end}} {{- end }} + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "status.localhost" containers: - name: {{ template "suitecrm.fullname" . }} image: {{ template "suitecrm.image" . }} @@ -120,6 +133,29 @@ spec: - name: suitecrm-data mountPath: /bitnami/apache subPath: apache +{{- if .Values.metrics.enabled }} + - name: metrics + image: {{ template "metrics.image" . }} + imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} + command: [ '/bin/apache_exporter', '-scrape_uri', 'http://status.localhost:80/server-status/?auto'] + ports: + - name: metrics + containerPort: 9117 + livenessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: 15 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: 5 + timeoutSeconds: 1 + resources: +{{ toYaml .Values.metrics.resources | indent 12 }} +{{- end }} volumes: - name: suitecrm-data {{- if .Values.persistence.enabled }} diff --git a/stable/suitecrm/values.yaml b/stable/suitecrm/values.yaml index ca20d6ee18..f21a2b8ca1 100644 --- a/stable/suitecrm/values.yaml +++ b/stable/suitecrm/values.yaml @@ -175,3 +175,31 @@ resources: {} # requests: # memory: 512Mi # cpu: 300m + +## Pod annotations +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} +## Prometheus Exporter / Metrics +## +metrics: + enabled: false + image: + registry: docker.io + repository: lusotycoon/apache-exporter + tag: v0.5.0 + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistrKeySecretName + ## Metrics exporter pod Annotation and Labels + podAnnotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9117" + ## Metrics exporter resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + # resources: {}