[uptimerobot-prometheus] Migrated to common library (#902)

* Migrated to common library

Signed-off-by: Nicholas Wilde <ncwilde43@gmail.com>

* Added Prometheus ServiceMonitor

Signed-off-by: Nicholas Wilde <ncwilde43@gmail.com>
This commit is contained in:
nιcнolaѕ wιlde 2021-05-11 06:02:52 -07:00 committed by GitHub
parent b842379fef
commit 17234658c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 84 additions and 223 deletions

View File

@ -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

View File

@ -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

View File

@ -143,3 +143,4 @@ helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }} -
{{ template "custom.support" . }}
{{ template "helm-docs.versionFooter" . }}
{{ "" }}

View File

@ -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 -}}

View File

@ -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" . -}}

View File

@ -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 -}}

View File

@ -0,0 +1 @@
{{ include "common.all" . }}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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: {}