-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from ameijer/job
first pass at job
- Loading branch information
Showing
12 changed files
with
157 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dependencies: | ||
- name: lib-k8s-as-helm | ||
repository: file://../lib-k8s-as-helm | ||
version: 1.1.0 | ||
digest: sha256:af89aadcdc81278d8787e1b5887a225e145d531b8cb4cd54ddc6b3412051448e | ||
generated: "2021-04-24T17:29:22.069848381-04:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v2 | ||
appVersion: "v1.0.0" | ||
home: https:/ameijer/k8s-as-helm | ||
description: Helm Chart representing a single Job Kubernetes API object | ||
name: job | ||
version: 1.0.0 | ||
icon: https://ameijer.github.io/k8s-as-helm/icon.png | ||
dependencies: | ||
- name: lib-k8s-as-helm | ||
version: 1.1.0 | ||
repository: file://../lib-k8s-as-helm | ||
maintainers: | ||
- name: ameijer | ||
url: https:/ameijer | ||
keywords: | ||
- job | ||
- api | ||
- primitives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
The Job Chart {{ .Release.Name }} has been installed into your cluster! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Job Chart | ||
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/k8s-as-helm)](https://artifacthub.io/packages/search?repo=k8s-as-helm) | ||
|
||
## TL;DR; | ||
|
||
```console | ||
$ helm repo add k8s-as-helm https://ameijer.github.io/k8s-as-helm/ | ||
$ helm install my-release k8s-as-helm/job | ||
``` | ||
|
||
## Introduction | ||
|
||
Helm charts are great! They are really configurable and let you build complicated software stacks in seconds. Tools like [Helmfile](https:/roboll/helmfile) combine helm charts together to allow you to set up an environment consisting entirely of helm releases. | ||
|
||
Let's say, though, you want to add additional code to a third party helm chart. You could make a new chart with your K8s API resource and the third party chart as a dependency, but that requires maintenance which might not be worth it if you only needed a single additional resource created. That's where k8s-as-helm charts come in. These charts wrap a single Kubernetes resource in a helm chart with all the key parameters exposed. | ||
|
||
The pod chart deploys a single Kubernetes Job object. | ||
|
||
## Installation | ||
|
||
```console | ||
$ helm repo add k8s-as-helm https://ameijer.github.io/k8s-as-helm/ | ||
$ helm install my-release k8s-as-helm/job | ||
``` | ||
|
||
## Configuration | ||
|
||
The following table lists the configurable parameters of the pod chart and their default values. | ||
|
||
Parameter | Description | Default | ||
--- | --- | --- | ||
`nameOverride` | override name of the chart component | .Release.Name | ||
`apiVersion` | api version of k8s object | `"batch/v1"` | ||
`annotations` | annotations in yaml map format to be added to the object | `null` | ||
`labels` | labels to add to Job object | `null` | ||
`containers` | Array of container objects in the job pods | `[]` | ||
`containers[].name` | The name of the given container | `null` | ||
`containers[].image` | The image of the given container | `null` | ||
`containers[].extraSettings` | YAML representation of additional config settings for the given container | `null` | ||
`containers[].volumeMounts` | Map of volume mount names to settings for each given mount | `null` | ||
`dnsPolicy` | The job pod DNS policy | `ClusterFirst` | ||
`restartPolicy` | The restart policy of the pods in the job | `Always` | ||
`saName` | The job pod service account name | `default` | ||
`tgps` | The job pods' terminationGracePeriodSeconds setting | `30` | ||
`extraSettings` | Yaml representation of any additional required pod settings | `null` | ||
`volumes` | Mapping of volume name to volume settings for each volume mount used by the job pods | `null` | ||
`backoffLimit` | The job's backoffLimit settings. Leave unset to use defaults | `null` | ||
`activeDeadlineSeconds` | The maximum time the job may take. Leave unset to use default 600 seconds | `null` | ||
`parallelism` | The parallelism of the pods in the job. Leave unset to use default of no parallelism | `null` | ||
`completions` | The number of successful pod completions for the job. Leave unset to use the default of 1 | `null` | ||
`completionMode` | Set to `Indexed` to pass an index to each pod. Leave unset to omit index passing. | `null` | ||
|
||
## Example Configuration | ||
|
||
For some examples of values used to configure this chart, see [the ci/example values for this chart](./ci/ci-values.yaml) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
labels: | ||
"test": "true" | ||
|
||
containers: | ||
testcontainer1: | ||
image: busybox | ||
extraSettings: | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
echo "hello world, running the job!" | ||
restartPolicy: Never | ||
extraSettings: | ||
securityContext: | ||
runAsNonRoot: true | ||
runAsUser: 1000 | ||
|
||
backoffLimit: 7 | ||
completions: 7 | ||
parallelism: 2 | ||
activeDeadlineSeconds: 601 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Setup a chart name | ||
*/}} | ||
{{- define "job.name" -}} | ||
{{- default .Release.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for the object | ||
*/}} | ||
{{- define "apiVersion" -}} | ||
{{- default "batch/v1" .Values.apiVersion -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
kind: Job | ||
apiVersion: {{ template "apiVersion" . }} | ||
metadata: | ||
name: {{ template "job.name" . }} | ||
{{- if .Values.annotations }} | ||
annotations: | ||
{{ toYaml .Values.annotations | indent 4}} | ||
{{- end }} | ||
labels: | ||
app: {{ template "job.name" . }} | ||
chart: {{ .Chart.Name }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
{{- if .Values.labels }} | ||
{{ toYaml .Values.labels | indent 4 }} | ||
{{- end }} | ||
{{ tpl ( include "k8s-as-helm-lib.job.tpl" . ) . }} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- define "k8s-as-helm-lib.job.tpl" -}} | ||
spec: | ||
{{ if .Values.backoff }} | ||
backoffLimit: {{ .Values.backoff }} | ||
{{- end }} | ||
{{ if .Values.deadlineSec }} | ||
activeDeadlineSeconds: {{ .Values.deadlineSec }} | ||
{{- end }} | ||
{{ if .Values.parallelism }} | ||
parallelism: {{ .Values.parallelism }} | ||
{{- end }} | ||
{{ if .Values.completions }} | ||
completions: {{ .Values.completions }} | ||
{{- end }} | ||
{{ if .Values.completionMode }} | ||
completionMode: {{ .Values.completionMode }} | ||
{{- end }} | ||
template: | ||
{{ tpl ( include "k8s-as-helm-lib.pod.tpl" . ) . | indent 4 }} | ||
{{- end -}} |