Skip to content

Commit

Permalink
Merge pull request #10 from WyriHaximusNet/add-readme-and-notes-to-do…
Browse files Browse the repository at this point in the history
…cker-hub-exporter

Add readme, notes, and tests to docker-hub-exporter
  • Loading branch information
WyriHaximus authored May 21, 2020
2 parents a5dd29e + c7b32ec commit 2d2b6a2
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/docker-hub-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Docker Hub exporter
home: https://github.com/jessestuart/docker-hub-exporter
icon: https://helm.wyrihaximus.net/images/charts/docker-hub-exporter.png
type: application
version: 0.1.0
version: 0.2.0
appVersion: d05df48
maintainers:
- name: WyriHaximus
Expand Down
22 changes: 22 additions & 0 deletions charts/docker-hub-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Docker Hub Exporter

Opinionated helm chart for [`jessestuart/docker-hub-exporter`](https://github.com/jessestuart/docker-hub-exporter).

## Configuration

While the underlying docker image supports specific docker images this helm chart only lets you configure
`organisations`. There are also two dashboards included, one for InfluxDB and one for Prometheus.

### Sample configuration

```yaml
organisations: wyrihaximusnet

grafana:
prometheus: true
```
## Opinionated decisions
* Port is hardcoded to `9170` for the metrics.
* Only gather metrics for full organizations and users.
7 changes: 7 additions & 0 deletions charts/docker-hub-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Congratulations, your prometheus compatible scraped Docker hub metrics are now available for scraping.

You can access them by using a port forward:
kubectl port-forward svc/{{ include ".helm.fullname" . }} 9170:9170 -n {{ .Release.Namespace }}

And then point your browser to:
http://localhost:9170/
20 changes: 13 additions & 7 deletions charts/docker-hub-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,30 @@ spec:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: {{ .Values.service.port | quote}}
prometheus.io/port: "9170"
labels:
app: {{ include ".helm.fullname" . }}
release: {{ include ".helm.fullname" . }}
{{- include ".helm.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: docker-hub-exporter
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: metrics
containerPort: {{ .Values.service.port }}
containerPort: 9170
protocol: TCP
livenessProbe:
initialDelaySeconds: 5
httpGet:
path: /
port: metrics
readinessProbe:
initialDelaySeconds: 5
httpGet:
path: /
port: metrics
args:
- -listen-address=:{{ .Values.service.port }}
- -listen-address=:9170
- -organisations={{ .Values.organisations }}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ data:
"hide": false,
"instant": false,
"interval": "",
"legendFormat": "\{\{image}} (\{\{user\}\})",
"legendFormat": "{{"{{"}}image{{"}}"}} ({{"{{"}}user{{"}}"}})",
"refId": "A"
}
],
Expand Down Expand Up @@ -271,7 +271,7 @@ data:
{
"expr": "sum(docker_hub_image_stars_gauge{user=~\"$user\"}) by (image, user)",
"interval": "",
"legendFormat": "\{\{image}} (\{\{user\}\})",
"legendFormat": "{{"{{"}}image{{"}}"}} ({{"{{"}}user{{"}}"}})",
"refId": "A"
}
],
Expand Down
4 changes: 2 additions & 2 deletions charts/docker-hub-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ metadata:
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
- port: 9170
targetPort: metrics
protocol: TCP
name: metrics
selector:
Expand Down
15 changes: 15 additions & 0 deletions charts/docker-hub-exporter/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include ".helm.fullname" . }}-test-connection"
labels:
{{ include ".helm.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include ".helm.fullname" . }}:9170']
restartPolicy: Never
3 changes: 0 additions & 3 deletions charts/docker-hub-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ organisations: YOUR_USER_OR_ORG
grafana:
influxdb: false
prometheus: false

service:
port: 9170

0 comments on commit 2d2b6a2

Please sign in to comment.