Skip to content

Commit

Permalink
feat: configurable job names (#224)
Browse files Browse the repository at this point in the history
* feat: configurable job names

set jobName for manual job naming

* docs: configurable job names
  • Loading branch information
revant authored Dec 1, 2024
1 parent e7cd5ce commit e1027ba
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 1 deletion.
6 changes: 6 additions & 0 deletions erpnext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Kubernetes Helm Chart for the latest stable ERPNext branch
| jobs.backup.affinity | object | `{}` | |
| jobs.backup.backoffLimit | int | `0` | |
| jobs.backup.enabled | bool | `false` | |
| jobs.backup.jobName | string | `""` | |
| jobs.backup.nodeSelector | object | `{}` | |
| jobs.backup.resources | object | `{}` | |
| jobs.backup.siteName | string | `"erp.cluster.local"` | |
Expand All @@ -99,6 +100,7 @@ Kubernetes Helm Chart for the latest stable ERPNext branch
| jobs.configure.enabled | bool | `true` | |
| jobs.configure.envVars | list | `[]` | |
| jobs.configure.fixVolume | bool | `true` | |
| jobs.configure.jobName | string | `""` | |
| jobs.configure.nodeSelector | object | `{}` | |
| jobs.configure.resources | object | `{}` | |
| jobs.configure.tolerations | list | `[]` | |
Expand All @@ -109,6 +111,7 @@ Kubernetes Helm Chart for the latest stable ERPNext branch
| jobs.createSite.enabled | bool | `false` | |
| jobs.createSite.forceCreate | bool | `false` | |
| jobs.createSite.installApps[0] | string | `"erpnext"` | |
| jobs.createSite.jobName | string | `""` | |
| jobs.createSite.nodeSelector | object | `{}` | |
| jobs.createSite.resources | object | `{}` | |
| jobs.createSite.siteName | string | `"erp.cluster.local"` | |
Expand All @@ -128,13 +131,15 @@ Kubernetes Helm Chart for the latest stable ERPNext branch
| jobs.dropSite.backoffLimit | int | `0` | |
| jobs.dropSite.enabled | bool | `false` | |
| jobs.dropSite.forced | bool | `false` | |
| jobs.dropSite.jobName | string | `""` | |
| jobs.dropSite.nodeSelector | object | `{}` | |
| jobs.dropSite.resources | object | `{}` | |
| jobs.dropSite.siteName | string | `"erp.cluster.local"` | |
| jobs.dropSite.tolerations | list | `[]` | |
| jobs.migrate.affinity | object | `{}` | |
| jobs.migrate.backoffLimit | int | `0` | |
| jobs.migrate.enabled | bool | `false` | |
| jobs.migrate.jobName | string | `""` | |
| jobs.migrate.nodeSelector | object | `{}` | |
| jobs.migrate.resources | object | `{}` | |
| jobs.migrate.siteName | string | `"erp.cluster.local"` | |
Expand All @@ -143,6 +148,7 @@ Kubernetes Helm Chart for the latest stable ERPNext branch
| jobs.volumePermissions.affinity | object | `{}` | |
| jobs.volumePermissions.backoffLimit | int | `0` | |
| jobs.volumePermissions.enabled | bool | `false` | |
| jobs.volumePermissions.jobName | string | `""` | |
| jobs.volumePermissions.nodeSelector | object | `{}` | |
| jobs.volumePermissions.resources | object | `{}` | |
| jobs.volumePermissions.tolerations | list | `[]` | |
Expand Down
4 changes: 4 additions & 0 deletions erpnext/templates/job-backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
apiVersion: batch/v1
kind: Job
metadata:
{{- if .Values.jobs.backup.jobName }}
name: {{ .Values.jobs.backup.jobName }}
{{- else }}
name: {{ template "erpnext.fullname" . }}-backup-{{ now | date "20060102150405" }}
{{- end }}
labels:
{{- include "erpnext.labels" . | nindent 4 }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions erpnext/templates/job-configure-bench.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
apiVersion: batch/v1
kind: Job
metadata:
{{- if .Values.jobs.configure.jobName }}
name: {{ .Values.jobs.configure.jobName }}
{{- else }}
name: {{ template "erpnext.fullname" . }}-conf-bench-{{ now | date "20060102150405" }}
{{- end }}
labels:
{{- include "erpnext.labels" . | nindent 4 }}
spec:
Expand Down
6 changes: 5 additions & 1 deletion erpnext/templates/job-create-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
apiVersion: batch/v1
kind: Job
metadata:
{{- if .Values.jobs.createSite.jobName }}
name: {{ .Values.jobs.createSite.jobName }}
{{- else }}
name: {{ template "erpnext.fullname" . }}-new-site-{{ now | date "20060102150405" }}
{{- end }}
labels:
{{- include "erpnext.labels" . | nindent 4 }}
annotations:
Expand Down Expand Up @@ -114,7 +118,7 @@ spec:
exit $bench_exit_status;
fi
fi
set -e;
rm -f currentsite.txt
Expand Down
4 changes: 4 additions & 0 deletions erpnext/templates/job-drop-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
apiVersion: batch/v1
kind: Job
metadata:
{{- if .Values.jobs.dropSite.jobName }}
name: {{ .Values.jobs.dropSite.jobName }}
{{- else }}
name: {{ template "erpnext.fullname" . }}-drop-site-{{ now | date "20060102150405" }}
{{- end }}
labels:
{{- include "erpnext.labels" . | nindent 4 }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions erpnext/templates/job-fix-volume-permission.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
apiVersion: batch/v1
kind: Job
metadata:
{{- if .Values.jobs.volumePermissions.jobName }}
name: {{ .Values.jobs.volumePermissions.jobName }}
{{- else }}
name: {{ template "erpnext.fullname" . }}-vol-fix-{{ now | date "20060102150405" }}
{{- end }}
labels:
{{- include "erpnext.labels" . | nindent 4 }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions erpnext/templates/job-migrate-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
apiVersion: batch/v1
kind: Job
metadata:
{{- if .Values.jobs.migrate.jobName }}
name: {{ .Values.jobs.migrate.jobName }}
{{- else }}
name: {{ template "erpnext.fullname" . }}-migrate-{{ now | date "20060102150405" }}
{{- end }}
labels:
{{- include "erpnext.labels" . | nindent 4 }}
spec:
Expand Down
6 changes: 6 additions & 0 deletions erpnext/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ ingress:

jobs:
volumePermissions:
# jobName: ""
enabled: false
backoffLimit: 0
resources: {}
Expand All @@ -296,6 +297,7 @@ jobs:
affinity: {}

configure:
# jobName: ""
enabled: true
fixVolume: true
backoffLimit: 0
Expand All @@ -308,6 +310,7 @@ jobs:
args: []

createSite:
# jobName: ""
enabled: false
forceCreate: false
siteName: "erp.cluster.local"
Expand All @@ -322,6 +325,7 @@ jobs:
affinity: {}

dropSite:
# jobName: ""
enabled: false
forced: false
siteName: "erp.cluster.local"
Expand All @@ -332,6 +336,7 @@ jobs:
affinity: {}

backup:
# jobName: ""
enabled: false
siteName: "erp.cluster.local"
withFiles: true
Expand All @@ -342,6 +347,7 @@ jobs:
affinity: {}

migrate:
# jobName: ""
enabled: false
siteName: "erp.cluster.local"
skipFailing: false
Expand Down

0 comments on commit e1027ba

Please sign in to comment.