Skip to content

Commit

Permalink
add k8s job
Browse files Browse the repository at this point in the history
  • Loading branch information
Romanow committed Nov 26, 2023
1 parent fdc352d commit 4205d38
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 0 deletions.
16 changes: 16 additions & 0 deletions charts/common-job/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: common-job
type: application
description: Helm chart for job
version: 1.5.0
appVersion: "v1.0"
home: https://github.com/Romanow/helm-charts/tree/master/charts/common-job
icon: https://raw.githubusercontent.com/Romanow/helm-charts/master/icons/job.png
sources:
- https://kubernetes.io/docs/concepts/workloads/controllers/job/
keywords:
- job
maintainers:
- name: Romanov Alexey
email: [email protected]
url: https://romanow.github.io
104 changes: 104 additions & 0 deletions charts/common-job/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Helm Chart for common-job

![Version: 1.5.0](https://img.shields.io/badge/Version-1.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.0](https://img.shields.io/badge/AppVersion-v1.0-informational?style=flat-square)

Helm chart for job

### Installing the Chart

To install the chart with the release name `common-job`:

```shell
$ helm repo add romanow https://romanow.github.io/helm-charts/
$ helm repo update
$ helm install common-job romanow/common-job
```

### Uninstalling the Chart

To uninstall the `common-job` installation:

```shell
helm uninstall common-job
```

### Configuration

<table>
<thead>
<th>Key</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td>args</td>
<td>list</td>
<td><pre lang="json">
[]
</pre>
</td>
<td>Job startup arguments</td>
</tr>
<tr>
<td>backoffLimit</td>
<td>int</td>
<td><pre lang="json">
5
</pre>
</td>
<td>Backoff limit</td>
</tr>
<tr>
<td>environments</td>
<td>list</td>
<td><pre lang="json">
[]
</pre>
</td>
<td>Additional env variables</td>
</tr>
<tr>
<td>image</td>
<td>object</td>
<td><pre lang="json">
{
"pullPolicy": "IfNotPresent",
"repository": null,
"tag": null
}
</pre>
</td>
<td>Image name and version</td>
</tr>
<tr>
<td>restartPolicy</td>
<td>string</td>
<td><pre lang="json">
"Never"
</pre>
</td>
<td>Restart policy</td>
</tr>
<tr>
<td>secrets</td>
<td>list</td>
<td><pre lang="json">
[]
</pre>
</td>
<td>Additional secrets</td>
</tr>
</tbody>
</table>

### Sources

* <https://kubernetes.io/docs/concepts/workloads/controllers/job/>

### Maintainer

| Name | Email | Url |
| ---- | ------ | --- |
| Romanov Alexey | <[email protected]> | <https://romanow.github.io> |
71 changes: 71 additions & 0 deletions charts/common-job/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{{- define "repository.organization" -}}
romanow
{{- end -}}

{{- define "repository.url" -}}
https://github.com/romanow/helm-charts
{{- end -}}

{{- define "helm.url" -}}
https://romanow.github.io/helm-charts/
{{- end -}}

{{- define "helm.path" -}}
{{ template "repository.organization" . }}/{{ template "chart.name" . }}
{{- end -}}

{{- define "install" -}}
### Installing the Chart

To install the chart with the release name `{{ template "chart.name" . }}`:

```shell
$ helm repo add {{ template "repository.organization" . }} {{ template "helm.url" . }}
$ helm repo update
$ helm install {{ template "chart.name" . }} {{ template "helm.path" . }}
```
{{- end -}}

{{- define "uninstall" -}}
### Uninstalling the Chart

To uninstall the `{{ template "chart.name" . }}` installation:

```shell
helm uninstall {{ template "chart.name" . }}
```
{{- end -}}

{{- define "configuration.header" -}}
### Configuration
{{- end -}}

{{- define "maintainers.header" -}}
### Maintainer
{{- end -}}

{{- define "sources.header" -}}
### Sources
{{- end -}}

# Helm Chart for {{ template "chart.name" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}

{{ template "chart.description" . }}

{{ template "install" . }}

{{ template "uninstall" . }}

{{ template "configuration.header" . }}

{{ template "chart.valuesTableHtml" . }}

{{ template "sources.header" . }}

{{ template "chart.sourcesList" . }}

{{ template "maintainers.header" . }}

{{ template "chart.maintainersTable" . }}
9 changes: 9 additions & 0 deletions charts/common-job/ci/test-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
image:
pullPolicy: IfNotPresent
repository: busybox
tag: 1.35

args:
- /bin/sh
- -c
- echo Hello, world
4 changes: 4 additions & 0 deletions charts/common-job/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
You have deployed the following release: {{ .Release.Name }}.
To get further information, you can run the commands:
$ helm status {{ .Release.Name }}
$ helm get all {{ .Release.Name }}
38 changes: 38 additions & 0 deletions charts/common-job/templates/job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/component: application
app.kubernetes.io/managed-by: helm
spec:
backoffLimit: 5
activeDeadlineSeconds: 60
ttlSecondsAfterFinished: 60
template:
spec:
restartPolicy: {{ .Values.restartPolicy }}
containers:
- name: {{ .Release.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
{{- range $arg := .Values.args }}
- "{{ tpl $arg $ }}"
{{- end }}
env:
{{- range $env := .Values.environments }}
- name: {{ $env.name }}
value: "{{ $env.value }}"
{{- end }}
{{- range $secret := .Values.secrets }}
- name: {{ $secret.name }}
valueFrom:
secretKeyRef:
name: {{ $secret.secretName }}
key: {{ $secret.secretKey }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/common-job/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -- Image name and version
image:
pullPolicy: IfNotPresent
repository:
tag:

# -- Additional env variables
environments: []

# -- Additional secrets
secrets: []

# -- Job startup arguments
args: []

# -- Restart policy
restartPolicy: Never

# -- Backoff limit
backoffLimit: 5
Binary file added icons/job.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4205d38

Please sign in to comment.