Skip to content

Commit

Permalink
Support release namespace override
Browse files Browse the repository at this point in the history
  • Loading branch information
NaldoRay authored and DrPsychick committed Dec 21, 2023
1 parent a3d0f25 commit 0d25f82
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sickhub/cronjobs/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: cronjobs
description: A generic helm cronjob chart for kubernetes
type: application
version: 0.1.7
version: 0.2.0
appVersion: latest
home: https://github.com/SickHub
icon: https://raw.githubusercontent.com/SickHub/charts/master/sickhub/cronjobs/icon.png
Expand Down
7 changes: 7 additions & 0 deletions sickhub/cronjobs/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,10 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Namespace to be released into
*/}}
{{- define "cronjobs.namespace" -}}
{{- default .Release.Namespace .Values.namespaceOverride }}
{{- end }}
2 changes: 2 additions & 0 deletions sickhub/cronjobs/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- $chart_name := include "cronjobs.fullname" . }}
{{- $chart_labels := include "cronjobs.labels" . }}
{{- $namespace := include "cronjobs.namespace" . }}

{{- if .Values.configMaps }}
{{- range $name, $map := .Values.configMaps }}
Expand All @@ -9,6 +10,7 @@ apiVersion: "v1"
kind: "ConfigMap"
metadata:
name: {{ $chart_name }}-{{ $name }}
namespace: {{ $namespace }}
labels:
{{- $chart_labels | nindent 4 }}
annotations:
Expand Down
2 changes: 2 additions & 0 deletions sickhub/cronjobs/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{{- $chart_labels := include "cronjobs.labels" . }}
{{- $chart_selector_labels := include "cronjobs.selectorLabels" . }}
{{- $service_account_name := include "cronjobs.serviceAccountName" . }}
{{- $namespace := include "cronjobs.namespace" . }}
{{- $registry := .Values.image.registry }}
{{- $tag := .Values.image.tag | default .Chart.AppVersion }}
{{- $image_pull_secrets := .Values.imagePullSecrets }}
Expand All @@ -22,6 +23,7 @@ apiVersion: {{ $api_version }}
kind: CronJob
metadata:
name: {{ $chart_name }}-{{ $name }}
namespace: {{ $namespace }}
labels:
{{- $chart_labels | nindent 4 }}
annotations:
Expand Down
3 changes: 3 additions & 0 deletions sickhub/cronjobs/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{{- $chart_name := include "cronjobs.fullname" . }}
{{- $chart_labels := include "cronjobs.labels" . }}
{{- $namespace := include "cronjobs.namespace" . }}

{{- if .Values.dockerConfigJson }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $chart_name }}-registry
namespace: {{ $namespace }}
labels:
{{- $chart_labels | nindent 4 }}
annotations:
Expand All @@ -22,6 +24,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ $chart_name }}-{{ $name }}
namespace: {{ $namespace }}
labels:
{{- $chart_labels | nindent 4 }}
annotations:
Expand Down
1 change: 1 addition & 0 deletions sickhub/cronjobs/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "cronjobs.serviceAccountName" . }}
namespace: {{ include "cronjobs.namespace" . }}
labels:
{{- include "cronjobs.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
Expand Down
1 change: 1 addition & 0 deletions sickhub/cronjobs/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
nameOverride: ""
fullnameOverride: ""
namespaceOverride: ""

image:
registry: docker.io
Expand Down

0 comments on commit 0d25f82

Please sign in to comment.