From d28405f4b93fe1476fc664026f3f2b6310a1f4fb Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Sun, 16 Aug 2020 14:37:12 -0400 Subject: [PATCH] Added tempest-pushgateway Change-Id: Iea0659f8290044948492dc25dd92b3566af62727 --- charts/tempest-pushgateway/Chart.yaml | 11 ++++ .../templates/_helpers.tpl | 41 +++++++++++++ .../templates/cronjob.yaml | 33 +++++++++++ .../templates/prometheusrule.yaml | 57 +++++++++++++++++++ .../tempest-pushgateway/templates/secret.yaml | 10 ++++ charts/tempest-pushgateway/values.yaml | 15 +++++ 6 files changed, 167 insertions(+) create mode 100644 charts/tempest-pushgateway/Chart.yaml create mode 100644 charts/tempest-pushgateway/templates/_helpers.tpl create mode 100644 charts/tempest-pushgateway/templates/cronjob.yaml create mode 100644 charts/tempest-pushgateway/templates/prometheusrule.yaml create mode 100644 charts/tempest-pushgateway/templates/secret.yaml create mode 100644 charts/tempest-pushgateway/values.yaml diff --git a/charts/tempest-pushgateway/Chart.yaml b/charts/tempest-pushgateway/Chart.yaml new file mode 100644 index 0000000..558ade5 --- /dev/null +++ b/charts/tempest-pushgateway/Chart.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: v1 +name: tempest-pushgateway +version: 0.0.0 +description: Tempest cron job pushing data to Prometheus Pushgateway +home: https://github.com/vexxhost/helm-charts +maintainers: +- name: Mohammed Naser + email: mnaser@vexxhost.com + url: https://github.com/mnaser +appVersion: v1.0.0 diff --git a/charts/tempest-pushgateway/templates/_helpers.tpl b/charts/tempest-pushgateway/templates/_helpers.tpl new file mode 100644 index 0000000..83bc3c5 --- /dev/null +++ b/charts/tempest-pushgateway/templates/_helpers.tpl @@ -0,0 +1,41 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "tempest-pushgateway.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "tempest-pushgateway.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Generate basic labels +*/}} +{{- define "tempest-pushgateway.labels" }} +app.kubernetes.io/name: {{ include "tempest-pushgateway.fullname" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/component: metrics +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "tempest-pushgateway.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/charts/tempest-pushgateway/templates/cronjob.yaml b/charts/tempest-pushgateway/templates/cronjob.yaml new file mode 100644 index 0000000..8f755f0 --- /dev/null +++ b/charts/tempest-pushgateway/templates/cronjob.yaml @@ -0,0 +1,33 @@ +--- +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + namespace: {{ .Release.Namespace }} + name: {{ include "tempest-pushgateway.fullname" . }} + labels: +{{- include "tempest-pushgateway.labels" . | indent 4 }} +spec: + schedule: "*/5 * * * *" + concurrencyPolicy: Forbid + jobTemplate: + spec: + backoffLimit: 0 + template: + metadata: + labels: +{{- include "tempest-pushgateway.labels" . | indent 12 }} + spec: + restartPolicy: Never + containers: + - name: tempest-pushgateway + image: {{ .Values.image }} + envFrom: + - secretRef: + name: {{ include "tempest-pushgateway.fullname" . }} + args: +{{ toYaml .Values.tests | indent 12 }} + tolerations: + - effect: NoSchedule + key: node-role.kubernetes.io/master + nodeSelector: + node-role.kubernetes.io/master: "" diff --git a/charts/tempest-pushgateway/templates/prometheusrule.yaml b/charts/tempest-pushgateway/templates/prometheusrule.yaml new file mode 100644 index 0000000..a16de17 --- /dev/null +++ b/charts/tempest-pushgateway/templates/prometheusrule.yaml @@ -0,0 +1,57 @@ +--- +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + namespace: {{ .Release.Namespace }} + name: {{ include "tempest-pushgateway.fullname" . }} + labels: +{{ include "tempest-pushgateway.labels" . | indent 4 }} +spec: + groups: + - name: tempest + rules: + - alert: TempestTestNotRunning + expr: | + time() - tempest_last_run_unixtime > 900 + labels: + severity: P3 + annotations: + summary: "[`{{`{{$labels.instance}}`}}`] Tempest not reporting" + description: > + Tempest has not reported in for over 15 minutes which means that the + tests are not running and the state of the cloud is unknown. + + - alert: TempestTestFailure + expr: | + tempest_last_run_result{tempest_last_run_result="success"} != 1 + labels: + severity: P5 + annotations: + summary: "[`{{`{{$labels.instance}}`}}`] Tempest test failure" + description: > + The test `{{`{{$labels.instance}}`}}` has failed in it's most recent + run. + + - alert: TempestTestFailure + for: 8m + expr: | + tempest_last_run_result{tempest_last_run_result="success"} != 1 + labels: + severity: P4 + annotations: + summary: "[`{{`{{$labels.instance}}`}}`] Tempest test failure" + description: > + The test `{{`{{$labels.instance}}`}}` has failed in it's most recent + run for 8 minutes. + + - alert: TempestTestFailure + for: 13m + expr: | + tempest_last_run_result{tempest_last_run_result="success"} != 1 + labels: + severity: P3 + annotations: + summary: "[`{{`{{$labels.instance}}`}}`] Tempest test failure" + description: > + The test `{{`{{$labels.instance}}`}}` has failed in it's most recent + run for 13 minutes. diff --git a/charts/tempest-pushgateway/templates/secret.yaml b/charts/tempest-pushgateway/templates/secret.yaml new file mode 100644 index 0000000..b2a7d12 --- /dev/null +++ b/charts/tempest-pushgateway/templates/secret.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + namespace: {{ .Release.Namespace }} + name: {{ include "tempest-pushgateway.fullname" . }} + labels: +{{- include "tempest-pushgateway.labels" . | indent 4 }} +stringData: +{{ toYaml .Values.env | indent 2 -}} diff --git a/charts/tempest-pushgateway/values.yaml b/charts/tempest-pushgateway/values.yaml new file mode 100644 index 0000000..6127e86 --- /dev/null +++ b/charts/tempest-pushgateway/values.yaml @@ -0,0 +1,15 @@ +--- +image: vexxhost/tempest-pushgateway:latest + +tests: +- tempest.api.compute.servers.test_create_server.ServersTestBootFromVolume.test_verify_server_details +- heat_tempest_plugin.tests.api.test_heat_api.resources_create_stack_with_resources.test_request +- tempest_horizon.tests.scenario.test_dashboard_basic_ops.TestDashboardBasicOps + +env: + OS_AUTH_TYPE: password + OS_AUTH_URL: http://keystone.openstack.svc.cluster.local + OS_USER_DOMAIN_ID: default + OS_PROJECT_DOMAIN_ID: default + TEMPEST_PROMETHEUS: prometheus-pushgateway:9091 + TEMPEST_HORIZON_URL: http://horizon.openstack.svc.cluster.local