Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm-Chart for Bloom #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions deploy/charts/bloom/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: bloom
description: A Helm chart for Kubernetes deployment of the Rust-API-Proxy Bloom

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.32"
63 changes: 63 additions & 0 deletions deploy/charts/bloom/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# bloom

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

A Helm chart for Kubernetes deployment of the Rust-API-Proxy Bloom

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80,"targetMemoryUtilizationPercentage":80}` | This Horizontal Pod Autoscaler works from K8S version 1.23 onwards |
| bloom.cache.compress_body | bool | `true` | |
| bloom.cache.disable_read | bool | `false` | |
| bloom.cache.disable_write | bool | `false` | |
| bloom.cache.executor_pool | int | `64` | |
| bloom.cache.ttl_default | int | `600` | |
| bloom.control.inet | string | `"[::1]:8811"` | |
| bloom.control.tcp_timeout | int | `300` | |
| bloom.proxy.shard_default | int | `0` | sets the default shard if none is set in the request |
| bloom.proxy.shards[0].host | string | `""` | |
| bloom.proxy.shards[0].ingress.annotations | object | `{}` | |
| bloom.proxy.shards[0].ingress.className | string | `""` | |
| bloom.proxy.shards[0].ingress.enabled | bool | `true` | |
| bloom.proxy.shards[0].ingress.hosts[0].host | string | `"chart-example.local"` | |
| bloom.proxy.shards[0].ingress.hosts[0].paths[0].path | string | `"/"` | |
| bloom.proxy.shards[0].ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
| bloom.proxy.shards[0].ingress.tls | list | `[]` | |
| bloom.proxy.shards[0].port | string | `""` | |
| bloom.proxy.shards[0].shard | int | `0` | |
| bloom.redis.connection_timeout_seconds | int | `1` | |
| bloom.redis.database | int | `0` | |
| bloom.redis.host | string | `nil` | |
| bloom.redis.idle_timeout_seconds | int | `600` | |
| bloom.redis.max_key_expiration | int | `2592000` | |
| bloom.redis.max_key_size | int | `256000` | |
| bloom.redis.max_lifetime_seconds | int | `60` | |
| bloom.redis.pool_size | int | `80` | |
| bloom.redis.port | string | `nil` | |
| bloom.server.inet | string | `"[::1]:8080"` | |
| bloom.server.log_level | string | `"error"` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"valeriansaliou/bloom"` | |
| image.tag | string | `""` | |
| imagePullSecrets | list | `[]` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| service.control.port | int | `8811` | |
| service.http.port | int | `80` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
| tolerations | list | `[]` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
25 changes: 25 additions & 0 deletions deploy/charts/bloom/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
1. Get the application URL by running these commands:
{{- range $shard := .Values.bloom.proxy.shards }}
{{- if $shard.ingress.enabled }}
{{- range $host := .ingress.host }}
{{- range $host.paths }}
http{{ if $shard.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}

{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "bloom.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 --namespace {{ .Release.Namespace }} svc -w {{ include "bloom.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bloom.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
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 "bloom.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
{{- end }}
62 changes: 62 additions & 0 deletions deploy/charts/bloom/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "bloom.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 "bloom.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 "bloom.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "bloom.labels" -}}
helm.sh/chart: {{ include "bloom.chart" . }}
{{ include "bloom.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "bloom.selectorLabels" -}}
app.kubernetes.io/name: {{ include "bloom.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "bloom.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "bloom.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
56 changes: 56 additions & 0 deletions deploy/charts/bloom/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "bloom.fullname" . }}-config
labels:
{{- include "bloom.labels" . | nindent 4 }}
data:
bloom.cfg: |
[server]

log_level = {{ .Values.bloom.server.log_level | default "error" | quote }}
inet = {{ .Values.bloom.server.inet | default "[::1]:8080" | quote }}


[control]

inet = {{ .Values.bloom.control.inet | default "[::1]:8811" | quote }}
tcp_timeout = {{ .Values.bloom.control.tcp_timeout | default "300" }}


[proxy]

shard_default = {{ .Values.bloom.proxy.shard_default | default 0 }}

{{ range .Values.bloom.proxy.shards | required "At least one valid list entry is required" }}
[[proxy.shard]]
shard = {{ .shard }}
host = {{ .host | quote}}
port = {{ .port }}
{{end}}

[cache]

ttl_default = {{ .Values.bloom.cache.ttl_default | default 600 }}
executor_pool = {{ .Values.bloom.cache.executor_pool | default 64 }}

disable_read = {{ .Values.bloom.cache.disable_read | default false}}
disable_write = {{ .Values.bloom.cache.disable_write | default false }}

compress_body = {{ .Values.bloom.cache.compress_body | default true }}


[redis]

host = {{.Values.bloom.redis.host | default "redis.svc.cluster.local" | quote }}
port = {{.Values.bloom.redis.port | default 6379 }}

database = {{ .Values.bloom.redis.database |default 0 }}

pool_size = {{ .Values.bloom.redis.pool_size | default 80 }}
max_lifetime_seconds = {{ .Values.bloom.redis.max_lifetime_seconds | default 60 }}
idle_timeout_seconds = {{ .Values.bloom.redis.idle_timeout_seconds | default 600 }}
connection_timeout_seconds = {{ .Values.bloom.redis.connection_timeout_seconds | default 1 }}

max_key_size = {{ .Values.bloom.redis.max_key_size | default 256000 }}
max_key_expiration = {{ .Values.bloom.redis.max_key_expiration | default 2592000 | int}}
72 changes: 72 additions & 0 deletions deploy/charts/bloom/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "bloom.fullname" . }}
labels:
{{- include "bloom.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "bloom.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "bloom.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "bloom.fullname" . }}-config
serviceAccountName: {{ include "bloom.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
- name: control
containerPort: 8811
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: /etc/bloom.cfg
subPath: bloom.cfg
name: config
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
32 changes: 32 additions & 0 deletions deploy/charts/bloom/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "bloom.fullname" . }}
labels:
{{- include "bloom.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "bloom.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
Loading