Add centrifugo chart (#1308)

This commit is contained in:
Oleh Ozimok
2017-08-08 22:02:51 +02:00
committed by Reinhard Nägele
parent 969fdd9bb7
commit 5e40a792c6
11 changed files with 374 additions and 0 deletions
+21
View File
@@ -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
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
version: 1.0.0
appVersion: 1.7.3
description: Centrifugo is a real-time messaging server.
name: centrifugo
keywords:
- centrifugo
- websocket
- golang
home: https://github.com/centrifugal/centrifugo
maintainers:
- name: oleh-ozimok
email: ozimok.oleg@gmail.com
icon: https://avatars3.githubusercontent.com/u/6236442
+71
View File
@@ -0,0 +1,71 @@
# Centrifugo
[Centrifugo](https://github.com/centrifugal/centrifugo) is a real-time messaging server. It's language-agnostic and can be used in conjunction with application backend written in any language - Python, Ruby, Perl, PHP, Javascript, Java, Objective-C etc.
## TL;DR;
```bash
$ helm install stable/centrifugo
```
## Introduction
This chart bootstraps a [Centrifugo](https://hub.docker.com/r/centrifugo/centrifugo/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
## Prerequisites
- Kubernetes 1.4+ with Beta APIs enabled
## Installing the Chart
To install the chart with the release name `my-release`:
```bash
$ helm install --name my-release stable/centrifugo
```
The command deploys Centrifugo 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:
```bash
$ helm delete my-release
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
The following tables lists the configurable parameters of the Centrifugo chart and their default values.
| Parameter | Description | Default |
| -------------------------- | ------------------------------------- | --------------------------------------------------------- |
| `image` | Cetrifugo image | `centrifugo/centrifugo:{VERSION}` |
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `config` | Centrifugo config | `default` |
| `args` | Centrifugo args | `--web=true` |
For more information please refer to the [documentation](https://fzambia.gitbooks.io/centrifugal/content/index.html).
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
$ helm install --name my-release \
--set ingress.enabled=true \
stable/centrifugo
```
The above command disable ingress for Centrifugo.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
$ helm install --name my-release -f values.yaml stable/centrifugo
```
> **Tip**: You can use the default [values.yaml](values.yaml)
+19
View File
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
http://{{ $host }}
{{- end -}}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "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 {{ template "fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .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:{{ .Values.service.externalPort }}
{{- end }}
+16
View File
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "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).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}-config
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
data:
config.json: |-
{{ toJson .Values.config| indent 4 }}
@@ -0,0 +1,70 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
labels:
app: {{ template "name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- centrifugo
args:
{{- range $arg := .Values.args }}
- {{ $arg }}
{{- end }}
env:
- name: CENTRIFUGO_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: admin-password
- name: CENTRIFUGO_ADMIN_SECRET
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: admin-secret
- name: CENTRIFUGO_SECRET
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: secret
volumeMounts:
- name: "{{ template "fullname" . }}-config"
mountPath: "/centrifugo"
readOnly: true
ports:
- name: http
containerPort: {{ .Values.service.port }}
livenessProbe:
httpGet:
path: /connection
port: {{ .Values.service.port }}
readinessProbe:
httpGet:
path: /connection
port: {{ .Values.service.port }}
resources:
{{ toYaml .Values.resources | indent 10 }}
volumes:
- name: {{ template "fullname" . }}-config
configMap:
name: {{ template "fullname" . }}-config
+32
View File
@@ -0,0 +1,32 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "fullname" . -}}
{{- $servicePort := .Values.service.port -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "fullname" . }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: /
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
+26
View File
@@ -0,0 +1,26 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque
data:
{{- if .Values.admin.password }}
admin-password: {{ .Values.admin.password | b64enc | quote }}
{{- else }}
admin-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if .Values.admin.secret }}
admin-secret: {{ .Values.admin.secret | b64enc | quote }}
{{- else }}
admin-secret: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if .Values.secret }}
secret: {{ .Values.secret | b64enc | quote }}
{{- else }}
secret: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
+38
View File
@@ -0,0 +1,38 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }}
name: {{ template "fullname" . }}
spec:
type: "{{ .Values.service.type }}"
clusterIP: "{{ .Values.service.clusterIP }}"
{{- if .Values.service.externalIPs }}
externalIPs:
{{ toYaml .Values.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
ports:
- name: http
port: {{ .Values.service.port }}
protocol: TCP
targetPort: http
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
selector:
app: {{ template "name" . }}
release: {{ .Release.Name }}
+55
View File
@@ -0,0 +1,55 @@
replicaCount: 1
image:
repository: centrifugo/centrifugo
tag: 1.7.3
pullPolicy: IfNotPresent
service:
annotations: {}
clusterIP: ""
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
type: ClusterIP
port: 8000
nodePort: ""
ingress:
enabled: false
hosts: []
annotations:
kubernetes.io/ingress.class: nginx
ingress.kubernetes.io/upstream-fail-timeout: 60
ingress.kubernetes.io/upstream-max-fails: 2
ingress.kubernetes.io/proxy-read-timeout: 3600
ingress.kubernetes.io/proxy-send-timeout: 3600
config:
web: true
namespaces:
- name: public
anonymous: true
publish: true
watch: true
presence: true
join_leave: true
history_size: 10
history_lifetime: 30
recover: true
## Centrifugo secret
## Defaults to a random 10-character alphanumeric string if not set
secret: ""
admin:
## Centrifugo admin secret
## Defaults to a random 10-character alphanumeric string if not set
secret: ""
## Centrifugo admin password
## Defaults to a random 10-character alphanumeric string if not set
password: ""
args:
- --web=true
resources: {}