From d3f76d06fb9e93974c645babe859ae660efa408d 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 10:27:15 +0100 Subject: [PATCH] [stable/orangehrm] Add apache exporter (#8848) * [stable/orangehrm] Add apache exporter Signed-off-by: Javier J. Salmeron Garcia * Add podAnnotations Signed-off-by: Javier J. Salmeron Garcia --- stable/orangehrm/Chart.yaml | 2 +- stable/orangehrm/README.md | 9 ++++++ stable/orangehrm/templates/_helpers.tpl | 10 ++++++ stable/orangehrm/templates/deployment.yaml | 36 ++++++++++++++++++++++ stable/orangehrm/values.yaml | 29 +++++++++++++++++ 5 files changed, 85 insertions(+), 1 deletion(-) diff --git a/stable/orangehrm/Chart.yaml b/stable/orangehrm/Chart.yaml index d81704b376..8e92d0db2f 100644 --- a/stable/orangehrm/Chart.yaml +++ b/stable/orangehrm/Chart.yaml @@ -1,5 +1,5 @@ name: orangehrm -version: 3.1.2 +version: 3.2.0 appVersion: 4.1.2-1 description: OrangeHRM is a free HR management system that offers a wealth of modules to suit the needs of your business. diff --git a/stable/orangehrm/README.md b/stable/orangehrm/README.md index b3807115c9..625389d707 100644 --- a/stable/orangehrm/README.md +++ b/stable/orangehrm/README.md @@ -86,6 +86,15 @@ The following table lists the configurable parameters of the OrangeHRM chart and | `mariadb.persistence.storageClass` | PVC Storage Class for MariaDB volume | `nil` (uses alpha storage class annotation) | | `mariadb.persistence.accessMode` | PVC Access Mode for MariaDB volume | `ReadWriteOnce` | | `mariadb.persistence.size` | PVC Storage Request for MariaDB volume | `8Gi` | +| `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/orangehrm](http://github.com/bitnami/bitnami-docker-orangehrm). For more information please refer to the [bitnami/orangehrm](http://github.com/bitnami/bitnami-docker-orangehrm) image documentation. diff --git a/stable/orangehrm/templates/_helpers.tpl b/stable/orangehrm/templates/_helpers.tpl index c1f57c5232..c9266a39db 100644 --- a/stable/orangehrm/templates/_helpers.tpl +++ b/stable/orangehrm/templates/_helpers.tpl @@ -45,3 +45,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/orangehrm/templates/deployment.yaml b/stable/orangehrm/templates/deployment.yaml index cf4c8bded7..cb873eb84e 100644 --- a/stable/orangehrm/templates/deployment.yaml +++ b/stable/orangehrm/templates/deployment.yaml @@ -18,6 +18,15 @@ spec: app: {{ template "orangehrm.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" +{{- 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: @@ -25,6 +34,10 @@ spec: - name: {{ . }} {{- end}} {{- end }} + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "status.localhost" containers: - name: {{ template "orangehrm.fullname" . }} image: {{ template "orangehrm.image" . }} @@ -103,6 +116,29 @@ spec: mountPath: /bitnami/orangehrm - name: apache-data mountPath: /bitnami/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 10 }} +{{- end }} volumes: - name: orangehrm-data {{- if .Values.persistence.enabled }} diff --git a/stable/orangehrm/values.yaml b/stable/orangehrm/values.yaml index e969301f18..8f548b2261 100644 --- a/stable/orangehrm/values.yaml +++ b/stable/orangehrm/values.yaml @@ -151,3 +151,32 @@ 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: {}