Skip to content

Commit 0a97fa4

Browse files
committed
feat: initial commit
Signed-off-by: clavinjune <[email protected]>
1 parent 78a0f25 commit 0a97fa4

16 files changed

+572
-1
lines changed

.github/workflows/releaser.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: releaser
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "main" branch
8+
push:
9+
branches: [ "main" ]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write # to push chart release and create a release (helm/chart-releaser-action)
20+
packages: write # needed for ghcr access
21+
id-token: write # needed for keyless signing
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
- run: |
29+
git config user.name "$GITHUB_ACTOR"
30+
git config user.email "[email protected]"
31+
- uses: helm/[email protected]
32+
env:
33+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
34+
CR_GENERATE_RELEASE_NOTES: true
35+
- uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Push charts to GHCR
41+
run: |
42+
shopt -s nullglob
43+
for pkg in .cr-release-packages/*; do
44+
if [ -z "${pkg:-}" ]; then
45+
break
46+
fi
47+
helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/helm-charts"
48+
done

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
override.yaml

README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
# helm-charts
1+
# helm-charts
2+
3+
## Get Repository Info
4+
5+
This repository support HTTPS and OCI:
6+
- [https://gopaytech.github.io/helm-charts]
7+
8+
```shell
9+
helm repo add gopaytech https://gopaytech.github.io/helm-charts
10+
helm repo update
11+
helm search repo gopaytech
12+
```

charts/mtr-exporter/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/mtr-exporter/Chart.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v2
2+
name: mtr-exporter
3+
version: "0.0.5"
4+
kubeVersion: ">= 1.29.0"
5+
description: A Helm chart for github.com/mgumz/mtr-exporter
6+
type: application
7+
keywords:
8+
- mtr
9+
- networking
10+
- observability
11+
home: https://gopaytech.github.io/helm-charts
12+
sources:
13+
- https://github.com/mgumz/mtr-exporter
14+
maintainers:
15+
- name: clavinjune
16+
17+
url: https://clavinjune.dev
18+
appVersion: "0.4.0"

charts/mtr-exporter/README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# mtr-exporter Helm Chart
2+
3+
Installs the [mtr-exporter](https://github.com/mgumz/mtr-exporter)
4+
5+
## Get Repository Info
6+
7+
```shell
8+
helm repo add gopaytech https://gopaytech.github.io/helm-charts
9+
helm repo update
10+
```
11+
12+
## Install Chart
13+
14+
```shell
15+
helm show values gopaytech/mtr-exporter > default.yaml
16+
# adjust the default.yaml
17+
helm install <release-name> gopaytech/mtr-exporter -f default.yaml [flags]
18+
```
19+
20+
## Jobs Configuration
21+
22+
See [jobs-file-syntax](https://github.com/mgumz/mtr-exporter?tab=readme-ov-file#jobs-file-syntax) for more detail
23+
24+
```yaml
25+
jobs:
26+
globalConfig:
27+
schedule: "@every 60s"
28+
flags: "--tcp --port 443 -c 10"
29+
config:
30+
9.9.9.9:
31+
schedule: "@every 120s"
32+
flags: "-I ven1 -n"
33+
example.com:
34+
schedule: "@every 45s"
35+
flags: "-I ven2 -n"
36+
foobar.io: {}
37+
```
38+
39+
Will be resulting in
40+
41+
```plaintext
42+
9.9.9.9 -- @every 120s -- -I ven1 -n 9.9.9.9
43+
example.com -- @every 45s -- -I ven2 -n example.com
44+
foobar.io -- @every 60s -- --tcp --port 443 -c 10 foobar.io
45+
```

charts/mtr-exporter/templates/NOTES.txt

Whitespace-only changes.
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "mtr-exporter.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "mtr-exporter.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "mtr-exporter.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "mtr-exporter.labels" -}}
37+
helm.sh/chart: {{ include "mtr-exporter.chart" . }}
38+
{{ include "mtr-exporter.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "mtr-exporter.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "mtr-exporter.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "mtr-exporter.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "mtr-exporter.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- $globalConfig := .Values.jobs.globalConfig -}}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "mtr-exporter.fullname" . }}
6+
labels:
7+
{{- include "mtr-exporter.labels" . | nindent 4 }}
8+
data:
9+
jobs.txt: |-
10+
{{- range $k, $v := .Values.jobs.config }}
11+
{{ $k }} -- {{ $v.schedule | default $globalConfig.schedule }} -- {{ $v.flags | default $globalConfig.flags }} {{ $k }}
12+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "mtr-exporter.fullname" . }}
5+
labels:
6+
{{- include "mtr-exporter.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
selector:
12+
matchLabels:
13+
{{- include "mtr-exporter.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "mtr-exporter.labels" . | nindent 8 }}
22+
{{- with .Values.podLabels }}
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
spec:
26+
{{- with .Values.imagePullSecrets }}
27+
imagePullSecrets:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
serviceAccountName: {{ include "mtr-exporter.serviceAccountName" . }}
31+
securityContext:
32+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
33+
containers:
34+
- name: {{ .Chart.Name }}
35+
securityContext:
36+
{{- toYaml .Values.securityContext | nindent 12 }}
37+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
38+
imagePullPolicy: {{ .Values.image.pullPolicy }}
39+
command:
40+
- /sbin/tini
41+
- --
42+
- /usr/bin/mtr-exporter
43+
args:
44+
- -jobs
45+
- /etc/mtr-exporter/jobs.txt
46+
ports:
47+
- name: http
48+
containerPort: {{ .Values.service.port }}
49+
protocol: TCP
50+
livenessProbe:
51+
{{- toYaml .Values.livenessProbe | nindent 12 }}
52+
readinessProbe:
53+
{{- toYaml .Values.readinessProbe | nindent 12 }}
54+
resources:
55+
{{- toYaml .Values.resources | nindent 12 }}
56+
volumeMounts:
57+
- name: jobsconfig
58+
mountPath: "/etc/mtr-exporter"
59+
readOnly: true
60+
{{- with .Values.volumeMounts }}
61+
{{- toYaml . | nindent 12 }}
62+
{{- end }}
63+
volumes:
64+
- name: jobsconfig
65+
configMap:
66+
name: {{ include "mtr-exporter.fullname" . }}
67+
{{- with .Values.volumes }}
68+
{{- toYaml . | nindent 8 }}
69+
{{- end }}
70+
{{- with .Values.nodeSelector }}
71+
nodeSelector:
72+
{{- toYaml . | nindent 8 }}
73+
{{- end }}
74+
{{- with .Values.affinity }}
75+
affinity:
76+
{{- toYaml . | nindent 8 }}
77+
{{- end }}
78+
{{- with .Values.tolerations }}
79+
tolerations:
80+
{{- toYaml . | nindent 8 }}
81+
{{- end }}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "mtr-exporter.fullname" . }}
6+
labels:
7+
{{- include "mtr-exporter.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "mtr-exporter.fullname" . }}
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
target:
21+
type: Utilization
22+
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
23+
{{- end }}
24+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
25+
- type: Resource
26+
resource:
27+
name: memory
28+
target:
29+
type: Utilization
30+
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
31+
{{- end }}
32+
{{- end }}
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{{- if .Values.ingress.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ include "mtr-exporter.fullname" . }}
6+
labels:
7+
{{- include "mtr-exporter.labels" . | nindent 4 }}
8+
{{- with .Values.ingress.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
{{- with .Values.ingress.className }}
14+
ingressClassName: {{ . }}
15+
{{- end }}
16+
{{- if .Values.ingress.tls }}
17+
tls:
18+
{{- range .Values.ingress.tls }}
19+
- hosts:
20+
{{- range .hosts }}
21+
- {{ . | quote }}
22+
{{- end }}
23+
secretName: {{ .secretName }}
24+
{{- end }}
25+
{{- end }}
26+
rules:
27+
{{- range .Values.ingress.hosts }}
28+
- host: {{ .host | quote }}
29+
http:
30+
paths:
31+
{{- range .paths }}
32+
- path: {{ .path }}
33+
{{- with .pathType }}
34+
pathType: {{ . }}
35+
{{- end }}
36+
backend:
37+
service:
38+
name: {{ include "mtr-exporter.fullname" $ }}
39+
port:
40+
number: {{ $.Values.service.port }}
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}

0 commit comments

Comments
 (0)