From 17234658c8b6825ae0049d310d2fdd9c49e7965e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?n=CE=B9c=D0=BDola=D1=95=20w=CE=B9lde?= Date: Tue, 11 May 2021 06:02:52 -0700 Subject: [PATCH] [uptimerobot-prometheus] Migrated to common library (#902) * Migrated to common library Signed-off-by: Nicholas Wilde * Added Prometheus ServiceMonitor Signed-off-by: Nicholas Wilde --- .../stable/uptimerobot-prometheus/Chart.yaml | 20 +++--- .../stable/uptimerobot-prometheus/README.md | 41 ++++++----- .../uptimerobot-prometheus/README.md.gotmpl | 1 + .../README_CHANGELOG.md.gotmpl | 17 ++++- .../templates/NOTES.txt | 16 +---- .../templates/_helpers.tpl | 52 -------------- .../templates/common.yaml | 1 + .../templates/deployment.yaml | 49 ------------- .../templates/service.yaml | 19 ----- .../templates/servicemonitor.yaml | 22 +++--- .../stable/uptimerobot-prometheus/values.yaml | 69 ++++++------------- 11 files changed, 84 insertions(+), 223 deletions(-) delete mode 100644 charts/stable/uptimerobot-prometheus/templates/_helpers.tpl create mode 100644 charts/stable/uptimerobot-prometheus/templates/common.yaml delete mode 100644 charts/stable/uptimerobot-prometheus/templates/deployment.yaml delete mode 100644 charts/stable/uptimerobot-prometheus/templates/service.yaml diff --git a/charts/stable/uptimerobot-prometheus/Chart.yaml b/charts/stable/uptimerobot-prometheus/Chart.yaml index 0d7ff968..2907a29c 100644 --- a/charts/stable/uptimerobot-prometheus/Chart.yaml +++ b/charts/stable/uptimerobot-prometheus/Chart.yaml @@ -2,17 +2,21 @@ apiVersion: v2 name: uptimerobot-prometheus description: Prometheus Exporter for the official uptimerobot CLI type: application -version: 2.0.4 +version: 3.0.0 appVersion: 0.0.1 keywords: -- uptimerobot -- prometheus -- grafana + - uptimerobot + - prometheus + - grafana home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/uptimerobot-prometheus icon: https://cdn.foliovision.com/images/2019/03/icon-uptimerobot-1024.png sources: -- https://github.com/lekpamartin/uptimerobot_exporter -- https://github.com/k8s-at-home/charts/tree/master/charts/uptimerobot-prometheus + - https://github.com/lekpamartin/uptimerobot_exporter + - https://github.com/k8s-at-home/charts/tree/master/charts/uptimerobot-prometheus maintainers: -- name: billimek - email: jeff@billimek.com + - name: billimek + email: jeff@billimek.com +dependencies: + - name: common + repository: https://library-charts.k8s-at-home.com + version: 2.5.0 diff --git a/charts/stable/uptimerobot-prometheus/README.md b/charts/stable/uptimerobot-prometheus/README.md index 55e934d1..00d8db05 100644 --- a/charts/stable/uptimerobot-prometheus/README.md +++ b/charts/stable/uptimerobot-prometheus/README.md @@ -1,6 +1,6 @@ # uptimerobot-prometheus -![Version: 2.0.4](https://img.shields.io/badge/Version-2.0.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square) +![Version: 3.0.0](https://img.shields.io/badge/Version-3.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square) Prometheus Exporter for the official uptimerobot CLI @@ -17,6 +17,7 @@ Prometheus Exporter for the official uptimerobot CLI | Repository | Name | Version | |------------|------|---------| +| https://library-charts.k8s-at-home.com | common | 2.5.0 | ## TL;DR @@ -75,26 +76,13 @@ You can find an [example grafana dashboard](https://github.com/lekpamartin/uptim | Key | Type | Default | Description | |-----|------|---------|-------------| -| affinity | object | `{}` | | -| fullnameOverride | string | `""` | | +| env.UPTIMEROBOT_API_KEY | string | `""` | | | image.pullPolicy | string | `"IfNotPresent"` | | | image.repository | string | `"billimek/prometheus-uptimerobot-exporter"` | | | image.tag | string | `"0.0.1"` | | -| imagePullSecrets | list | `[]` | | -| nameOverride | string | `""` | | -| nodeSelector | object | `{}` | | -| podSecurityContext | object | `{}` | | -| replicaCount | int | `1` | | -| resources | object | `{}` | | -| securityContext | object | `{}` | | -| service.port | int | `9705` | | -| service.type | string | `"ClusterIP"` | | -| serviceMonitor.additionalLabels | object | `{}` | | -| serviceMonitor.enabled | bool | `false` | | -| serviceMonitor.interval | string | `"5m"` | | -| serviceMonitor.scrapeTimeout | string | `"90s"` | | -| tolerations | list | `[]` | | -| uptimerobotApiKey | string | `""` | | +| ingress.enabled | bool | `false` | | +| service.port.port | int | `9705` | | +| strategy.type | string | `"Recreate"` | | ## Changelog @@ -102,6 +90,20 @@ All notable changes to this application Helm chart will be documented in this fi The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [3.0.0] + +#### Added + +- N/A + +#### Changed + +- **BREAKING** Migrate to the common library, a lot of configuration has changed. + +#### Removed + +- N/A + ### [2.0.2] #### Added @@ -116,7 +118,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - N/A -[2.0.2]: #2.0.2 +[3.0.0]: #300 +[2.0.2]: #202 ## Support diff --git a/charts/stable/uptimerobot-prometheus/README.md.gotmpl b/charts/stable/uptimerobot-prometheus/README.md.gotmpl index c21f99b3..358abe31 100644 --- a/charts/stable/uptimerobot-prometheus/README.md.gotmpl +++ b/charts/stable/uptimerobot-prometheus/README.md.gotmpl @@ -143,3 +143,4 @@ helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }} - {{ template "custom.support" . }} {{ template "helm-docs.versionFooter" . }} +{{ "" }} diff --git a/charts/stable/uptimerobot-prometheus/README_CHANGELOG.md.gotmpl b/charts/stable/uptimerobot-prometheus/README_CHANGELOG.md.gotmpl index c11e2738..c103e2f1 100644 --- a/charts/stable/uptimerobot-prometheus/README_CHANGELOG.md.gotmpl +++ b/charts/stable/uptimerobot-prometheus/README_CHANGELOG.md.gotmpl @@ -9,6 +9,20 @@ All notable changes to this application Helm chart will be documented in this fi The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [3.0.0] + +#### Added + +- N/A + +#### Changed + +- **BREAKING** Migrate to the common library, a lot of configuration has changed. + +#### Removed + +- N/A + ### [2.0.2] #### Added @@ -23,5 +37,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - N/A -[2.0.2]: #2.0.2 +[3.0.0]: #300 +[2.0.2]: #202 {{- end -}} diff --git a/charts/stable/uptimerobot-prometheus/templates/NOTES.txt b/charts/stable/uptimerobot-prometheus/templates/NOTES.txt index fafec45d..90f7b653 100644 --- a/charts/stable/uptimerobot-prometheus/templates/NOTES.txt +++ b/charts/stable/uptimerobot-prometheus/templates/NOTES.txt @@ -1,15 +1 @@ -1. Get the application URL by running these commands: -{{- if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "uptimerobot-prometheus.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "uptimerobot-prometheus.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "uptimerobot-prometheus.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "uptimerobot-prometheus.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 -{{- end }} +{{- include "common.notes.defaultNotes" . -}} diff --git a/charts/stable/uptimerobot-prometheus/templates/_helpers.tpl b/charts/stable/uptimerobot-prometheus/templates/_helpers.tpl deleted file mode 100644 index 4759eb85..00000000 --- a/charts/stable/uptimerobot-prometheus/templates/_helpers.tpl +++ /dev/null @@ -1,52 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "uptimerobot-prometheus.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 "uptimerobot-prometheus.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 -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "uptimerobot-prometheus.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Common labels -*/}} -{{- define "uptimerobot-prometheus.labels" -}} -helm.sh/chart: {{ include "uptimerobot-prometheus.chart" . }} -{{ include "uptimerobot-prometheus.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} - -{{/* -Selector labels -*/}} -{{- define "uptimerobot-prometheus.selectorLabels" -}} -app.kubernetes.io/name: {{ include "uptimerobot-prometheus.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end -}} diff --git a/charts/stable/uptimerobot-prometheus/templates/common.yaml b/charts/stable/uptimerobot-prometheus/templates/common.yaml new file mode 100644 index 00000000..a6613c2c --- /dev/null +++ b/charts/stable/uptimerobot-prometheus/templates/common.yaml @@ -0,0 +1 @@ +{{ include "common.all" . }} diff --git a/charts/stable/uptimerobot-prometheus/templates/deployment.yaml b/charts/stable/uptimerobot-prometheus/templates/deployment.yaml deleted file mode 100644 index 5943299e..00000000 --- a/charts/stable/uptimerobot-prometheus/templates/deployment.yaml +++ /dev/null @@ -1,49 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "uptimerobot-prometheus.fullname" . }} - labels: - {{- include "uptimerobot-prometheus.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - {{- include "uptimerobot-prometheus.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - {{- include "uptimerobot-prometheus.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - env: - - name: UPTIMEROBOT_API_KEY - value: "{{ .Values.uptimerobotApiKey }}" - ports: - - name: http - containerPort: 9705 - protocol: TCP - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/charts/stable/uptimerobot-prometheus/templates/service.yaml b/charts/stable/uptimerobot-prometheus/templates/service.yaml deleted file mode 100644 index 8e4b58f2..00000000 --- a/charts/stable/uptimerobot-prometheus/templates/service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "uptimerobot-prometheus.fullname" . }} - labels: - {{- include "uptimerobot-prometheus.labels" . | nindent 4 }} -{{- if .Values.service.annotations }} - annotations: -{{ toYaml .Values.service.annotations | indent 4 }} -{{- end }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "uptimerobot-prometheus.selectorLabels" . | nindent 4 }} diff --git a/charts/stable/uptimerobot-prometheus/templates/servicemonitor.yaml b/charts/stable/uptimerobot-prometheus/templates/servicemonitor.yaml index d20e75a3..5fdcf649 100644 --- a/charts/stable/uptimerobot-prometheus/templates/servicemonitor.yaml +++ b/charts/stable/uptimerobot-prometheus/templates/servicemonitor.yaml @@ -1,23 +1,21 @@ -{{- if .Values.serviceMonitor.enabled }} +{{- if .Values.prometheus.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ include "uptimerobot-prometheus.fullname" . }} + name: {{ template "common.names.fullname" . }} labels: - {{- include "uptimerobot-prometheus.labels" . | nindent 4 }} - {{- with .Values.serviceMonitor.additionalLabels }} + {{- include "common.labels" . | nindent 4 }} + {{- with .Values.prometheus.serviceMonitor.additionalLabels }} {{- toYaml . | nindent 4 }} - {{- end }} + {{- end }} spec: selector: matchLabels: - {{- include "uptimerobot-prometheus.selectorLabels" . | nindent 6 }} + {{- include "common.labels.selectorLabels" . | nindent 6 }} endpoints: - port: http - interval: {{ .Values.serviceMonitor.interval }} - path: / - params: - script: - - uptimerobot - scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + {{- with .Values.prometheus.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + path: /metrics {{- end }} diff --git a/charts/stable/uptimerobot-prometheus/values.yaml b/charts/stable/uptimerobot-prometheus/values.yaml index 2e382233..39a30a18 100644 --- a/charts/stable/uptimerobot-prometheus/values.yaml +++ b/charts/stable/uptimerobot-prometheus/values.yaml @@ -1,60 +1,33 @@ -# Default values for uptimerobot-prometheus. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 +# +# IMPORTANT NOTE +# +# This chart inherits from our common library chart. You can check the default values/options here: +# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml +# image: repository: billimek/prometheus-uptimerobot-exporter tag: 0.0.1 pullPolicy: IfNotPresent -uptimerobotApiKey: '' +strategy: + type: Recreate -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 +# See more environment variables in the uptimerobot-prometheus documentation +# https://github.com/lekpamartin/uptimerobot_exporter/blob/master/docker-compose.yml +env: + UPTIMEROBOT_API_KEY: "" service: - type: ClusterIP - port: 9705 - # Sometimes you may need to add annotations to the service - # to integrate with external operators - # annotations: - # prometheus.io/scrape: "true" + port: + port: 9705 -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi +# enable a prometheus-operator servicemonitor +prometheus: + serviceMonitor: + enabled: false + interval: 1m + additionalLabels: {} -nodeSelector: {} - -tolerations: [] - -affinity: {} - -serviceMonitor: +ingress: enabled: false - interval: "5m" - scrapeTimeout: 90s - # namespace: default - additionalLabels: {}