This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dmitry Chepurovskiy <[email protected]>
- Loading branch information
Showing
10 changed files
with
382 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj |
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,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0.0" | ||
description: A Helm chart for contribsys/faktory | ||
name: faktory | ||
version: 0.1.0 |
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,78 @@ | ||
# Faktory Helm Chart | ||
|
||
[Faktory](https://github.com/contribsys/faktory) is an open-source background jobs server written on Golang. It have got clients for different programming languages. | ||
|
||
## TL;DR; | ||
|
||
```console | ||
$ helm install incubator/faktory | ||
``` | ||
|
||
## Introduction | ||
|
||
This chart bootstraps a [Faktory](https://github.com/contribsys/faktory) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. | ||
|
||
## Installing the Chart | ||
|
||
To install the chart with the release name `my-release`: | ||
|
||
```console | ||
$ helm install --name my-release incubator/faktory | ||
``` | ||
|
||
The command above deploys Faktory on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. | ||
|
||
> **Tip**: List all releases using `helm list` | ||
## Uninstalling the Chart | ||
|
||
To uninstall/delete the `my-release` deployment: | ||
|
||
```console | ||
$ helm delete my-release | ||
``` | ||
|
||
The command above removes all the Kubernetes components associated with the chart and deletes the release. | ||
|
||
## Configuration | ||
|
||
The following table lists the configurable parameters of the Faktory chart and their default values. | ||
|
||
Parameter | Description | Default | ||
--------- | ----------- | ------- | ||
`image.repository` | faktory image repository | `contribsys/faktory` | ||
`image.tag` | faktory image tag | `1.0.0` | ||
`image.pullPolicy` | faktory image pullPolicy | `IfNotPresent` | ||
`service.type` | service type | `ClusterIP` | ||
`service.ui_port` | service port for WebUI | `80` | ||
`service.commands_port` | service port for commands | `80` | ||
`ingress.enabled` | If true, an ingress will be created for the api | `false` | ||
`ingress.annotations` | ingress annotations | `{}` | ||
`ingress.path` | ingress path | `/` | ||
`ingress.hosts` | ingress hostnames | `[]` | ||
`ingress.tls` | ingress TLS configuration | `[]` | ||
`resources` | resource requests and limits | `{}` | ||
`nodeSelector` | node selector labels for pod assignment | `{}` | ||
`tolerations` | toleration for pod assignment | `[]` | ||
`affinity` | affinity for pod assignment | `{}` | ||
`password` | WebUI Password | `password` | ||
`persistentVolume.enabled` | If true, create a Persistent Volume Claim | `true` | ||
`persistentVolume.accessModes` | Persistent Volume access modes | `ReadWriteOnce` | ||
`persistentVolume.annotations` | Annotations for Persistent Volume Claim | `{}` | ||
`persistentVolume.existingClaim` | Persistent Volume existing claim name | `""` | ||
`persistentVolume.size` | Persistent Volume size | `1Gi` | ||
|
||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, | ||
|
||
```console | ||
$ helm install incubator/faktory --name my-release \ | ||
--set api.replicaCount=5 | ||
``` | ||
|
||
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, | ||
|
||
```console | ||
$ helm install incubator/faktory --name my-release -f values.yaml | ||
``` | ||
|
||
> **Tip**: You can use the default [values.yaml](values.yaml) |
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,19 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range .Values.ingress.hosts }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "faktory.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get svc -w {{ include "faktory.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "faktory.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "faktory.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl port-forward $POD_NAME 8080:80 | ||
{{- 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,32 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "faktory.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "faktory.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "faktory.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- 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,78 @@ | ||
apiVersion: apps/v1beta2 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "faktory.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "faktory.name" . }} | ||
helm.sh/chart: {{ include "faktory.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
type: Recreate | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "faktory.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "faktory.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: | ||
- /faktory | ||
- -b | ||
- :7419 | ||
- -w | ||
- :7420 | ||
- -e | ||
- production | ||
env: | ||
- name: FAKTORY_PASSWORD | ||
value: {{ .Values.password | quote }} | ||
ports: | ||
- name: commands | ||
containerPort: 7419 | ||
protocol: TCP | ||
- name: ui | ||
containerPort: 7420 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /static | ||
port: ui | ||
readinessProbe: | ||
httpGet: | ||
path: /static | ||
port: ui | ||
resources: | ||
{{ toYaml .Values.resources | indent 12 }} | ||
volumeMounts: | ||
- name: data | ||
mountPath: /var/lib/faktory | ||
volumes: | ||
- name: data | ||
{{- if .Values.persistentVolume.enabled }} | ||
persistentVolumeClaim: | ||
claimName: {{ if .Values.persistentVolume.existingClaim }}{{ .Values.persistentVolume.existingClaim }}{{- else }}{{ template "faktory.fullname" . }}{{- end }} | ||
{{- else }} | ||
emptyDir: {} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{ toYaml . | indent 8 }} | ||
{{- 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,38 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "faktory.fullname" . -}} | ||
{{- $ingressPath := .Values.ingress.path -}} | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "faktory.name" . }} | ||
helm.sh/chart: {{ include "faktory.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{ toYaml . | indent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ . | quote }} | ||
http: | ||
paths: | ||
- path: {{ $ingressPath }} | ||
backend: | ||
serviceName: {{ $fullName }} | ||
servicePort: ui | ||
{{- end }} | ||
{{- 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,31 @@ | ||
{{- if and .Values.persistentVolume.enabled (not .Values.persistentVolume.existingClaim) -}} | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: {{ template "faktory.fullname" . }} | ||
annotations: | ||
"helm.sh/resource-policy": keep | ||
{{- if .Values.persistentVolume.annotations }} | ||
{{ toYaml .Values.persistentVolume.annotations | indent 4 }} | ||
{{- end }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "faktory.name" . }} | ||
helm.sh/chart: {{ include "faktory.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
accessModes: | ||
{{- range .Values.persistentVolume.accessModes }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
resources: | ||
requests: | ||
storage: {{ .Values.persistentVolume.size | quote }} | ||
{{- if .Values.persistentVolume.storageClass }} | ||
{{- if (eq "-" .Values.persistentVolume.storageClass) }} | ||
storageClassName: "" | ||
{{- else }} | ||
storageClassName: "{{ .Values.persistentVolume.storageClass }}" | ||
{{- end }} | ||
{{- end }} | ||
{{- 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,23 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "faktory.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "faktory.name" . }} | ||
helm.sh/chart: {{ include "faktory.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.commands_port }} | ||
targetPort: commands | ||
protocol: TCP | ||
name: commands | ||
- port: {{ .Values.service.ui_port }} | ||
targetPort: ui | ||
protocol: TCP | ||
name: ui | ||
selector: | ||
app.kubernetes.io/name: {{ include "faktory.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} |
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,57 @@ | ||
# Default values for faktory. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
image: | ||
repository: contribsys/faktory | ||
tag: 1.0.0 | ||
pullPolicy: IfNotPresent | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
service: | ||
type: ClusterIP | ||
ui_port: 80 | ||
commands_port: 7419 | ||
|
||
ingress: | ||
enabled: false | ||
annotations: {} | ||
# kubernetes.io/ingress.class: nginx | ||
# kubernetes.io/tls-acme: "true" | ||
path: / | ||
hosts: | ||
- chart-example.local | ||
tls: [] | ||
# - secretName: chart-example-tls | ||
# hosts: | ||
# - chart-example.local | ||
|
||
resources: {} | ||
# We usually recommend not to specify default resources and to leave this as a conscious | ||
# choice for the user. This also increases chances charts run on environments with little | ||
# resources, such as Minikube. If you do want to specify resources, uncomment the following | ||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. | ||
# limits: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
# requests: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} | ||
|
||
password: "password" | ||
|
||
persistentVolume: | ||
enabled: true | ||
accessModes: | ||
- ReadWriteOnce | ||
annotations: {} | ||
existingClaim: "" | ||
size: 1Gi |