Skip to content
Draft
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
12 changes: 12 additions & 0 deletions charts/silver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@ dependencies:
version: 0.1.0
repository: file://charts/opendkim
condition: opendkim.enabled
- name: redis
version: 0.1.0
repository: file://charts/redis
condition: redis.enabled
- name: unbound
version: 0.1.0
repository: file://charts/unbound
condition: unbound.enabled
- name: rspamd
version: 0.1.0
repository: file://charts/rspamd
condition: rspamd.enabled
12 changes: 12 additions & 0 deletions charts/silver/charts/redis/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: redis
description: Redis in-memory data store for rspamd backend
type: application
version: 0.1.0
appVersion: "7-alpine"
keywords:
- redis
- cache
- rspamd
maintainers:
- name: Silver Team
48 changes: 48 additions & 0 deletions charts/silver/charts/redis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Redis Helm Chart

Redis in-memory data store for rspamd backend storage.

## Installation

```bash
helm install redis ./redis \
--set persistence.enabled=true \
--set persistence.size=1Gi
```

## Configuration

Key values:

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `replicaCount` | int | `1` | Number of replicas (always 1 for StatefulSet) |
| `image.repository` | string | `redis` | Image repository |
| `image.tag` | string | `7-alpine` | Image tag |
| `persistence.enabled` | bool | `true` | Enable persistent volume |
| `persistence.size` | string | `1Gi` | Persistent volume size |
| `service.port` | int | `6379` | Service port |
| `securityContext.fsGroup` | int | `999` | Redis user UID |

## Usage

Access Redis within the cluster:

```bash
redis-cli -h <release-name>-redis -p 6379
```

For port-forward:

```bash
kubectl port-forward svc/<release-name>-redis 6379:6379
redis-cli -h localhost -p 6379
```

## Persistence

Redis data is stored in `/data` via `volumeClaimTemplates`. The PVC persists across pod restarts.

## Dependencies

Redis chart has no external dependencies.
60 changes: 60 additions & 0 deletions charts/silver/charts/redis/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "redis.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
*/}}
{{- define "redis.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 "redis.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "redis.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "redis.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/silver/charts/redis/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "redis.fullname" . }}
labels:
{{- include "redis.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: TCP
name: redis
selector:
{{- include "redis.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions charts/silver/charts/redis/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "redis.serviceAccountName" . }}
labels:
{{- include "redis.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
71 changes: 71 additions & 0 deletions charts/silver/charts/redis/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "redis.fullname" . }}
labels:
{{- include "redis.labels" . | nindent 4 }}
spec:
serviceName: {{ include "redis.fullname" . }}
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "redis.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "redis.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "redis.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: redis
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: redis
containerPort: 6379
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: data
spec:
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}
accessModes:
- {{ .Values.persistence.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.size }}
73 changes: 73 additions & 0 deletions charts/silver/charts/redis/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
replicaCount: 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Redis chart is implemented as a basic StatefulSet without clustering or sentinel logic. If replicaCount is set to a value greater than 1, it will result in multiple independent Redis instances, which will cause data inconsistency for Rspamd. This value should remain 1 unless a proper high-availability configuration is implemented.


image:
repository: redis
tag: "7-alpine"
pullPolicy: IfNotPresent

imagePullSecrets: []

nameOverride: ""
fullnameOverride: ""

serviceAccount:
create: true
annotations: {}
name: ""

podAnnotations: {}

podSecurityContext:
fsGroup: 999
runAsUser: 999
runAsNonRoot: true

securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false

service:
type: ClusterIP
port: 6379
targetPort: 6379
annotations: {}

resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

persistence:
enabled: true
storageClass: ""
accessMode: ReadWriteOnce
size: 1Gi
mountPath: /data

livenessProbe:
tcpSocket:
port: 6379
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3

readinessProbe:
tcpSocket:
port: 6379
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
14 changes: 14 additions & 0 deletions charts/silver/charts/rspamd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
name: rspamd
description: Rspamd spam/malware filtering engine for mail processing
type: application
version: 0.1.0
appVersion: "latest"
keywords:
- rspamd
- spam
- filtering
- antivirus
- milter
maintainers:
- name: Silver Team
Loading
Loading