You've already forked reposilite-charts
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
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:
@@ -36,6 +36,13 @@
|
||||
|
||||
{{/* image */}}
|
||||
|
||||
{{- define "reposilite.deployment.images.plugin.fqin" -}}
|
||||
{{- $registry := .Values.deployment.pluginContainer.image.registry -}}
|
||||
{{- $repository := .Values.deployment.pluginContainer.image.repository -}}
|
||||
{{- $tag := default .Chart.AppVersion .Values.deployment.pluginContainer.image.tag -}}
|
||||
{{- printf "%s/%s:%s" $registry $repository $tag -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "reposilite.deployment.images.reposilite.fqin" -}}
|
||||
{{- $registry := .Values.deployment.reposilite.image.registry -}}
|
||||
{{- $repository := .Values.deployment.reposilite.image.repository -}}
|
||||
@@ -52,6 +59,34 @@
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* initContainers */}}
|
||||
|
||||
{{- define "reposilite.deployment.initContainers" -}}
|
||||
{{- $initContainers := .Values.deployment.initContainers | default list -}}
|
||||
{{- $pluginContainerImage := (include "reposilite.deployment.images.plugin.fqin" . ) }}
|
||||
{{- $pluginContainerArgs := .Values.deployment.pluginContainer.args | default list }}
|
||||
{{- $pluginContainerArgs := concat $pluginContainerArgs (list "--output-dir" "/app/data/plugins" ) }}
|
||||
{{- $pluginContainerVolumeMounts := list (dict "name" "plugins" "mountPath" "/app/data/plugins") }}
|
||||
|
||||
{{- if eq (include "reposilite.plugins.prometheus.enabled" $) "true" }}
|
||||
{{- $fileName := splitList "/" (tpl .Values.config.plugins.prometheus.url $) | last }}
|
||||
{{- $individualArgs := concat $pluginContainerArgs (list "--output" $fileName (tpl .Values.config.plugins.prometheus.url $)) }}
|
||||
{{- $initContainers = concat $initContainers (list (dict "args" $individualArgs "name" "download-prometheus-plugin" "image" $pluginContainerImage "volumeMounts" $pluginContainerVolumeMounts)) }}
|
||||
{{- end }}
|
||||
|
||||
{{ toYaml (dict "initContainers" $initContainers) }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{/* plugins */}}
|
||||
{{- define "reposilite.plugins.prometheus.enabled" -}}
|
||||
{{- if or .Values.config.plugins.prometheus.enabled .Values.prometheus.metrics.enabled -}}
|
||||
true
|
||||
{{- else -}}
|
||||
false
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{/* serviceAccount */}}
|
||||
|
||||
{{- define "reposilite.deployment.serviceAccount" -}}
|
||||
@@ -69,6 +104,11 @@
|
||||
{{- if .Values.persistentVolumeClaim.enabled }}
|
||||
{{- $volumeMounts = concat $volumeMounts (list (dict "name" "data" "mountPath" .Values.persistentVolumeClaim.path )) }}
|
||||
{{- end }}
|
||||
|
||||
{{- if eq (include "reposilite.plugins.prometheus.enabled" $) "true" }}
|
||||
{{- $volumeMounts = concat $volumeMounts (list (dict "name" "plugins" "mountPath" "/app/data/plugins")) }}
|
||||
{{- end }}
|
||||
|
||||
{{ toYaml (dict "volumeMounts" $volumeMounts) }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -85,6 +125,10 @@
|
||||
{{- $volumes = concat $volumes (list (dict "name" "data" "persistentVolumeClaim" (dict "claimName" $persistentVolumeClaimName))) }}
|
||||
{{- end }}
|
||||
|
||||
{{- if eq (include "reposilite.plugins.prometheus.enabled" $) "true" }}
|
||||
{{- $volumes = concat $volumes (list (dict "name" "plugins" "emptyDir" dict)) }}
|
||||
{{- end }}
|
||||
|
||||
{{ toYaml (dict "volumes" $volumes) }}
|
||||
|
||||
{{- end -}}
|
@@ -31,5 +31,5 @@ false
|
||||
{{- define "reposilite.serviceMonitor.selectorLabels" -}}
|
||||
{{ include "reposilite.selectorLabels" . }}
|
||||
{{/* Add label to select the correct service via `selector.matchLabels` of the serviceMonitor resource. */}}
|
||||
app.kubernetes.io/service-name: http
|
||||
app.kubernetes.io/service-name: {{ required "The scheme of the serviceMonitor is not defined!" .Values.service.scheme }}
|
||||
{{- end }}
|
@@ -7,8 +7,6 @@
|
||||
{{- if .Values.service.annotations }}
|
||||
{{ toYaml .Values.service.annotations }}
|
||||
{{- end }}
|
||||
{{/* Add label to select the correct service via `selector.matchLabels` of the serviceMonitor resource. */}}
|
||||
app.kubernetes.io/service-name: http
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
@@ -18,6 +16,8 @@ app.kubernetes.io/service-name: http
|
||||
{{- if .Values.service.labels }}
|
||||
{{ toYaml .Values.service.labels }}
|
||||
{{- end }}
|
||||
{{/* Add label to select the correct service via `selector.matchLabels` of the serviceMonitor resource. */}}
|
||||
app.kubernetes.io/service-name: {{ required "The scheme of the serviceMonitor is not defined!" .Values.service.scheme }}
|
||||
{{- end }}
|
||||
|
||||
{{/* names */}}
|
||||
|
@@ -109,6 +109,11 @@ spec:
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- $initContainers := (include "reposilite.deployment.initContainers" . | fromYaml) }}
|
||||
{{- if and (hasKey $initContainers "initContainers") (gt (len $initContainers.initContainers) 0) }}
|
||||
initContainers:
|
||||
{{- toYaml $initContainers.initContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.deployment.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
|
@@ -27,13 +27,17 @@ spec:
|
||||
honorLabels: {{ required "The honorLabels option of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.honorLabels }}
|
||||
interval: {{ required "The scrape interval of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.interval }}
|
||||
path: {{ required "The metric path of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.path }}
|
||||
port: "8080"
|
||||
port: {{ required "The metric port of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.port | quote }}
|
||||
{{- with .Values.prometheus.metrics.podMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
scrapeTimeout: {{ required "The scrape timeout of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.scrapeTimeout }}
|
||||
scheme: http
|
||||
scheme: {{ required "The scheme of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.scheme }}
|
||||
{{- with .Values.prometheus.metrics.podMonitor.tlsConfig }}
|
||||
tlsConfig:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
|
@@ -27,13 +27,17 @@ spec:
|
||||
honorLabels: {{ required "The honorLabels option of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.honorLabels }}
|
||||
interval: {{ required "The scrape interval of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.interval }}
|
||||
path: {{ required "The metric path of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.path }}
|
||||
port: {{ required "The port of the serviceMonitor is not defined!" .Values.service.scheme }}
|
||||
{{- with .Values.prometheus.metrics.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
scrapeTimeout: {{ required "The scrape timeout of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scheme: http
|
||||
targetPort: 8080
|
||||
scheme: {{ required "The scheme of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scheme }}
|
||||
{{- with .Values.prometheus.metrics.serviceMonitor.tlsConfig }}
|
||||
tlsConfig:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
|
Reference in New Issue
Block a user