fix(prometheus): add init containers to download plugins
Some checks failed
Generate README / generate-parameters (push) Failing after 15s
Helm / helm-lint (push) Successful in 15s
Helm / helm-unittest (push) Successful in 7s
Markdown linter / markdown-lint (push) Successful in 8s
Release / publish-chart (push) Successful in 8s
Markdown linter / markdown-link-checker (push) Successful in 43s

The following patch extends the helm chart of additional init containers for
each plugin.
This commit is contained in:
2025-09-20 16:19:49 +02:00
parent de8ef2b201
commit 413fe95b86
14 changed files with 315 additions and 68 deletions

View File

@@ -0,0 +1,42 @@
chart:
appVersion: 0.1.0
version: 0.1.0
suite: Test reposilite plugins
release:
name: reposilite-unittest
namespace: testing
templates:
- templates/deployment.yaml
- templates/secretPrometheusBasicAuth.yaml
tests:
- it: Test init containers for prometheus
set:
config.plugins.prometheus.enabled: true
config.plugins.prometheus.url: "https://reposilite.com/plugins/prometheus.jar"
deployment.pluginContainer.image.tag: 0.1.0
asserts:
- contains:
path: spec.template.spec.initContainers
content:
args:
- --location
- --fail
- --max-time
- "60"
- --output-dir
- /app/data/plugins
- --output
- prometheus.jar
- https://reposilite.com/plugins/prometheus.jar
name: download-prometheus-plugin
image: docker.io/curlimages/curl:0.1.0
volumeMounts:
- mountPath: /app/data/plugins
name: plugins
template: templates/deployment.yaml
- contains:
path: spec.template.spec.volumes
content:
name: plugins
emptyDir: {}
template: templates/deployment.yaml

View File

@@ -390,6 +390,19 @@ tests:
- name: my-special-secret
template: templates/deployment.yaml
- it: Test initContainers
set:
deployment.initContainers:
- name: busybox
image: docker.io/library/busybox:latest
asserts:
- contains:
path: spec.template.spec.initContainers
content:
name: busybox
image: docker.io/library/busybox:latest
template: templates/deployment.yaml
- it: Test nodeSelector
set:
deployment.nodeSelector:

View File

@@ -67,7 +67,7 @@ tests:
name: reposilite-unittest-basic-auth-credentials
- equal:
path: spec.podMetricsEndpoints[0].enableHttp2
value: true
value: false
- equal:
path: spec.podMetricsEndpoints[0].followRedirects
value: false
@@ -82,7 +82,7 @@ tests:
value: /metrics
- equal:
path: spec.podMetricsEndpoints[0].port
value: "8080"
value: http
- notExists:
path: spec.podMetricsEndpoints[0].relabelings
- equal:
@@ -133,12 +133,14 @@ tests:
prometheus.metrics.podMonitor.honorLabels: true
prometheus.metrics.podMonitor.interval: "180s"
prometheus.metrics.podMonitor.path: "/my-metrics"
prometheus.metrics.podMonitor.port: "8443"
prometheus.metrics.podMonitor.relabelings:
- sourceLabels: [ container ]
separator: ";"
regex: "app"
replacement: "$1"
action: "drop"
prometheus.metrics.podMonitor.scheme: https
prometheus.metrics.podMonitor.scrapeTimeout: "5s"
asserts:
- hasDocuments:
@@ -160,7 +162,7 @@ tests:
value: /my-metrics
- equal:
path: spec.podMetricsEndpoints[0].port
value: "8080"
value: "8443"
- contains:
path: spec.podMetricsEndpoints[0].relabelings
content:
@@ -174,4 +176,4 @@ tests:
value: 5s
- equal:
path: spec.podMetricsEndpoints[0].scheme
value: http
value: https

View File

@@ -68,7 +68,7 @@ tests:
name: reposilite-unittest-basic-auth-credentials
- equal:
path: spec.endpoints[0].enableHttp2
value: true
value: false
- equal:
path: spec.endpoints[0].followRedirects
value: false
@@ -90,8 +90,8 @@ tests:
path: spec.endpoints[0].scheme
value: http
- equal:
path: spec.endpoints[0].targetPort
value: 8080
path: spec.endpoints[0].port
value: http
- contains:
path: spec.namespaceSelector.matchNames
content:
@@ -142,7 +142,8 @@ tests:
replacement: "$1"
action: "drop"
prometheus.metrics.serviceMonitor.scrapeTimeout: "5s"
prometheus.metrics.serviceMonitor.scheme: "http"
prometheus.metrics.serviceMonitor.scheme: "https"
service.scheme: https
asserts:
- hasDocuments:
count: 1
@@ -161,6 +162,9 @@ tests:
- equal:
path: spec.endpoints[0].path
value: /my-metrics
- equal:
path: spec.endpoints[0].port
value: https
- contains:
path: spec.endpoints[0].relabelings
content:
@@ -174,4 +178,4 @@ tests:
value: 5s
- equal:
path: spec.endpoints[0].scheme
value: http
value: https

View File

@@ -24,16 +24,15 @@ tests:
kind: Service
name: reposilite-unittest
namespace: testing
- equal:
- notExists:
path: metadata.annotations
value:
app.kubernetes.io/service-name: http
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: reposilite-unittest
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: reposilite
app.kubernetes.io/service-name: http
app.kubernetes.io/version: 0.1.0
helm.sh/chart: reposilite-0.1.0
- notExists:
@@ -88,6 +87,13 @@ tests:
- failedTemplate:
errorMessage: No service port defined!
- it: Require scheme.
set:
service.scheme: ""
asserts:
- failedTemplate:
errorMessage: No service scheme defined!
- it: Require sessionAffinity.
set:
service.sessionAffinity: ""
@@ -108,11 +114,11 @@ tests:
foo: bar
service.labels:
bar: foo
service.scheme: https
asserts:
- equal:
path: metadata.annotations
value:
app.kubernetes.io/service-name: http
foo: bar
- equal:
path: metadata.labels
@@ -120,6 +126,7 @@ tests:
app.kubernetes.io/instance: reposilite-unittest
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: reposilite
app.kubernetes.io/service-name: https
app.kubernetes.io/version: 0.1.0
helm.sh/chart: reposilite-0.1.0
bar: foo
@@ -137,6 +144,7 @@ tests:
service.loadBalancerSourceRanges:
- "11.12.0.0/17"
service.port: 10443
service.scheme: https
service.sessionAffinity: ClientIP
service.type: LoadBalancer
asserts:
@@ -164,6 +172,9 @@ tests:
path: spec.loadBalancerSourceRanges
value:
- "11.12.0.0/17"
- equal:
path: spec.ports[0].name
value: https
- equal:
path: spec.ports[0].port
value: 10443