Skip to content

Commit 474d4be

Browse files
[Metro][Traffic Agent] Helmchart for Smart Traffic Agent (#1950)
1 parent 0ff6331 commit 474d4be

File tree

14 files changed

+1171
-1
lines changed

14 files changed

+1171
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Patterns to ignore when building packages.
2+
.DS_Store
3+
*.swp
4+
*.bak
5+
*.tmp
6+
*.orig
7+
*~
8+
.git
9+
.gitignore
10+
.project
11+
.idea/
12+
*.tmproj
13+
.vscode/
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: v2
5+
name: smart-traffic-intersection-agent
6+
description: A Helm chart for deploying the Smart Traffic Intersection Agent application
7+
type: application
8+
version: 1.0.0
9+
appVersion: "1.0.0"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{/*
2+
Copyright (C) 2025 Intel Corporation
3+
SPDX-License-Identifier: Apache-2.0
4+
5+
Smart Traffic Intersection Agent — Helm chart post-install notes
6+
*/}}
7+
8+
1. Smart Traffic Intersection Agent has been deployed.
9+
10+
Instance : {{ .Values.trafficAgent.intersection.name }}
11+
Namespace: {{ .Release.Namespace }}
12+
13+
2. Get the traffic-agent backend URL:
14+
{{- if contains "NodePort" .Values.trafficAgent.service.type }}
15+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[?(@.name=='backend')].nodePort}" services {{ include "stia.trafficAgent.fullname" . }})
16+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
17+
echo "Backend: http://$NODE_IP:$NODE_PORT"
18+
{{- else if contains "ClusterIP" .Values.trafficAgent.service.type }}
19+
kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ include "stia.trafficAgent.fullname" . }} 8081:{{ .Values.trafficAgent.service.backendPort }} &
20+
echo "Backend: http://127.0.0.1:8081"
21+
{{- end }}
22+
23+
3. Get the traffic-agent UI URL:
24+
{{- if contains "NodePort" .Values.trafficAgent.service.type }}
25+
export UI_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[?(@.name=='ui')].nodePort}" services {{ include "stia.trafficAgent.fullname" . }})
26+
echo "UI: http://$NODE_IP:$UI_PORT"
27+
{{- else if contains "ClusterIP" .Values.trafficAgent.service.type }}
28+
kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ include "stia.trafficAgent.fullname" . }} 7860:{{ .Values.trafficAgent.service.uiPort }} &
29+
echo "UI: http://127.0.0.1:7860"
30+
{{- end }}
31+
32+
4. The VLM serving endpoint is available internally at:
33+
http://{{ include "stia.vlmServing.fullname" . }}:{{ .Values.vlmServing.service.port }}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{{/*
2+
Copyright (C) 2025 Intel Corporation
3+
SPDX-License-Identifier: Apache-2.0
4+
*/}}
5+
6+
{{/*
7+
Expand the name of the chart.
8+
*/}}
9+
{{- define "stia.name" -}}
10+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
11+
{{- end }}
12+
13+
{{/*
14+
Create a default fully qualified app name.
15+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
16+
If release name contains chart name it will be used as a full name.
17+
*/}}
18+
{{- define "stia.fullname" -}}
19+
{{- if .Values.fullnameOverride }}
20+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
21+
{{- else }}
22+
{{- $name := default .Chart.Name .Values.nameOverride }}
23+
{{- if contains $name .Release.Name }}
24+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
25+
{{- else }}
26+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
27+
{{- end }}
28+
{{- end }}
29+
{{- end }}
30+
31+
{{/*
32+
Create chart name and version as used by the chart label.
33+
*/}}
34+
{{- define "stia.chart" -}}
35+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
36+
{{- end }}
37+
38+
{{/*
39+
Common labels
40+
*/}}
41+
{{- define "stia.labels" -}}
42+
helm.sh/chart: {{ include "stia.chart" . }}
43+
{{ include "stia.selectorLabels" . }}
44+
{{- if .Chart.AppVersion }}
45+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
46+
{{- end }}
47+
app.kubernetes.io/managed-by: {{ .Release.Service }}
48+
{{- end }}
49+
50+
{{/*
51+
Selector labels
52+
*/}}
53+
{{- define "stia.selectorLabels" -}}
54+
app.kubernetes.io/name: {{ include "stia.name" . }}
55+
app.kubernetes.io/instance: {{ .Release.Name }}
56+
{{- end }}
57+
58+
{{/*
59+
Define the fully qualified name for the traffic-agent.
60+
*/}}
61+
{{- define "stia.trafficAgent.fullname" -}}
62+
{{ .Release.Name | trunc 57 | trimSuffix "-" }}-{{ .Values.trafficAgent.name }}
63+
{{- end }}
64+
65+
{{/*
66+
Define the fully qualified name for the VLM serving.
67+
*/}}
68+
{{- define "stia.vlmServing.fullname" -}}
69+
{{ .Release.Name | trunc 57 | trimSuffix "-" }}-{{ .Values.vlmServing.name }}
70+
{{- end }}
71+
72+
{{/*
73+
Define the name of the CA cert secret.
74+
*/}}
75+
{{- define "stia.caCertSecretName" -}}
76+
{{- if .Values.tls.caCertSecretName }}
77+
{{- .Values.tls.caCertSecretName }}
78+
{{- else }}
79+
{{- include "stia.fullname" . }}-ca-cert
80+
{{- end }}
81+
{{- end }}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{{/*
2+
Copyright (C) 2025 Intel Corporation
3+
SPDX-License-Identifier: Apache-2.0
4+
*/}}
5+
{{- if .Values.vlmServing.persistence.enabled }}
6+
apiVersion: v1
7+
kind: PersistentVolumeClaim
8+
metadata:
9+
name: {{ include "stia.vlmServing.fullname" . }}-models
10+
labels:
11+
{{- include "stia.labels" . | nindent 4 }}
12+
app.kubernetes.io/component: vlm-serving
13+
{{- if .Values.vlmServing.persistence.keepOnUninstall }}
14+
annotations:
15+
"helm.sh/resource-policy": keep
16+
{{- end }}
17+
spec:
18+
accessModes:
19+
- ReadWriteOnce
20+
resources:
21+
requests:
22+
storage: {{ .Values.vlmServing.persistence.size }}
23+
{{- if .Values.vlmServing.persistence.storageClass }}
24+
storageClassName: {{ .Values.vlmServing.persistence.storageClass }}
25+
{{- end }}
26+
{{- end }}
27+
{{- if .Values.trafficAgent.persistence.enabled }}
28+
---
29+
apiVersion: v1
30+
kind: PersistentVolumeClaim
31+
metadata:
32+
name: {{ include "stia.trafficAgent.fullname" . }}-data
33+
labels:
34+
{{- include "stia.labels" . | nindent 4 }}
35+
app.kubernetes.io/component: traffic-agent
36+
spec:
37+
accessModes:
38+
- ReadWriteOnce
39+
resources:
40+
requests:
41+
storage: {{ .Values.trafficAgent.persistence.size }}
42+
{{- if .Values.trafficAgent.persistence.storageClass }}
43+
storageClassName: {{ .Values.trafficAgent.persistence.storageClass }}
44+
{{- end }}
45+
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{/*
2+
Copyright (C) 2025 Intel Corporation
3+
SPDX-License-Identifier: Apache-2.0
4+
*/}}
5+
{{- if and .Values.tls.caCert (not .Values.tls.caCertSecretName) }}
6+
apiVersion: v1
7+
kind: Secret
8+
metadata:
9+
name: {{ include "stia.fullname" . }}-ca-cert
10+
labels:
11+
{{- include "stia.labels" . | nindent 4 }}
12+
type: Opaque
13+
data:
14+
scenescape-ca.pem: {{ .Values.tls.caCert | b64enc | quote }}
15+
{{- end }}
16+
{{- if .Values.vlmServing.huggingfaceToken }}
17+
---
18+
apiVersion: v1
19+
kind: Secret
20+
metadata:
21+
name: {{ include "stia.fullname" . }}-hf-token
22+
labels:
23+
{{- include "stia.labels" . | nindent 4 }}
24+
type: Opaque
25+
data:
26+
token: {{ .Values.vlmServing.huggingfaceToken | b64enc | quote }}
27+
{{- end }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{/*
2+
Copyright (C) 2025 Intel Corporation
3+
SPDX-License-Identifier: Apache-2.0
4+
*/}}
5+
apiVersion: v1
6+
kind: ConfigMap
7+
metadata:
8+
name: {{ include "stia.trafficAgent.fullname" . }}-config
9+
labels:
10+
{{- include "stia.labels" . | nindent 4 }}
11+
app.kubernetes.io/component: traffic-agent
12+
data:
13+
traffic_agent.json: |
14+
{
15+
"mqtt": {
16+
"host": {{ .Values.trafficAgent.mqtt.host | quote }},
17+
"port": {{ .Values.trafficAgent.mqtt.port }},
18+
"use_tls": true,
19+
"cert_required": false,
20+
"verify_hostname": false,
21+
"ca_cert_path": "secrets/certs/scenescape-ca.pem",
22+
"camera_topics": [
23+
"scenescape/data/camera/camera1",
24+
"scenescape/data/camera/camera2",
25+
"scenescape/data/camera/camera3",
26+
"scenescape/data/camera/camera4"
27+
],
28+
"image_topics": [
29+
"scenescape/image/camera/camera1",
30+
"scenescape/image/camera/camera2",
31+
"scenescape/image/camera/camera3",
32+
"scenescape/image/camera/camera4"
33+
],
34+
"rate_limit_seconds": 10.0
35+
},
36+
"weather": {
37+
"api_base_url": "https://api.weather.gov",
38+
"user_agent": "traffic-intelligence (admin@example.com)",
39+
"cache_duration_minutes": 11
40+
},
41+
"vlm": {
42+
"base_url": "http://{{ include "stia.vlmServing.fullname" . }}:{{ .Values.vlmServing.service.port }}",
43+
"model": {{ .Values.vlmServing.env.modelName | quote }},
44+
"timeout_seconds": {{ .Values.trafficAgent.env.vlmTimeoutSeconds | int }},
45+
"max_completion_tokens": {{ .Values.vlmServing.env.maxCompletionTokens | int }},
46+
"temperature": 0.1,
47+
"top_p": 0.1
48+
},
49+
"traffic": {
50+
"high_density_threshold": {{ .Values.trafficAgent.traffic.highDensityThreshold | int }},
51+
"analysis_window_seconds": 30
52+
}
53+
}
54+
deployment_instance.json: |
55+
{
56+
"name": {{ .Values.trafficAgent.intersection.name | quote }},
57+
"latitude": {{ .Values.trafficAgent.intersection.latitude }},
58+
"longitude": {{ .Values.trafficAgent.intersection.longitude }},
59+
"agent_backend_port": "",
60+
"agent_ui_port": ""
61+
}

0 commit comments

Comments
 (0)