Skip to content

Commit

Permalink
feat(keydb): Create KeyDB chart
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Mar 27, 2024
1 parent f3c81eb commit 38633ed
Show file tree
Hide file tree
Showing 9 changed files with 338 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Also available on [ArtifactHub](https://artifacthub.io/packages/search?repo=gabe
| [Healthchecks <img src='https://raw.githubusercontent.com/gabe565/charts/main/charts/healthchecks/icon.svg' alt='healthchecks icon' width='18px' align='right' loading='lazy'>](charts/healthchecks/) | A cron monitoring tool written in Python & Django |
| [Home Assistant <img src='https://raw.githubusercontent.com/gabe565/charts/main/charts/home-assistant/icon.svg' alt='home-assistant icon' width='18px' align='right' loading='lazy'>](charts/home-assistant/) | Open source home automation that puts local control and privacy first. |
| [Homer <img src='https://raw.githubusercontent.com/bastienwirtz/homer/5609315/public/assets/icons/logo.svg' alt='homer icon' width='18px' align='right' loading='lazy'>](charts/homer/) | A dead simple static HOMepage for your servER to keep your services on hand, from a simple yaml configuration file. |
| [KeyDB <img src='https://raw.githubusercontent.com/gabe565/charts/main/charts/keydb/icon.svg' alt='keydb icon' width='18px' align='right' loading='lazy'>](charts/keydb/) | A Multithreaded Fork of Redis |
| [Limo ](charts/limo/) | A file upload server. |
| [Matrimony <img src='https://raw.githubusercontent.com/gabe565/matrimony/b13163b/frontend/public/img/logo.svg' alt='matrimony icon' width='18px' align='right' loading='lazy'>](charts/matrimony/) | Self-hosted wedding site configured via YAML |
| [Memos <img src='https://raw.githubusercontent.com/gabe565/charts/main/charts/memos/icon.png' alt='memos icon' width='18px' align='right' loading='lazy'>](charts/memos/) | A lightweight, self-hosted memo hub. Open Source and Free forever. |
Expand Down
26 changes: 26 additions & 0 deletions charts/keydb/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# helm-docs templates
*.gotmpl
icon.svg
6 changes: 6 additions & 0 deletions charts/keydb/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: https://bjw-s.github.io/helm-charts
version: 3.0.4
digest: sha256:78897d8e0906d20d125abf971d035d68a19f31ed028eefe244a6d04eef8c76ad
generated: "2024-03-27T00:09:53.95755-05:00"
30 changes: 30 additions & 0 deletions charts/keydb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v2
name: keydb
description: A Multithreaded Fork of Redis
home: https://charts.gabe565.com/charts/keydb/
icon: https://raw.githubusercontent.com/gabe565/charts/main/charts/keydb/icon.svg
type: application
version: 0.0.1
# renovate datasource=docker depName=eqalpha/keydb
appVersion: alpine_x86_64_v6.3.4
kubeVersion: ">=1.22.0-0"
keywords:
- key-value
- cache
- message-broker
- database
dependencies:
- name: common
repository: https://bjw-s.github.io/helm-charts
version: 3.0.4
sources:
- https://github.com/Snapchat/KeyDB
annotations:
artifacthub.io/changes: |-
- kind: added
description: Initial release
artifacthub.io/links: |-
- name: App Source
url: https://github.com/Snapchat/KeyDB
- name: Chart Source
url: https://github.com/gabe565/charts/tree/main/charts/keydb
110 changes: 110 additions & 0 deletions charts/keydb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# KeyDB

<img src="https://raw.githubusercontent.com/gabe565/charts/main/charts/keydb/icon.svg" align="right" width="92" alt="keydb logo">

![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat)
![AppVersion: alpine_x86_64_v6.3.4](https://img.shields.io/badge/AppVersion-alpine_x86_64_v6.3.4-informational?style=flat)

A Multithreaded Fork of Redis

**Homepage:** <https://charts.gabe565.com/charts/keydb/>

**This chart is not maintained by the upstream project and any issues with the chart should be raised
[here](https://github.com/gabe565/charts/issues/new?assignees=gabe565&labels=bug&template=bug_report.yaml&name=keydb&version=0.0.1)**

## Source Code

* <https://github.com/Snapchat/KeyDB>

## Requirements

Kubernetes: `>=1.22.0-0`

## Dependencies

| Repository | Name | Version |
|------------|------|---------|
| <https://bjw-s.github.io/helm-charts> | common | 3.0.4 |

## Installing the Chart

To install the chart with the release name `keydb`

### OCI (Recommended)

```console
helm install keydb oci://ghcr.io/gabe565/charts/keydb
```

### Traditional

```console
helm repo add gabe565 https://charts.gabe565.com
helm repo update
helm install keydb gabe565/keydb
```

## Uninstalling the Chart

To uninstall the `keydb` deployment

```console
helm uninstall keydb
```

The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.

## Configuration

Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
Other values may be used from the [values.yaml](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common/values.yaml) from the [bjw-s common library](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common).

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

```console
helm install keydb \
--set env.TZ="America/New York" \
gabe565/keydb
```

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.

```console
helm install keydb gabe565/keydb -f values.yaml
```

## Custom configuration

### Authentication
Authentication can be enabled by setting the `KEYDB_PASSWORD` environment variable.

Example:
```yaml
controllers:
keydb:
containers:
app:
env:
KEYDB_PASSWORD: changeme
```
## Values
**Important**: When deploying an application Helm chart you can add more values from the bjw-s common library chart [here](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common)
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| controllers.keydb.containers.app.env | object | See [values.yaml](./values.yaml) | Environment variables. |
| controllers.keydb.containers.app.env.TZ | string | `"UTC"` | Set the container timezone |
| controllers.keydb.containers.app.image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| controllers.keydb.containers.app.image.repository | string | `"eqalpha/keydb"` | Image repository |
| controllers.keydb.containers.app.image.tag | string | `"alpine_x86_64_v6.3.4"` | Image tag |
| controllers.keydb.containers.app.securityContext | object | `{"readOnlyRootFilesystem":true}` | KeyDB container security context |
| controllers.keydb.pod | object | `{"securityContext":{"fsGroup":999,"runAsNonRoot":true,"runAsUser":999}}` | Pod security context |
| controllers.keydb.statefulset.volumeClaimTemplates | list | `[]` | Used to create individual disks for each instance. |
| controllers.keydb.type | string | `"statefulset"` | Controller type |
| persistence | object | See [values.yaml](./values.yaml) | Configure persistence for the chart under this key. |

---
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs)
24 changes: 24 additions & 0 deletions charts/keydb/README_CONFIG.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- define "custom.chart.name" -}}
KeyDB
{{- end -}}

