diff --git a/stable/centrifugo/.helmignore b/stable/centrifugo/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/centrifugo/.helmignore @@ -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 diff --git a/stable/centrifugo/Chart.yaml b/stable/centrifugo/Chart.yaml new file mode 100644 index 0000000000..ded3e86cf9 --- /dev/null +++ b/stable/centrifugo/Chart.yaml @@ -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 \ No newline at end of file diff --git a/stable/centrifugo/README.md b/stable/centrifugo/README.md new file mode 100644 index 0000000000..aa0124d684 --- /dev/null +++ b/stable/centrifugo/README.md @@ -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) \ No newline at end of file diff --git a/stable/centrifugo/templates/NOTES.txt b/stable/centrifugo/templates/NOTES.txt new file mode 100644 index 0000000000..cc66c18e59 --- /dev/null +++ b/stable/centrifugo/templates/NOTES.txt @@ -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 }} diff --git a/stable/centrifugo/templates/_helpers.tpl b/stable/centrifugo/templates/_helpers.tpl new file mode 100644 index 0000000000..f0d83d2edb --- /dev/null +++ b/stable/centrifugo/templates/_helpers.tpl @@ -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 -}} diff --git a/stable/centrifugo/templates/configmap.yaml b/stable/centrifugo/templates/configmap.yaml new file mode 100644 index 0000000000..ee45508a9a --- /dev/null +++ b/stable/centrifugo/templates/configmap.yaml @@ -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 }} \ No newline at end of file diff --git a/stable/centrifugo/templates/deployment.yaml b/stable/centrifugo/templates/deployment.yaml new file mode 100644 index 0000000000..0c381c95f8 --- /dev/null +++ b/stable/centrifugo/templates/deployment.yaml @@ -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 \ No newline at end of file diff --git a/stable/centrifugo/templates/ingress.yaml b/stable/centrifugo/templates/ingress.yaml new file mode 100644 index 0000000000..4a58e66a66 --- /dev/null +++ b/stable/centrifugo/templates/ingress.yaml @@ -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 -}} diff --git a/stable/centrifugo/templates/secret.yaml b/stable/centrifugo/templates/secret.yaml new file mode 100644 index 0000000000..5c870082a2 --- /dev/null +++ b/stable/centrifugo/templates/secret.yaml @@ -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 }} \ No newline at end of file diff --git a/stable/centrifugo/templates/service.yaml b/stable/centrifugo/templates/service.yaml new file mode 100644 index 0000000000..1f898962b2 --- /dev/null +++ b/stable/centrifugo/templates/service.yaml @@ -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 }} diff --git a/stable/centrifugo/values.yaml b/stable/centrifugo/values.yaml new file mode 100644 index 0000000000..df6d0e10cb --- /dev/null +++ b/stable/centrifugo/values.yaml @@ -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: {} \ No newline at end of file