Skip to content

Commit 96c1cc6

Browse files
authored
✨ Kubernetes Helm deployment directory reconstruction #2722
✨ Kubernetes Helm deployment directory reconstruction #2722
2 parents 617eb4a + ca0ba2c commit 96c1cc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1594
-1138
lines changed

k8s/helm/create-suadmin.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set -e
77

88
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
99
CHART_DIR="$SCRIPT_DIR/nexent"
10+
COMMON_VALUES="$CHART_DIR/charts/nexent-common/values.yaml"
1011
NAMESPACE="nexent"
1112
RELEASE_NAME="nexent"
1213

@@ -81,7 +82,7 @@ create_supabase_super_admin_user() {
8182
echo " 🔧 Creating super admin user..."
8283

8384
# Get API keys from values.yaml
84-
local anon_key=$(grep "anonKey:" "$CHART_DIR/values.yaml" | sed 's/.*anonKey: *//' | tr -d '"' | tr -d "'" | xargs)
85+
local anon_key=$(grep "anonKey:" "$COMMON_VALUES" | sed 's/.*anonKey: *//' | tr -d '"' | tr -d "'" | xargs)
8586
local postgres_pod="nexent-postgresql"
8687

8788
# Try to create user via Kong API

k8s/helm/deploy-helm.sh

Lines changed: 80 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ set -e
1313
# Use absolute path relative to the script location
1414
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1515
CHART_DIR="$SCRIPT_DIR/nexent"
16+
COMMON_VALUES="$CHART_DIR/charts/nexent-common/values.yaml"
1617
NAMESPACE="nexent"
1718
RELEASE_NAME="nexent"
1819

@@ -145,70 +146,76 @@ update_values_yaml() {
145146
echo "Using APP_VERSION: $APP_VERSION"
146147
echo ""
147148

148-
# Update backend image
149-
sed -i "/^ backend:/,/^ [a-z]/{s| repository:.*| repository: \"${NEXENT_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
150-
sed -i "/^ backend:/,/^ [a-z]/{s| tag:.*| tag: \"$APP_VERSION\"|}" "$CHART_DIR/values.yaml"
151-
152-
# Update web image
153-
sed -i "/^ web:/,/^ [a-z]/{s| repository:.*| repository: \"${NEXENT_WEB_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
154-
sed -i "/^ web:/,/^ [a-z]/{s| tag:.*| tag: \"$APP_VERSION\"|}" "$CHART_DIR/values.yaml"
155-
156-
# Update dataProcess image
157-
sed -i "/^ dataProcess:/,/^ [a-z]/{s| repository:.*| repository: \"${NEXENT_DATA_PROCESS_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
158-
sed -i "/^ dataProcess:/,/^ [a-z]/{s| tag:.*| tag: \"$APP_VERSION\"|}" "$CHART_DIR/values.yaml"
149+
# Define paths to each chart's values.yaml
150+
VAL_CONFIG="$CHART_DIR/charts/nexent-config/values.yaml"
151+
VAL_RUNTIME="$CHART_DIR/charts/nexent-runtime/values.yaml"
152+
VAL_MCP="$CHART_DIR/charts/nexent-mcp/values.yaml"
153+
VAL_NORTHBOUND="$CHART_DIR/charts/nexent-northbound/values.yaml"
154+
VAL_WEB="$CHART_DIR/charts/nexent-web/values.yaml"
155+
VAL_DATA_PROCESS="$CHART_DIR/charts/nexent-data-process/values.yaml"
156+
VAL_ELASTICSEARCH="$CHART_DIR/charts/nexent-elasticsearch/values.yaml"
157+
VAL_POSTGRESQL="$CHART_DIR/charts/nexent-postgresql/values.yaml"
158+
VAL_REDIS="$CHART_DIR/charts/nexent-redis/values.yaml"
159+
VAL_MINIO="$CHART_DIR/charts/nexent-minio/values.yaml"
160+
VAL_SUPABASE_KONG="$CHART_DIR/charts/nexent-supabase-kong/values.yaml"
161+
VAL_SUPABASE_AUTH="$CHART_DIR/charts/nexent-supabase-auth/values.yaml"
162+
VAL_SUPABASE_DB="$CHART_DIR/charts/nexent-supabase-db/values.yaml"
163+
VAL_OPENSSH="$CHART_DIR/charts/nexent-openssh/values.yaml"
164+
165+
166+
# Update backend image (nexent/nexent) for: config, runtime, mcp, northbound
167+
# Pattern: match from "images:" section to next top-level key
168+
for VAL_FILE in "$VAL_CONFIG" "$VAL_RUNTIME" "$VAL_MCP" "$VAL_NORTHBOUND"; do
169+
sed -i "s|repository:.*|repository: ${NEXENT_IMAGE%%:*}|" "$VAL_FILE"
170+
sed -i "s|tag:.*|tag: ${APP_VERSION}|" "$VAL_FILE"
171+
done
172+
173+
# Update web image (nexent-web)
174+
sed -i "s|repository:.*|repository: ${NEXENT_WEB_IMAGE%%:*}|" "$VAL_WEB"
175+
sed -i "s|tag:.*|tag: ${APP_VERSION}|" "$VAL_WEB"
176+
177+
# Update dataProcess image (nexent-data-process)
178+
sed -i "s|repository:.*|repository: ${NEXENT_DATA_PROCESS_IMAGE%%:*}|" "$VAL_DATA_PROCESS"
179+
sed -i "s|tag:.*|tag: ${APP_VERSION}|" "$VAL_DATA_PROCESS"
159180

160181
# Update mcp container image
161-
sed -i "/^ mcp:/,/^ [a-z]/{s| repository:.*| repository: \"${NEXENT_MCP_DOCKER_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
162-
sed -i "/^ mcp:/,/^ [a-z]/{s| tag:.*| tag: \"$APP_VERSION\"|}" "$CHART_DIR/values.yaml"
182+
sed -i "/^ mcp:/,/^ [a-z]/{s| repository:.*| repository: \"${NEXENT_MCP_DOCKER_IMAGE%%:*}\"|}" "$COMMON_VALUES"
183+
sed -i "/^ mcp:/,/^ [a-z]/{s| tag:.*| tag: \"$APP_VERSION\"|}" "$COMMON_VALUES"
163184

164185
# Update elasticsearch image
165-
sed -i "/^ elasticsearch:/,/^ [a-z]/{s| repository:.*| repository: \"${ELASTICSEARCH_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
166-
sed -i "/^ elasticsearch:/,/^ [a-z]/{s| tag:.*| tag: \"${ELASTICSEARCH_IMAGE##*:}\"|}" "$CHART_DIR/values.yaml"
186+
sed -i "s|repository:.*|repository: ${ELASTICSEARCH_IMAGE%%:*}|" "$VAL_ELASTICSEARCH"
187+
sed -i "s|tag:.*|tag: ${ELASTICSEARCH_IMAGE##*:}|" "$VAL_ELASTICSEARCH"
167188

168189
# Update postgresql image
169-
sed -i "/^ postgresql:/,/^ [a-z]/{s| repository:.*| repository: \"${POSTGRESQL_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
170-
sed -i "/^ postgresql:/,/^ [a-z]/{s| tag:.*| tag: \"${POSTGRESQL_IMAGE##*:}\"|}" "$CHART_DIR/values.yaml"
190+
sed -i "s|repository:.*|repository: ${POSTGRESQL_IMAGE%%:*}|" "$VAL_POSTGRESQL"
191+
sed -i "s|tag:.*|tag: ${POSTGRESQL_IMAGE##*:}|" "$VAL_POSTGRESQL"
171192

172193
# Update redis image
173-
sed -i "/^ redis:/,/^ [a-z]/{s| repository:.*| repository: \"${REDIS_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
174-
sed -i "/^ redis:/,/^ [a-z]/{s| tag:.*| tag: \"${REDIS_IMAGE##*:}\"|}" "$CHART_DIR/values.yaml"
194+
sed -i "s|repository:.*|repository: ${REDIS_IMAGE%%:*}|" "$VAL_REDIS"
195+
sed -i "s|tag:.*|tag: ${REDIS_IMAGE##*:}|" "$VAL_REDIS"
175196

176197
# Update minio image
177-
sed -i "/^ minio:/,/^ [a-z]/{s| repository:.*| repository: \"${MINIO_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
178-
sed -i "/^ minio:/,/^ [a-z]/{s| tag:.*| tag: \"${MINIO_IMAGE##*:}\"|}" "$CHART_DIR/values.yaml"
179-
180-
# Update Supabase images using grep to find exact line numbers
181-
# Only for full version
182-
if [ "$DEPLOYMENT_VERSION" = "full" ] && grep -q "^ supabase:" "$CHART_DIR/values.yaml"; then
183-
# Find line numbers for each field dynamically
184-
KONG_REPO_LINE=$(grep -n ' kong:' "$CHART_DIR/values.yaml" | head -1 | cut -d: -f1)
185-
KONG_REPO_LINE=$((KONG_REPO_LINE + 1))
186-
KONG_TAG_LINE=$((KONG_REPO_LINE + 1))
187-
188-
GOTRUE_REPO_LINE=$(grep -n ' gotrue:' "$CHART_DIR/values.yaml" | head -1 | cut -d: -f1)
189-
GOTRUE_REPO_LINE=$((GOTRUE_REPO_LINE + 1))
190-
GOTRUE_TAG_LINE=$((GOTRUE_REPO_LINE + 1))
191-
192-
POSTGRES_REPO_LINE=$(grep -n ' postgres:' "$CHART_DIR/values.yaml" | head -1 | cut -d: -f1)
193-
POSTGRES_REPO_LINE=$((POSTGRES_REPO_LINE + 1))
194-
POSTGRES_TAG_LINE=$((POSTGRES_REPO_LINE + 1))
195-
196-
# Update supabase.kong
197-
sed -i "${KONG_REPO_LINE}s|.*| repository: \"${SUPABASE_KONG%%:*}\"|" "$CHART_DIR/values.yaml"
198-
sed -i "${KONG_TAG_LINE}s|.*| tag: \"${SUPABASE_KONG##*:}\"|" "$CHART_DIR/values.yaml"
199-
200-
# Update supabase.gotrue
201-
sed -i "${GOTRUE_REPO_LINE}s|.*| repository: \"${SUPABASE_GOTRUE%%:*}\"|" "$CHART_DIR/values.yaml"
202-
sed -i "${GOTRUE_TAG_LINE}s|.*| tag: \"${SUPABASE_GOTRUE##*:}\"|" "$CHART_DIR/values.yaml"
203-
204-
# Update supabase.postgres
205-
sed -i "${POSTGRES_REPO_LINE}s|.*| repository: \"${SUPABASE_DB%%:*}\"|" "$CHART_DIR/values.yaml"
206-
sed -i "${POSTGRES_TAG_LINE}s|.*| tag: \"${SUPABASE_DB##*:}\"|" "$CHART_DIR/values.yaml"
198+
sed -i "s|repository:.*|repository: ${MINIO_IMAGE%%:*}|" "$VAL_MINIO"
199+
sed -i "s|tag:.*|tag: ${MINIO_IMAGE##*:}|" "$VAL_MINIO"
200+
201+
# Update Supabase images (only for full version)
202+
if [ "$DEPLOYMENT_VERSION" = "full" ]; then
203+
# Update supabase-kong image
204+
sed -i "s|repository:.*|repository: ${SUPABASE_KONG%%:*}|" "$VAL_SUPABASE_KONG"
205+
sed -i "s|tag:.*|tag: ${SUPABASE_KONG##*:}|" "$VAL_SUPABASE_KONG"
206+
207+
# Update supabase-auth (gotrue) image
208+
sed -i "s|repository:.*|repository: ${SUPABASE_GOTRUE%%:*}|" "$VAL_SUPABASE_AUTH"
209+
sed -i "s|tag:.*|tag: ${SUPABASE_GOTRUE##*:}|" "$VAL_SUPABASE_AUTH"
210+
211+
# Update supabase-db image
212+
sed -i "s|repository:.*|repository: ${SUPABASE_DB%%:*}|" "$VAL_SUPABASE_DB"
213+
sed -i "s|tag:.*|tag: ${SUPABASE_DB##*:}|" "$VAL_SUPABASE_DB"
207214
fi
208215

209216
# Update openssh image
210-
sed -i "/^ openssh:/{s| repository:.*| repository: \"${OPENSSH_SERVER_IMAGE%%:*}\"|}" "$CHART_DIR/values.yaml"
211-
sed -i "/^ openssh:/{s| tag:.*| tag: \"$APP_VERSION\"|}" "$CHART_DIR/values.yaml"
217+
sed -i "s|repository:.*|repository: ${OPENSSH_SERVER_IMAGE%%:*}|" "$VAL_OPENSSH"
218+
sed -i "s|tag:.*|tag: ${APP_VERSION}|" "$VAL_OPENSSH"
212219

213220
echo "Image tags updated in values.yaml"
214221
echo ""
@@ -312,28 +319,28 @@ generate_supabase_secrets() {
312319
echo "Updating Supabase secrets in values.yaml..."
313320

314321
# Update secrets.supabase.jwtSecret
315-
if grep -q "jwtSecret:" "$CHART_DIR/values.yaml"; then
316-
sed -i "s|jwtSecret:.*|jwtSecret: \"$JWT_SECRET\"|" "$CHART_DIR/values.yaml"
322+
if grep -q "jwtSecret:" "$COMMON_VALUES"; then
323+
sed -i "s|jwtSecret:.*|jwtSecret: \"$JWT_SECRET\"|" "$COMMON_VALUES"
317324
fi
318325

319326
# Update secrets.supabase.secretKeyBase
320-
if grep -q "secretKeyBase:" "$CHART_DIR/values.yaml"; then
321-
sed -i "s|secretKeyBase:.*|secretKeyBase: \"$SECRET_KEY_BASE\"|" "$CHART_DIR/values.yaml"
327+
if grep -q "secretKeyBase:" "$COMMON_VALUES"; then
328+
sed -i "s|secretKeyBase:.*|secretKeyBase: \"$SECRET_KEY_BASE\"|" "$COMMON_VALUES"
322329
fi
323330

324331
# Update secrets.supabase.vaultEncKey
325-
if grep -q "vaultEncKey:" "$CHART_DIR/values.yaml"; then
326-
sed -i "s|vaultEncKey:.*|vaultEncKey: \"$VAULT_ENC_KEY\"|" "$CHART_DIR/values.yaml"
332+
if grep -q "vaultEncKey:" "$COMMON_VALUES"; then
333+
sed -i "s|vaultEncKey:.*|vaultEncKey: \"$VAULT_ENC_KEY\"|" "$COMMON_VALUES"
327334
fi
328335

329336
# Update secrets.supabase.anonKey
330-
if grep -q "anonKey:" "$CHART_DIR/values.yaml"; then
331-
sed -i "s|anonKey:.*|anonKey: \"$anon_key\"|" "$CHART_DIR/values.yaml"
337+
if grep -q "anonKey:" "$COMMON_VALUES"; then
338+
sed -i "s|anonKey:.*|anonKey: \"$anon_key\"|" "$COMMON_VALUES"
332339
fi
333340

334341
# Update secrets.supabase.serviceRoleKey
335-
if grep -q "serviceRoleKey:" "$CHART_DIR/values.yaml"; then
336-
sed -i "s|serviceRoleKey:.*|serviceRoleKey: \"$service_role_key\"|" "$CHART_DIR/values.yaml"
342+
if grep -q "serviceRoleKey:" "$COMMON_VALUES"; then
343+
sed -i "s|serviceRoleKey:.*|serviceRoleKey: \"$service_role_key\"|" "$COMMON_VALUES"
337344
fi
338345

339346
echo "Supabase secrets generated and saved to values.yaml"
@@ -395,9 +402,9 @@ apply() {
395402
echo "=========================================="
396403
echo " MinIO Access Key/Secret Key Setup"
397404
echo "=========================================="
398-
if grep -q "minio:" "$CHART_DIR/values.yaml" && grep -q "accessKey:" "$CHART_DIR/values.yaml"; then
399-
MINIO_ACCESS_KEY=$(grep "accessKey:" "$CHART_DIR/values.yaml" | head -1 | sed 's/.*accessKey: *//' | tr -d '"' | tr -d "'" | xargs)
400-
MINIO_SECRET_KEY=$(grep "secretKey:" "$CHART_DIR/values.yaml" | head -1 | sed 's/.*secretKey: *//' | tr -d '"' | tr -d "'" | xargs)
405+
if grep -q "minio:" "$COMMON_VALUES" && grep -q "accessKey:" "$COMMON_VALUES"; then
406+
MINIO_ACCESS_KEY=$(grep "accessKey:" "$COMMON_VALUES" | head -1 | sed 's/.*accessKey: *//' | tr -d '"' | tr -d "'" | xargs)
407+
MINIO_SECRET_KEY=$(grep "secretKey:" "$COMMON_VALUES" | head -1 | sed 's/.*secretKey: *//' | tr -d '"' | tr -d "'" | xargs)
401408
fi
402409

403410
if [ -z "$MINIO_ACCESS_KEY" ] || [ "$MINIO_ACCESS_KEY" = "" ]; then
@@ -406,16 +413,16 @@ apply() {
406413
MINIO_SECRET_KEY=$(head -c 32 /dev/urandom | base64 | tr -dc 'A-Za-z0-9' | head -c 24)
407414

408415
# Write to values.yaml
409-
if grep -q "accessKey:" "$CHART_DIR/values.yaml"; then
410-
sed -i "s|accessKey:.*|accessKey: \"$MINIO_ACCESS_KEY\"|" "$CHART_DIR/values.yaml"
416+
if grep -q "accessKey:" "$COMMON_VALUES"; then
417+
sed -i "s|accessKey:.*|accessKey: \"$MINIO_ACCESS_KEY\"|" "$COMMON_VALUES"
411418
else
412-
sed -i "/minio:/a\\ accessKey: \"$MINIO_ACCESS_KEY\"" "$CHART_DIR/values.yaml"
419+
sed -i "/minio:/a\\ accessKey: \"$MINIO_ACCESS_KEY\"" "$COMMON_VALUES"
413420
fi
414421

415-
if grep -q "secretKey:" "$CHART_DIR/values.yaml"; then
416-
sed -i "s|secretKey:.*|secretKey: \"$MINIO_SECRET_KEY\"|" "$CHART_DIR/values.yaml"
422+
if grep -q "secretKey:" "$COMMON_VALUES"; then
423+
sed -i "s|secretKey:.*|secretKey: \"$MINIO_SECRET_KEY\"|" "$COMMON_VALUES"
417424
else
418-
sed -i "/minio:/a\\ secretKey: \"$MINIO_SECRET_KEY\"" "$CHART_DIR/values.yaml"
425+
sed -i "/minio:/a\\ secretKey: \"$MINIO_SECRET_KEY\"" "$COMMON_VALUES"
419426
fi
420427
echo "MinIO credentials generated and saved to values.yaml"
421428
echo "Access Key: $MINIO_ACCESS_KEY"
@@ -482,9 +489,9 @@ apply() {
482489
helm upgrade --install nexent "$CHART_DIR" \
483490
--namespace "$NAMESPACE" \
484491
--create-namespace \
485-
--set services.openssh.enabled="$ENABLE_OPENSSH" \
486-
--set secrets.ssh.username="$SSH_USERNAME" \
487-
--set secrets.ssh.password="$SSH_PASSWORD"
492+
--set nexent-openssh.enabled="$ENABLE_OPENSSH" \
493+
--set nexent-common.secrets.ssh.username="$SSH_USERNAME" \
494+
--set nexent-common.secrets.ssh.password="$SSH_PASSWORD"
488495

489496
# Step 9: Wait for Elasticsearch to be ready and initialize API key
490497
echo ""

k8s/helm/nexent/Chart.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,57 @@ keywords:
1010
- agent
1111
maintainers:
1212
- name: Nexent Team
13+
14+
dependencies:
15+
# Common resources (ConfigMap, Secret, RBAC, Namespace)
16+
- name: nexent-common
17+
version: 0.1.0
18+
repository: "file://./charts/nexent-common"
19+
20+
# Infrastructure services
21+
- name: nexent-elasticsearch
22+
version: 0.1.0
23+
repository: "file://./charts/nexent-elasticsearch"
24+
- name: nexent-postgresql
25+
version: 0.1.0
26+
repository: "file://./charts/nexent-postgresql"
27+
- name: nexent-redis
28+
version: 0.1.0
29+
repository: "file://./charts/nexent-redis"
30+
- name: nexent-minio
31+
version: 0.1.0
32+
repository: "file://./charts/nexent-minio"
33+
34+
# Supabase services (only deployed when global.deploymentVersion == "full")
35+
- name: nexent-supabase-kong
36+
version: 0.1.0
37+
repository: "file://./charts/nexent-supabase-kong"
38+
- name: nexent-supabase-auth
39+
version: 0.1.0
40+
repository: "file://./charts/nexent-supabase-auth"
41+
- name: nexent-supabase-db
42+
version: 0.1.0
43+
repository: "file://./charts/nexent-supabase-db"
44+
45+
# Application services
46+
- name: nexent-config
47+
version: 0.1.0
48+
repository: "file://./charts/nexent-config"
49+
- name: nexent-mcp
50+
version: 0.1.0
51+
repository: "file://./charts/nexent-mcp"
52+
- name: nexent-runtime
53+
version: 0.1.0
54+
repository: "file://./charts/nexent-runtime"
55+
- name: nexent-data-process
56+
version: 0.1.0
57+
repository: "file://./charts/nexent-data-process"
58+
- name: nexent-northbound
59+
version: 0.1.0
60+
repository: "file://./charts/nexent-northbound"
61+
- name: nexent-web
62+
version: 0.1.0
63+
repository: "file://./charts/nexent-web"
64+
- name: nexent-openssh
65+
version: 0.1.0
66+
repository: "file://./charts/nexent-openssh"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v2
2+
name: nexent-common
3+
description: Nexent Common - Shared resources including ConfigMap, Secret, RBAC, PVC, and Namespace
4+
type: application
5+
version: 0.1.0
6+
appVersion: "latest"
7+
keywords:
8+
- nexent
9+
- common
10+
- shared
11+
maintainers:
12+
- name: Nexent Team

k8s/helm/nexent/files/init.sql renamed to k8s/helm/nexent/charts/nexent-common/files/init.sql

File renamed without changes.

k8s/helm/nexent/templates/configmap.yaml renamed to k8s/helm/nexent/charts/nexent-common/templates/configmap.yaml

File renamed without changes.

k8s/helm/nexent/templates/init-sql-configmap.yaml renamed to k8s/helm/nexent/charts/nexent-common/templates/init-sql-configmap.yaml

File renamed without changes.

k8s/helm/nexent/templates/namespace.yaml renamed to k8s/helm/nexent/charts/nexent-common/templates/namespace.yaml

File renamed without changes.
File renamed without changes.

k8s/helm/nexent/templates/secrets.yaml renamed to k8s/helm/nexent/charts/nexent-common/templates/secrets.yaml

File renamed without changes.

0 commit comments

Comments
 (0)