{{- define "custom.custom.configuration.header" -}}
## Custom configuration
{{- end -}}

{{- define "custom.custom.configuration" -}}
{{ template "custom.custom.configuration.header" . }}

### Authentication
Authentication can be enabled by setting the `KEYDB_PASSWORD` environment variable.

Example:
```yaml
controllers:
keydb:
containers:
app:
env:
KEYDB_PASSWORD: changeme
```
{{- end -}}
1 change: 1 addition & 0 deletions charts/keydb/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions charts/keydb/templates/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{/* Append the hardcoded settings */}}
{{- define "keydb.harcodedValues" -}}
controllers:
keydb:
containers:
app:
probes:
startup:
enabled: true
custom: true
spec:
exec:
command: [/health/probe_readiness.sh]
periodSeconds: 5
failureThreshold: 30
timeoutSeconds: 2
liveness:
enabled: true
custom: true
spec:
exec:
command: [/health/probe_liveness.sh]
periodSeconds: 10
failureThreshold: 5
timeoutSeconds: 2
readiness:
enabled: true
custom: true
spec:
exec:
command: [/health/probe_readiness.sh]
periodSeconds: 10
failureThreshold: 5
timeoutSeconds: 2

persistence:
health:
enabled: true
type: configMap
name: {{ include "bjw-s.common.lib.chart.names.name" . }}-health
defaultMode: 0755

configMaps:
health:
enabled: true
data:
probe_liveness.sh: |
#!/bin/sh
[[ -n "$KEYDB_PASSWORD" ]] && export REDISCLI_AUTH="$KEYDB_PASSWORD"
response=$(redis-cli -h localhost ping)
responseFirstWord="$(echo "$response" | head -n1 | cut -d' ' -f1)"
if [[ "$response" != PONG ]] && [[ "$responseFirstWord" != LOADING ]] && [[ "$responseFirstWord" != MASTERDOWN ]]; then
echo "$response"
exit 1
fi
probe_readiness.sh: |
#!/bin/sh
[[ -n "$KEYDB_PASSWORD" ]] && export REDISCLI_AUTH="$KEYDB_PASSWORD"
response=$(redis-cli -h localhost ping)
if [[ "$response" != PONG ]]; then
echo "$response"
exit 1
fi
{{- end -}}

{{- $tmplVars := deepCopy . -}}
{{ include "bjw-s.common.loader.init" $tmplVars }}
{{- $defaultValues := include "keydb.harcodedValues" $tmplVars | fromYaml -}}
{{- $_ := mustMerge .Values $defaultValues -}}

{{/* Render the templates */}}
{{ include "bjw-s.common.loader.init" . }}
{{ include "bjw-s.common.loader.generate" . }}
67 changes: 67 additions & 0 deletions charts/keydb/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.0.4/charts/library/common/values.schema.json
#
# IMPORTANT NOTE
#
# This chart inherits from our common library chart. You can check the default values/options here:
# https://github.com/bjw-s/helm-charts/blob/main/charts/library/common/values.yaml
#

controllers:
keydb:
# -- Controller type
type: statefulset
containers:
app:
image:
# -- Image repository
repository: eqalpha/keydb
# -- Image pull policy
pullPolicy: IfNotPresent
# -- Image tag
tag: alpine_x86_64_v6.3.4

# -- Environment variables.
# @default -- See [values.yaml](./values.yaml)
env:
# -- Set the container timezone
TZ: UTC
# KEYDB_PASSWORD:

# -- KeyDB container security context
securityContext:
readOnlyRootFilesystem: true

# -- Pod security context
pod:
securityContext:
runAsNonRoot: true
runAsUser: 999
fsGroup: 999

statefulset:
# -- Used to create individual disks for each instance.
volumeClaimTemplates: []
# - name: data
# globalMounts:
# - path: /data
# storageClass: ""
# accessMode: ReadWriteOnce
# size: 4Gi

# @ignored
service:
keydb:
controller: keydb
ports:
keydb:
port: 6379

# -- Configure persistence for the chart under this key.
# @default -- See [values.yaml](./values.yaml)
persistence:
data:
enabled: false
retain: true
# storageClass: ""
# accessMode: ReadWriteOnce
# size: 4Gi

0 comments on commit 38633ed

Please sign in to comment.