Skip to content

Commit

Permalink
fix constant restarts and keep job around in case it's needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherJMiller committed Dec 17, 2024
1 parent 0b89110 commit 54c864b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/mega-media/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 1 addition & 1 deletion charts/mega-media/templates/arr-deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- $apiKey := lower (randAlphaNum 32) -}}

{{ if eq $tableSelect.enabled true }}
{{ template "mega-media.arr.deployment" (merge (dict "selected" $tableSelect "apiKey" $apiKey) $) }}
{{ template "mega-media.arr.deployment" (merge (dict "selected" $tableSelect) $) }}
{{ template "mega-media.api-key-secret" (merge (dict "name" $tableSelect.name "apiKey" $apiKey) $) }}
{{ template "mega-media.service" (merge (dict "name" $tableSelect.name "port" $tableSelect.port "targetPort" "http") $) }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions charts/mega-media/templates/helpers/_api_key_secret.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ metadata:
name: {{ include "mega-media.name" $nameInTable }}-api-key
labels:
{{- include "mega-media.labels" $nameInTable | nindent 4 }}
annotations:
helm.sh/hook: pre-install
helm.sh/hook-delete-policy: before-hook-creation
data:
key: {{ b64enc .apiKey }}
{{- end }}
7 changes: 6 additions & 1 deletion charts/mega-media/templates/helpers/_arr_deployment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ spec:
<Branch>develop</Branch>
<LogLevel>debug</LogLevel>
<UrlBase></UrlBase>
<ApiKey>{{ .apiKey }}</ApiKey>
<ApiKey>$(API_KEY)</ApiKey>
<AuthenticationMethod>External</AuthenticationMethod>
<InstanceName>{{ .Release.Name }}</InstanceName>
<PostgresUser>{{ $db_user }}</PostgresUser>
Expand All @@ -82,6 +82,11 @@ spec:
secretKeyRef:
name: {{ $db_secret_name }}
key: {{ $db_secret_key }}
- name: API_KEY
valueFrom:
secretKeyRef:
name: {{ include "mega-media.name" $nameInTable }}-api-key
key: key
volumeMounts:
- mountPath: /config
name: config
Expand Down
10 changes: 8 additions & 2 deletions charts/mega-media/templates/sabnzbd-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ spec:
__version__ = 19
__encoding__ = utf-8
[misc]
api_key = {{ $apiKey | quote }}
nzb_key = {{ $apiKey | quote }}
api_key = "$API_KEY"
nzb_key = "$API_KEY"
" > /config/sabnzbd.ini && chmod 666 /config/sabnzbd.ini
echo '
Expand All @@ -69,6 +69,12 @@ spec:
name: config-file
- mountPath: /config
name: config
env:
- name: API_KEY
valueFrom:
secretKeyRef:
name: {{ include "mega-media.name" $contextWithName }}-api-key
key: key
containers:
- name: sabnzbd
image: "{{ .image }}:{{ .tag }}"
Expand Down
3 changes: 1 addition & 2 deletions charts/mega-media/templates/sync-prowlarr-hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ metadata:
labels:
{{- include "mega-media.labels" $nameInTable | nindent 4 }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook": post-install
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
Expand Down

0 comments on commit 54c864b

Please sign in to comment.