From 6c64e16c7ae2d277cbd57012c95c34066f3d6476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20J=2E=20Salmer=C3=B3n-Garc=C3=ADa?= Date: Tue, 30 Oct 2018 17:10:50 +0100 Subject: [PATCH] [stable/phabricator] Add apache exporter (#8852) * [stable/phabricator] Add apache exporter Signed-off-by: Javier J. Salmeron Garcia * [stable/phabricator] Add podAnnotations Signed-off-by: Javier J. Salmeron Garcia * [stable/phabricator] Add podAnnotations Signed-off-by: Javier J. Salmeron Garcia --- stable/phabricator/Chart.yaml | 2 +- stable/phabricator/README.md | 9 +++++ stable/phabricator/templates/_helpers.tpl | 10 ++++++ stable/phabricator/templates/deployment.yaml | 36 ++++++++++++++++++++ stable/phabricator/values.yaml | 28 +++++++++++++++ 5 files changed, 84 insertions(+), 1 deletion(-) diff --git a/stable/phabricator/Chart.yaml b/stable/phabricator/Chart.yaml index 2b6d545511..6a004d823b 100644 --- a/stable/phabricator/Chart.yaml +++ b/stable/phabricator/Chart.yaml @@ -1,5 +1,5 @@ name: phabricator -version: 3.2.4 +version: 3.3.0 appVersion: 2018.43.0 description: Collection of open source web applications that help software companies build better software. keywords: diff --git a/stable/phabricator/README.md b/stable/phabricator/README.md index 5e294b0d17..76656413d0 100644 --- a/stable/phabricator/README.md +++ b/stable/phabricator/README.md @@ -88,6 +88,15 @@ The following table lists the configurable parameters of the Phabricator chart a | `ingress.secrets[0].name` | TLS Secret Name | `nil` | | `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` | | `ingress.secrets[0].key` | TLS Secret Key | `nil` | +| `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/phabricator](http://github.com/bitnami/bitnami-docker-phabricator). For more information please refer to the [bitnami/phabricator](http://github.com/bitnami/bitnami-docker-phabricator) image documentation. diff --git a/stable/phabricator/templates/_helpers.tpl b/stable/phabricator/templates/_helpers.tpl index 6e404fafe0..0d5b7de994 100644 --- a/stable/phabricator/templates/_helpers.tpl +++ b/stable/phabricator/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/phabricator/templates/deployment.yaml b/stable/phabricator/templates/deployment.yaml index 6e224e2a08..a64a1bd713 100644 --- a/stable/phabricator/templates/deployment.yaml +++ b/stable/phabricator/templates/deployment.yaml @@ -19,6 +19,15 @@ spec: app: {{ template "phabricator.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: @@ -26,6 +35,10 @@ spec: - name: {{ . }} {{- end}} {{- end }} + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "status.localhost" containers: - name: {{ template "phabricator.fullname" . }} image: {{ template "phabricator.image" . }} @@ -120,6 +133,29 @@ spec: mountPath: /bitnami/phabricator - 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: phabricator-data {{- if .Values.persistence.enabled }} diff --git a/stable/phabricator/values.yaml b/stable/phabricator/values.yaml index dcfefca5b0..ba999c720c 100644 --- a/stable/phabricator/values.yaml +++ b/stable/phabricator/values.yaml @@ -194,3 +194,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: {}