diff --git a/charts/README.md b/charts/README.md index ea4ab07d..ce62231d 100644 --- a/charts/README.md +++ b/charts/README.md @@ -14,6 +14,6 @@ charts/ 1. Copy the chart directory here. 2. Run `helm dependency build charts//` only if it declares subchart dependencies - in `Chart.yaml` (the vendored charts here embed their subcharts directly, so this is - usually not needed). + in `Chart.yaml` (the charts here have no subchart dependencies, so this is usually not needed). + Only add third-party chart code that has a license allowing Intel to use and redistribute it. 3. Commit the full chart including any `charts/` subdirectory. diff --git a/charts/redis-stack/Chart.yaml b/charts/redis-stack/Chart.yaml index c0453ff3..60449f51 100644 --- a/charts/redis-stack/Chart.yaml +++ b/charts/redis-stack/Chart.yaml @@ -1,13 +1,12 @@ +# Copyright (C) 2025-2026 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 apiVersion: v2 name: redis description: Standalone Redis Stack (with RediSearch) for shared use by agentic workloads type: application -version: 0.1.0 +version: 0.2.0 appVersion: "7.4.0" keywords: - redis - memory - vector-search -# redis-stack-server is vendored locally in charts/redis-stack-server/ -# (patched to support affinity + tolerations for node scheduling). -# Do NOT add it back as a Helm dependency — helm dep update would overwrite the patch. diff --git a/charts/redis-stack/charts/redis-stack-server/Chart.yaml b/charts/redis-stack/charts/redis-stack-server/Chart.yaml deleted file mode 100644 index 34929f2d..00000000 --- a/charts/redis-stack/charts/redis-stack-server/Chart.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -appVersion: 7.4.8 -description: A Helm chart for Kubernetes -name: redis-stack-server -type: application -version: 0.4.21 diff --git a/charts/redis-stack/charts/redis-stack-server/templates/_helpers.tpl b/charts/redis-stack/charts/redis-stack-server/templates/_helpers.tpl deleted file mode 100644 index 466bac65..00000000 --- a/charts/redis-stack/charts/redis-stack-server/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "redis-stack.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 "redis-stack.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-stack.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "redis-stack.labels" -}} -helm.sh/chart: {{ include "redis-stack.chart" . }} -{{ include "redis-stack.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "redis-stack.selectorLabels" -}} -app.kubernetes.io/name: {{ include "redis-stack.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "redis-stack.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "redis-stack.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/charts/redis-stack/charts/redis-stack-server/templates/networkpolicy.yaml b/charts/redis-stack/charts/redis-stack-server/templates/networkpolicy.yaml deleted file mode 100644 index f33f8c53..00000000 --- a/charts/redis-stack/charts/redis-stack-server/templates/networkpolicy.yaml +++ /dev/null @@ -1,38 +0,0 @@ -{{- if .Values.redis_stack_server.networkPolicy.enabled }} -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - name: "{{ .Values.name }}" - namespace: {{ .Release.Namespace }} - labels: - app: "{{ .Values.name }}" -spec: - podSelector: - matchLabels: - app: "{{ .Values.name }}" - policyTypes: - - Ingress - ingress: - - from: - {{- if .Values.redis_stack_server.networkPolicy.allowedNamespaces }} - {{- range .Values.redis_stack_server.networkPolicy.allowedNamespaces }} - - namespaceSelector: - matchLabels: - kubernetes.io/metadata.name: {{ . | quote }} - {{- end }} - # Always allow pods in the Redis namespace itself (probes, redis-cli, backups). - - podSelector: {} - {{- else }} - # No allowlist configured: accept connections from any pod in the cluster. - # Populate `allowedNamespaces` to restrict this to specific namespaces. - - namespaceSelector: {} - {{- end }} - ports: - - protocol: TCP - port: {{ .Values.redis_stack_server.port }} - {{- if .Values.redis_stack_server.networkPolicy.meshPort }} - # HBONE port for meshed clients - - protocol: TCP - port: {{ .Values.redis_stack_server.networkPolicy.meshPort }} - {{- end }} -{{- end }} diff --git a/charts/redis-stack/charts/redis-stack-server/templates/redis-stack-server.yaml b/charts/redis-stack/charts/redis-stack-server/templates/redis-stack-server.yaml deleted file mode 100644 index 63465c80..00000000 --- a/charts/redis-stack/charts/redis-stack-server/templates/redis-stack-server.yaml +++ /dev/null @@ -1,79 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: "{{ .Values.name }}" - namespace: {{ .Release.Namespace }} - labels: - app: "{{ .Values.name }}" -spec: - ports: - - port: {{ .Values.redis_stack_server.port }} - name: db - type: {{ .Values.redis_stack_server.service.type }} - selector: - app: "{{ .Values.name }}" ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: "{{ .Values.name }}" -spec: - selector: - matchLabels: - app: "{{ .Values.name }}" - serviceName: "{{ .Values.name }}" - replicas: {{ .Values.redis_stack_server.replicas }} - template: - metadata: - labels: - app: "{{ .Values.name }}" - spec: - terminationGracePeriodSeconds: 10 - securityContext: - seccompProfile: - type: RuntimeDefault - {{- if .Values.redis_stack_server.affinity }} - affinity: -{{ toYaml .Values.redis_stack_server.affinity | indent 8 }} - {{- end }} - {{- if .Values.redis_stack_server.tolerations }} - tolerations: -{{ toYaml .Values.redis_stack_server.tolerations | indent 8 }} - {{- end }} - containers: - - name: "{{ .Values.name }}" - image: {{ .Values.redis_stack_server.image }}:{{ .Values.redis_stack_server.tag }} - imagePullPolicy: Always - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - ports: - - containerPort: {{ .Values.redis_stack_server.port }} - name: db - {{- if .Values.redis_stack_server.auth.enabled }} - env: - - name: REDIS_PASSWORD - valueFrom: - secretKeyRef: - name: "{{ .Values.name }}-credentials" - key: REDIS_PASSWORD - # redis-stack-server appends REDIS_ARGS to the redis-server command line. - - name: REDIS_ARGS - value: "--requirepass $(REDIS_PASSWORD)" - {{- end }} - volumeMounts: - - name: db - mountPath: /data - volumeClaimTemplates: - - metadata: - name: db - spec: - accessModes: [ "ReadWriteOnce" ] - {{- if .Values.redis_stack_server.storage_class }} - storageClassName: {{ .Values.redis_stack_server.storage_class }} - {{- end }} - resources: - requests: - storage: {{ .Values.redis_stack_server.storage }} diff --git a/charts/redis-stack/charts/redis-stack-server/templates/secret.yaml b/charts/redis-stack/charts/redis-stack-server/templates/secret.yaml deleted file mode 100644 index 20249b51..00000000 --- a/charts/redis-stack/charts/redis-stack-server/templates/secret.yaml +++ /dev/null @@ -1,18 +0,0 @@ -{{- if .Values.redis_stack_server.auth.enabled }} -{{- if empty .Values.redis_stack_server.auth.password }} -{{- fail "redis-stack-server: redis_stack_server.auth.password must be set when auth is enabled. Pass it via --set \"redis-stack-server.redis_stack_server.auth.password=\" or a custom values file. To deploy without authentication (NOT recommended, unauthenticated Redis allows arbitrary reads, writes and Lua/JS execution) set redis_stack_server.auth.enabled=false." }} -{{- end }} -apiVersion: v1 -kind: Secret -metadata: - name: "{{ .Values.name }}-credentials" - namespace: {{ .Release.Namespace }} - labels: - app: "{{ .Values.name }}" -type: Opaque -stringData: - REDIS_PASSWORD: {{ .Values.redis_stack_server.auth.password | quote }} - # The `default:` username is required — Redis 6+ rejects an empty username, - # so the `redis://:@...` short form fails with WRONGPASS. - REDIS_URL: "redis://default:{{ .Values.redis_stack_server.auth.password }}@{{ .Values.name }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.redis_stack_server.port }}" -{{- end }} diff --git a/charts/redis-stack/charts/redis-stack-server/values.yaml b/charts/redis-stack/charts/redis-stack-server/values.yaml deleted file mode 100644 index b6881d99..00000000 --- a/charts/redis-stack/charts/redis-stack-server/values.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: redis-stack-server -redis_stack_server: - image: "redis/redis-stack-server" - tag: "7.4.0-v8" - port: 6379 - replicas: 1 - storage_class: "" - storage: 1Gi - affinity: {} - auth: - # Redis requires a password (requirepass) by default. The password is stored - # in the `-credentials` Secret and injected via REDIS_ARGS. - # Required: set via --set or a custom values file. There is no default. - enabled: true - password: "" - service: - # ClusterIP keeps Redis reachable only from inside the cluster. - # Do NOT use NodePort/LoadBalancer: that publishes Redis on every node IP - # in the 30000-32767 range, where it is reachable by anything that can - # route to a node. - type: ClusterIP - # Restrict ingress to the namespaces/pods that actually need Redis. - # With an empty `allowedNamespaces`, all in-cluster pods may connect (the - # pre-existing behaviour); listing namespaces limits it to those only. - networkPolicy: - enabled: true - allowedNamespaces: [] diff --git a/charts/redis-stack/templates/_helpers.tpl b/charts/redis-stack/templates/_helpers.tpl new file mode 100644 index 00000000..1c6f631d --- /dev/null +++ b/charts/redis-stack/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* +Copyright (C) 2025-2026 Intel Corporation +SPDX-License-Identifier: Apache-2.0 +*/}} + +{{/* Resource name shared by the Service, StatefulSet and NetworkPolicy. */}} +{{- define "redis.fullname" -}} +{{- .Values.name | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* Secret holding REDIS_PASSWORD and REDIS_URL. */}} +{{- define "redis.secretName" -}} +{{- printf "%s-credentials" (include "redis.fullname" .) }} +{{- end }} + +{{/* +Selector labels. The StatefulSet selector is immutable, so this stays the single +`app` label that existing installs were created with. +*/}} +{{- define "redis.selectorLabels" -}} +app: {{ include "redis.fullname" . | quote }} +{{- end }} + +{{/* Labels for every object. */}} +{{- define "redis.labels" -}} +{{ include "redis.selectorLabels" . }} +helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version }} +app.kubernetes.io/name: {{ .Chart.Name }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} diff --git a/charts/redis-stack/templates/networkpolicy.yaml b/charts/redis-stack/templates/networkpolicy.yaml new file mode 100644 index 00000000..57325572 --- /dev/null +++ b/charts/redis-stack/templates/networkpolicy.yaml @@ -0,0 +1,37 @@ +# Copyright (C) 2025-2026 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +{{- if .Values.networkPolicy.enabled }} +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: {{ include "redis.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "redis.labels" . | nindent 4 }} +spec: + podSelector: + matchLabels: + {{- include "redis.selectorLabels" . | nindent 6 }} + policyTypes: ["Ingress"] + ingress: + - from: + {{- with .Values.networkPolicy.allowedNamespaces }} + {{- range . }} + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: {{ . | quote }} + {{- end }} + # Pods in the release namespace (for example, validation jobs) are always allowed. + - podSelector: {} + {{- else }} + # No allowlist: any pod in the cluster may connect. + - namespaceSelector: {} + {{- end }} + ports: + - protocol: TCP + port: {{ .Values.port }} + {{- with .Values.networkPolicy.meshPort }} + - protocol: TCP + port: {{ . }} + {{- end }} +{{- end }} diff --git a/charts/redis-stack/templates/secret.yaml b/charts/redis-stack/templates/secret.yaml new file mode 100644 index 00000000..5f85eaf3 --- /dev/null +++ b/charts/redis-stack/templates/secret.yaml @@ -0,0 +1,19 @@ +# Copyright (C) 2025-2026 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +{{- if .Values.auth.enabled }} +{{- if empty .Values.auth.password }} +{{- fail "redis: auth.password must be set when auth.enabled is true. Pass it via --set or a custom values file." }} +{{- end }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "redis.secretName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "redis.labels" . | nindent 4 }} +type: Opaque +stringData: + REDIS_PASSWORD: {{ .Values.auth.password | quote }} + # Redis 6+ needs a username in the URL; the built-in user is `default`. + REDIS_URL: "redis://default:{{ .Values.auth.password }}@{{ include "redis.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.port }}" +{{- end }} diff --git a/charts/redis-stack/templates/service.yaml b/charts/redis-stack/templates/service.yaml new file mode 100644 index 00000000..15c2950a --- /dev/null +++ b/charts/redis-stack/templates/service.yaml @@ -0,0 +1,18 @@ +# Copyright (C) 2025-2026 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +apiVersion: v1 +kind: Service +metadata: + name: {{ include "redis.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "redis.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + selector: + {{- include "redis.selectorLabels" . | nindent 4 }} + ports: + - name: db + port: {{ .Values.port }} + targetPort: db + protocol: TCP diff --git a/charts/redis-stack/templates/statefulset.yaml b/charts/redis-stack/templates/statefulset.yaml new file mode 100644 index 00000000..cb325a10 --- /dev/null +++ b/charts/redis-stack/templates/statefulset.yaml @@ -0,0 +1,78 @@ +# Copyright (C) 2025-2026 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +{{- /* Settings of the previous chart layout are no longer read: stop instead of silently ignoring them. */}} +{{- if hasKey .Values "redis-stack-server" }} +{{- fail "redis: the redis-stack-server.redis_stack_server.* settings are no longer used. Move them to the top level of the values (auth, persistence.storageClassName, persistence.size, networkPolicy, affinity, tolerations, resources) — see charts/redis-stack/values.yaml. Keep persistence.storageClassName and persistence.size equal to the installed values: the StatefulSet volume claim cannot change." }} +{{- end }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "redis.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "redis.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicas }} + serviceName: {{ include "redis.fullname" . }} + selector: + matchLabels: + {{- include "redis.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "redis.labels" . | nindent 8 }} + spec: + terminationGracePeriodSeconds: 10 + securityContext: + seccompProfile: + type: RuntimeDefault + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: redis-stack-server + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + ports: + - name: db + containerPort: {{ .Values.port }} + protocol: TCP + {{- if .Values.auth.enabled }} + env: + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "redis.secretName" . }} + key: REDIS_PASSWORD + # The redis-stack-server image passes REDIS_ARGS on to redis-server. + - name: REDIS_ARGS + value: "--requirepass $(REDIS_PASSWORD)" + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: db + mountPath: /data + # The claim name `db` must not change: volumeClaimTemplates are immutable. + volumeClaimTemplates: + - metadata: + name: db + spec: + accessModes: ["ReadWriteOnce"] + {{- if .Values.persistence.storageClassName }} + storageClassName: {{ .Values.persistence.storageClassName | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size }} diff --git a/charts/redis-stack/values.yaml b/charts/redis-stack/values.yaml index ba4f1449..c32f6ed3 100644 --- a/charts/redis-stack/values.yaml +++ b/charts/redis-stack/values.yaml @@ -1,4 +1,5 @@ - +# Copyright (C) 2025-2026 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 # --------------------------------------------------------------------------- # Standalone Redis Stack — shared memory backend for agentic workloads # @@ -15,31 +16,50 @@ # # --------------------------------------------------------------------------- -redis-stack-server: - redis_stack_server: - # Leave storage_class empty to use the cluster's default StorageClass automatically. - # Override via --set "redis-stack-server.redis_stack_server.storage_class=" if needed. - storage_class: "" - storage: 4Gi - auth: - # Required: set via --set or a custom values file. Do not use defaults in - # production. deploy_redis_controller reads this from vault.yml. - enabled: true - password: "" - service: - # Keep this ClusterIP. NodePort would publish Redis on every node IP. - type: ClusterIP - networkPolicy: - enabled: true - # Empty = any in-cluster pod may connect. List namespaces to restrict. - allowedNamespaces: [] - # Placement is left to the scheduler (AI Solutions applies workload-class - # node labels/affinity at the platform layer). - affinity: {} - tolerations: - - key: "node-role.kubernetes.io/control-plane" - operator: "Exists" - effect: "NoSchedule" - - key: "node-role.kubernetes.io/master" - operator: "Exists" - effect: "NoSchedule" +# Name of the Service, StatefulSet and NetworkPolicy, and prefix of the +# `-credentials` Secret. Clients and the redis_stack role use these names, +# and a StatefulSet selector cannot change on upgrade, so keep it as is. +name: redis-stack-server + +image: + repository: redis/redis-stack-server + tag: "7.4.0-v8" + pullPolicy: Always + +port: 6379 +replicas: 1 + +auth: + # Required: set the password via --set or a custom values file. There is no + # default. The redis_stack role reads it from the existing Secret or vault.yml. + enabled: true + password: "" + +persistence: + # Empty = use the cluster's default StorageClass. + storageClassName: "" + size: 4Gi + +service: + # Keep this ClusterIP. NodePort would publish Redis on every node IP. + type: ClusterIP + +networkPolicy: + enabled: true + # Empty = any in-cluster pod may connect. List namespaces to restrict. + allowedNamespaces: [] + # Extra port to admit for meshed clients (Istio ambient HBONE is 15008). Empty = none. + meshPort: "" + +resources: {} + +# Placement is left to the scheduler; Toolkit Manager applies workload-class +# node labels and affinity at the platform layer. +affinity: {} +tolerations: + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" diff --git a/roles/redis_stack/tasks/install.yaml b/roles/redis_stack/tasks/install.yaml index 6f8dbfc4..8427dbf0 100644 --- a/roles/redis_stack/tasks/install.yaml +++ b/roles/redis_stack/tasks/install.yaml @@ -66,16 +66,14 @@ wait: true timeout: "10m0s" values: - # Overrides go under the subchart name (redis-stack-server), not "redis". - redis-stack-server: - redis_stack_server: - storage_class: "{{ redis_stack_storage_class }}" - storage: "{{ redis_stack_persistence_size }}" - auth: - enabled: "{{ redis_stack_auth_enabled | bool }}" - password: "{{ _redis_pw }}" - networkPolicy: - meshPort: 15008 # Istio ambient HBONE + persistence: + storageClassName: "{{ redis_stack_storage_class }}" + size: "{{ redis_stack_persistence_size }}" + auth: + enabled: "{{ redis_stack_auth_enabled | bool }}" + password: "{{ _redis_pw }}" + networkPolicy: + meshPort: 15008 # Istio ambient HBONE register: _redis_helm no_log: true ignore_errors: true @@ -92,8 +90,7 @@ kind: Pod namespace: "{{ redis_stack_namespace }}" label_selectors: - # The vendored redis-stack-server chart labels pods `app: redis-stack-server` - # (not the standard app.kubernetes.io/instance). + # The chart's StatefulSet selector is `app: redis-stack-server` (kept for in-place upgrades). - app=redis-stack-server register: _redis_pods until: