mirror of
https://github.com/truenas/charts.git
synced 2026-02-13 23:35:36 +08:00
NAS-122432 / 23.10 / add redis to community train (#1261)
* add `redis` to `community` train * add extra validation * add error message * enclose pattern in squotes * bump common
This commit is contained in:
6
library/ix-dev/community/redis/Chart.lock
Normal file
6
library/ix-dev/community/redis/Chart.lock
Normal file
@@ -0,0 +1,6 @@
|
||||
dependencies:
|
||||
- name: common
|
||||
repository: file://../../../common
|
||||
version: 1.0.9
|
||||
digest: sha256:c3eb00f142d5d1cdbff7843940c150a00bd916520363e6ee9f459ce61fa92b40
|
||||
generated: "2023-06-29T16:01:12.464571053+03:00"
|
||||
25
library/ix-dev/community/redis/Chart.yaml
Normal file
25
library/ix-dev/community/redis/Chart.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
name: redis
|
||||
description: Redis. The open source, in-memory data store used by millions of developers as a database, cache, streaming engine, and message broker.
|
||||
annotations:
|
||||
title: Redis
|
||||
type: application
|
||||
version: 1.0.0
|
||||
apiVersion: v2
|
||||
appVersion: 7.0.11
|
||||
kubeVersion: '>=1.16.0-0'
|
||||
maintainers:
|
||||
- name: truenas
|
||||
url: https://www.truenas.com/
|
||||
email: dev@ixsystems.com
|
||||
dependencies:
|
||||
- name: common
|
||||
repository: file://../../../common
|
||||
version: 1.0.9
|
||||
home: https://redis.io/
|
||||
icon: https://avatars.githubusercontent.com/u/1529926?s=200&v=4
|
||||
sources:
|
||||
- https://hub.docker.com/r/bitnami/redis
|
||||
- https://github.com/bitnami/containers/tree/main/bitnami/redis
|
||||
- https://redis.io/
|
||||
keywords:
|
||||
- cache
|
||||
8
library/ix-dev/community/redis/README.md
Normal file
8
library/ix-dev/community/redis/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Redis
|
||||
|
||||
[Redis](https://redis.io/). The open source, in-memory data store used by millions of developers as a database, cache, streaming engine, and message broker.
|
||||
|
||||
> When application is installed, a container will be launched with **root** privileges.
|
||||
> This is required in order to apply the correct permissions to the `Redis` directories.
|
||||
> Afterward, the `Redis` container will run as a **non**-root user (`1001`) and root group.
|
||||
> All mounted storage(s) will be `chown`ed only if the parent directory does not match `1001` user.
|
||||
8
library/ix-dev/community/redis/app-readme.md
Normal file
8
library/ix-dev/community/redis/app-readme.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Redis
|
||||
|
||||
[Redis](https://redis.io/). The open source, in-memory data store used by millions of developers as a database, cache, streaming engine, and message broker.
|
||||
|
||||
> When application is installed, a container will be launched with **root** privileges.
|
||||
> This is required in order to apply the correct permissions to the `Redis` directories.
|
||||
> Afterward, the `Redis` container will run as a **non**-root user (`1001`) and root group.
|
||||
> All mounted storage(s) will be `chown`ed only if the parent directory does not match `1001` user.
|
||||
BIN
library/ix-dev/community/redis/charts/common-1.0.9.tgz
Normal file
BIN
library/ix-dev/community/redis/charts/common-1.0.9.tgz
Normal file
Binary file not shown.
7
library/ix-dev/community/redis/ci/basic-values.yaml
Normal file
7
library/ix-dev/community/redis/ci/basic-values.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
redisStorage:
|
||||
data:
|
||||
type: hostPath
|
||||
hostPath: /mnt/{{ .Release.Name }}/data
|
||||
|
||||
redisConfig:
|
||||
password: pass
|
||||
@@ -0,0 +1,7 @@
|
||||
redisStorage:
|
||||
data:
|
||||
type: hostPath
|
||||
hostPath: /mnt/{{ .Release.Name }}/data
|
||||
|
||||
redisConfig:
|
||||
allowEmptyPassword: true
|
||||
6
library/ix-dev/community/redis/item.yaml
Normal file
6
library/ix-dev/community/redis/item.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
icon_url: https://avatars.githubusercontent.com/u/1529926?s=200&v=4
|
||||
screenshots: []
|
||||
categories:
|
||||
- database
|
||||
tags:
|
||||
- cache
|
||||
8
library/ix-dev/community/redis/metadata.yaml
Normal file
8
library/ix-dev/community/redis/metadata.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
runAsContext:
|
||||
- userName: redis
|
||||
groupName: root
|
||||
gid: 1001
|
||||
uid: 0
|
||||
description: Redis runs as a non-root user and root group.
|
||||
capabilities: []
|
||||
hostMounts: []
|
||||
131
library/ix-dev/community/redis/questions.yaml
Normal file
131
library/ix-dev/community/redis/questions.yaml
Normal file
@@ -0,0 +1,131 @@
|
||||
groups:
|
||||
- name: Redis Configuration
|
||||
description: Configure Redis
|
||||
- name: Network Configuration
|
||||
description: Configure Network for Redis
|
||||
- name: Storage Configuration
|
||||
description: Configure Storage for Redis
|
||||
- name: Resources Configuration
|
||||
description: Configure Resources for Redis
|
||||
|
||||
questions:
|
||||
- variable: redisConfig
|
||||
label: ""
|
||||
group: Redis Configuration
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: allowEmptyPassword
|
||||
label: Allow Empty Password
|
||||
description: |
|
||||
Allow empty password for Redis.</br>
|
||||
It's recommended to keep this disabled.
|
||||
schema:
|
||||
type: boolean
|
||||
default: false
|
||||
- variable: password
|
||||
label: Password
|
||||
description: Password for Redis.
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
private: true
|
||||
# Character @ is not allowed in password
|
||||
valid_chars: '^((?!@).)*$'
|
||||
valid_chars_error: "Character @ is not allowed in password"
|
||||
show_if: [[ "allowEmptyPassword", "=", false ]]
|
||||
default: ""
|
||||
|
||||
- variable: redisNetwork
|
||||
label: ""
|
||||
group: Network Configuration
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: hostNetwork
|
||||
label: Host Network
|
||||
description: |
|
||||
Bind to the host network. It's recommended to keep this disabled.</br>
|
||||
schema:
|
||||
type: boolean
|
||||
default: false
|
||||
- variable: redisPort
|
||||
label: Redis Port
|
||||
description: The port for Redis.
|
||||
schema:
|
||||
type: int
|
||||
default: 30036
|
||||
min: 9000
|
||||
max: 65535
|
||||
required: true
|
||||
|
||||
- variable: redisStorage
|
||||
label: ""
|
||||
group: Storage Configuration
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: data
|
||||
label: Redis Data Storage
|
||||
description: The path to store Redis Data.
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: type
|
||||
label: Type
|
||||
description: |
|
||||
ixVolume: Is dataset created automatically by the system.</br>
|
||||
Host Path: Is a path that already exists on the system.
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
default: "ixVolume"
|
||||
enum:
|
||||
- value: "hostPath"
|
||||
description: Host Path (Path that already exists on the system)
|
||||
- value: "ixVolume"
|
||||
description: ixVolume (Dataset created automatically by the system)
|
||||
- variable: datasetName
|
||||
label: Dataset Name
|
||||
schema:
|
||||
type: string
|
||||
show_if: [["type", "=", "ixVolume"]]
|
||||
required: true
|
||||
hidden: true
|
||||
immutable: true
|
||||
default: "data"
|
||||
$ref:
|
||||
- "normalize/ixVolume"
|
||||
- variable: hostPath
|
||||
label: Host Path
|
||||
schema:
|
||||
type: hostpath
|
||||
show_if: [["type", "=", "hostPath"]]
|
||||
immutable: true
|
||||
required: true
|
||||
|
||||
- variable: resources
|
||||
group: Resources Configuration
|
||||
label: ""
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: limits
|
||||
label: Limits
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: cpu
|
||||
label: CPU
|
||||
description: CPU limit for Redis.
|
||||
schema:
|
||||
type: string
|
||||
default: "4000m"
|
||||
required: true
|
||||
- variable: memory
|
||||
label: Memory
|
||||
description: Memory limit for Redis.
|
||||
schema:
|
||||
type: string
|
||||
default: "8Gi"
|
||||
required: true
|
||||
1
library/ix-dev/community/redis/templates/NOTES.txt
Normal file
1
library/ix-dev/community/redis/templates/NOTES.txt
Normal file
@@ -0,0 +1 @@
|
||||
{{ include "ix.v1.common.lib.chart.notes" $ }}
|
||||
11
library/ix-dev/community/redis/templates/_configuration.tpl
Normal file
11
library/ix-dev/community/redis/templates/_configuration.tpl
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- define "redis.configuration" -}}
|
||||
configmap:
|
||||
config:
|
||||
enabled: true
|
||||
data:
|
||||
REDIS_PORT_NUMBER: {{ .Values.redisNetwork.redisPort | quote }}
|
||||
ALLOW_EMPTY_PASSWORD: {{ ternary "yes" "no" .Values.redisConfig.allowEmptyPassword | quote }}
|
||||
{{- if not .Values.redisConfig.allowEmptyPassword }}
|
||||
REDIS_PASSWORD: {{ .Values.redisConfig.password | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
101
library/ix-dev/community/redis/templates/_redis.tpl
Normal file
101
library/ix-dev/community/redis/templates/_redis.tpl
Normal file
@@ -0,0 +1,101 @@
|
||||
{{- define "redis.workload" -}}
|
||||
workload:
|
||||
redis:
|
||||
enabled: true
|
||||
primary: true
|
||||
type: Deployment
|
||||
podSpec:
|
||||
hostNetwork: {{ .Values.redisNetwork.hostNetwork }}
|
||||
securityContext:
|
||||
fsGroup: 1001
|
||||
containers:
|
||||
redis:
|
||||
enabled: true
|
||||
primary: true
|
||||
imageSelector: image
|
||||
securityContext:
|
||||
runAsUser: 1001
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
readOnlyRootFilesystem: false
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: config
|
||||
{{ with .Values.redisConfig.additionalEnvs }}
|
||||
envList:
|
||||
{{ range $env := . }}
|
||||
- name: {{ $env.name }}
|
||||
value: {{ $env.value }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
probes:
|
||||
{{ $args := printf "-p %v" .Values.redisNetwork.redisPort }}
|
||||
{{ if not .Values.redisConfig.allowEmptyPassword }}
|
||||
{{ $args = printf "%v -a %v" $args .Values.redisConfig.password }}
|
||||
{{ end }}
|
||||
liveness:
|
||||
enabled: true
|
||||
type: exec
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
redis-cli {{ $args }} ping | grep -q PONG
|
||||
readiness:
|
||||
enabled: true
|
||||
type: exec
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
redis-cli {{ $args }} ping | grep -q PONG
|
||||
startup:
|
||||
enabled: true
|
||||
type: exec
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
redis-cli {{ $args }} ping | grep -q PONG
|
||||
initContainers:
|
||||
{{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
|
||||
"UID" 1001
|
||||
"GID" 1001
|
||||
"mode" "check"
|
||||
"type" "init") | nindent 8 }}
|
||||
{{/* Service */}}
|
||||
service:
|
||||
redis:
|
||||
enabled: true
|
||||
primary: true
|
||||
type: NodePort
|
||||
targetSelector: redis
|
||||
ports:
|
||||
redis:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: {{ .Values.redisNetwork.redisPort }}
|
||||
nodePort: {{ .Values.redisNetwork.redisPort }}
|
||||
targetSelector: redis
|
||||
|
||||
{{/* Persistence */}}
|
||||
persistence:
|
||||
data:
|
||||
enabled: true
|
||||
type: {{ .Values.redisStorage.data.type }}
|
||||
datasetName: {{ .Values.redisStorage.data.datasetName | default "" }}
|
||||
hostPath: {{ .Values.redisStorage.data.hostPath | default "" }}
|
||||
targetSelector:
|
||||
redis:
|
||||
redis:
|
||||
mountPath: /bitnami/redis/data
|
||||
01-permissions:
|
||||
mountPath: /mnt/directories/data
|
||||
tmp:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
targetSelector:
|
||||
redis:
|
||||
redis:
|
||||
mountPath: /tmp
|
||||
{{- end -}}
|
||||
11
library/ix-dev/community/redis/templates/_validation.tpl
Normal file
11
library/ix-dev/community/redis/templates/_validation.tpl
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- define "redis.validation" -}}
|
||||
{{- if not .Values.redisConfig.allowEmptyPassword -}}
|
||||
{{- if not .Values.redisConfig.password -}}
|
||||
{{- fail "Redis - Field [Password] is required when [Allow Empty Password] is false" -}}
|
||||
{{- end -}}
|
||||
{{- if contains "@" .Values.redisConfig.password -}}
|
||||
{{- fail "Redis - Field [Password] cannot contain '@'" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
8
library/ix-dev/community/redis/templates/common.yaml
Normal file
8
library/ix-dev/community/redis/templates/common.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
{{- include "ix.v1.common.loader.init" . -}}
|
||||
|
||||
{{/* Merge the templates with Values */}}
|
||||
{{- include "redis.validation" $ -}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "redis.configuration" $ | fromYaml) -}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "redis.workload" $ | fromYaml) -}}
|
||||
|
||||
{{- include "ix.v1.common.loader.apply" . -}}
|
||||
1
library/ix-dev/community/redis/upgrade_info.json
Normal file
1
library/ix-dev/community/redis/upgrade_info.json
Normal file
@@ -0,0 +1 @@
|
||||
{"filename": "values.yaml", "keys": ["image"]}
|
||||
30
library/ix-dev/community/redis/upgrade_strategy
Executable file
30
library/ix-dev/community/redis/upgrade_strategy
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/python3
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
|
||||
from catalog_update.upgrade_strategy import semantic_versioning
|
||||
|
||||
RE_STABLE_VERSION = re.compile(r'[1-9]+\.[0-9]+\.[0-9]+')
|
||||
|
||||
|
||||
def newer_mapping(image_tags):
|
||||
key = list(image_tags.keys())[0]
|
||||
tags = {t: t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
|
||||
version = semantic_versioning(list(tags))
|
||||
if not version:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'tags': {key: tags[version]},
|
||||
'app_version': version,
|
||||
}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
versions_json = json.loads(sys.stdin.read())
|
||||
except ValueError:
|
||||
raise ValueError('Invalid json specified')
|
||||
|
||||
print(json.dumps(newer_mapping(versions_json)))
|
||||
23
library/ix-dev/community/redis/values.yaml
Normal file
23
library/ix-dev/community/redis/values.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
image:
|
||||
repository: bitnami/redis
|
||||
pullPolicy: IfNotPresent
|
||||
tag: 7.0.11
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
|
||||
redisConfig:
|
||||
allowEmptyPassword: false
|
||||
password: ''
|
||||
additionalEnvs: []
|
||||
|
||||
redisNetwork:
|
||||
hostNetwork: false
|
||||
redisPort: 30036
|
||||
|
||||
redisStorage:
|
||||
data:
|
||||
type: ixVolume
|
||||
datasetName: data
|
||||
Reference in New Issue
Block a user