Skip to content

Commit 170fb74

Browse files
authored
Merge pull request #120 from agntcy/119-fix-configure-slim-w-spire-and-controller
fix(tourist_scheduling_system): Configure SLIM with SPIRE and Controller
2 parents a17f26b + 956b34a commit 170fb74

File tree

16 files changed

+503
-518
lines changed

16 files changed

+503
-518
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,4 @@ tourist_scheduling_system/__pycache__/
204204
tourist_scheduling_system/.pytest_cache/
205205
tourist_scheduling_system/.DS_Store
206206
tourist_scheduling_system/.agent_pids
207+
tourist_scheduling_system/docs/issues.md

tourist_scheduling_system/README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ tourist_scheduling_system/
9696
│ ├── slim-controller.sh # SLIM controller deployment
9797
│ ├── slim-node.sh # SLIM data plane node deployment
9898
│ ├── directory.sh # Agent Directory deployment
99-
│ └── run_adk_demo.py # Main demo runner (Python CLI)
99+
│ ├── run_adk_demo.py # Main demo runner (Python CLI)
100+
│ ├── slim-control-csid.yaml.tpl # SPIRE ID template for Controller
101+
│ ├── slim-node-csid.yaml.tpl # SPIRE ID template for Node
102+
│ └── *-values.yaml # Helm values files
100103
├── deploy/
101104
│ └── k8s/ # Kubernetes manifests
102105
│ ├── namespace.yaml # Namespace and ConfigMap
@@ -214,14 +217,24 @@ kubectl create secret generic azure-openai-credentials \
214217

215218
### SLIM Infrastructure Setup
216219

217-
For SLIM transport with mTLS authentication:
220+
For SLIM transport with mTLS authentication (via SPIRE):
218221

219222
```bash
220223
# Install SPIRE (identity provider)
221224
./scripts/spire.sh install
222225
223-
# Install SLIM controller and node
226+
# Install SLIM controller (with SPIRE enabled)
227+
export SPIRE_ENABLED=true
224228
./scripts/slim-controller.sh install
229+
230+
# Install SLIM node (with SPIRE enabled)
231+
# Default strategy is StatefulSet
232+
export SPIRE_ENABLED=true
233+
./scripts/slim-node.sh install
234+
235+
# Or install SLIM node as DaemonSet
236+
export SLIM_STRATEGY=daemonset
237+
export SPIRE_ENABLED=true
225238
./scripts/slim-node.sh install
226239
227240
# Install Agent Directory (optional)

tourist_scheduling_system/deploy/k8s/deploy.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export NAMESPACE="${NAMESPACE:-lumuscar-jobs}"
2020
export IMAGE_REGISTRY="${IMAGE_REGISTRY:-ghcr.io/agntcy/apps}"
2121
export IMAGE_TAG="${IMAGE_TAG:-latest}"
2222
export TRANSPORT_MODE="${TRANSPORT_MODE:-http}"
23-
export MODEL_PROVIDER="${MODEL_PROVIDER:-}"
23+
export MODEL_PROVIDER="${MODEL_PROVIDER:-azure}"
2424
export MODEL_NAME="${MODEL_NAME:-}"
25-
export SLIM_GATEWAY_HOST="${SLIM_GATEWAY_HOST:-slim-slim-node}"
25+
export SLIM_GATEWAY_HOST="${SLIM_GATEWAY_HOST:-slim-node}"
2626
export SLIM_GATEWAY_PORT="${SLIM_GATEWAY_PORT:-46357}"
2727
export SCHEDULER_URL="${SCHEDULER_URL:-http://scheduler-agent:10000}"
2828
export UI_DASHBOARD_URL="${UI_DASHBOARD_URL:-http://ui-dashboard-agent:80/api/update}"
@@ -32,7 +32,7 @@ export HTTP_PROXY="${HTTP_PROXY:-}"
3232
export HTTPS_PROXY="${HTTPS_PROXY:-}"
3333

3434
# Ensure NO_PROXY includes necessary internal services
35-
DEFAULT_NO_PROXY="localhost,127.0.0.1,.cluster.local,slim-slim-node,scheduler-agent,ui-dashboard-agent"
35+
DEFAULT_NO_PROXY="localhost,127.0.0.1,.cluster.local,slim-node,scheduler-agent,ui-dashboard-agent"
3636
if [[ -n "${NO_PROXY:-}" ]]; then
3737
# Avoid leading comma if NO_PROXY is set
3838
export NO_PROXY="${NO_PROXY},${DEFAULT_NO_PROXY}"
@@ -94,6 +94,10 @@ ensure_google_secret() {
9494
# Create or update the azure-openai-credentials secret from environment variables
9595
ensure_azure_secret() {
9696
if [[ -z "${AZURE_OPENAI_API_KEY:-}" ]]; then
97+
if kubectl get secret azure-openai-credentials -n "$NAMESPACE" &>/dev/null; then
98+
log_info "Using existing azure-openai-credentials secret..."
99+
return 0
100+
fi
97101
if [[ "$MODEL_PROVIDER" == "google" ]]; then
98102
return 0
99103
fi
@@ -185,11 +189,11 @@ deploy_slim() {
185189

186190
# Set transport mode to SLIM
187191
export TRANSPORT_MODE=slim
188-
export SLIM_GATEWAY_HOST="${SLIM_GATEWAY_HOST:-slim-slim-node}"
192+
export SLIM_GATEWAY_HOST="${SLIM_GATEWAY_HOST:-slim-node}"
189193
export SLIM_GATEWAY_PORT="${SLIM_GATEWAY_PORT:-46357}"
190194
# For SLIM mode, agents communicate via gateway, not direct HTTP
191195
export SCHEDULER_URL="http://scheduler-agent:10000"
192-
export UI_DASHBOARD_URL="http://ui-dashboard-agent:10021"
196+
export UI_DASHBOARD_URL="http://ui-dashboard-agent:80/api/update"
193197

194198
# Verify namespace exists
195199
if ! kubectl get namespace "$NAMESPACE" &>/dev/null; then

tourist_scheduling_system/deploy/k8s/ui-agent.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ spec:
4747
- name: ui-dashboard-agent
4848
image: ${IMAGE_REGISTRY}/ui-agent:${IMAGE_TAG}
4949
imagePullPolicy: Always
50+
command: ["/bin/sh", "-c"]
51+
args:
52+
- |
53+
python main.py \
54+
--host 0.0.0.0 \
55+
--port 10021 \
56+
--dashboard \
57+
--transport "${TRANSPORT_MODE:-http}" \
58+
--slim-endpoint "http://${SLIM_GATEWAY_HOST}:${SLIM_GATEWAY_PORT}"
5059
ports:
5160
- containerPort: 10021
5261
protocol: TCP

tourist_scheduling_system/docs/SLIM.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,30 +103,31 @@ Two deployment scripts are provided in `scripts/`:
103103
#### SLIM Node (`scripts/slim-node.sh`)
104104

105105
```bash
106-
# Install a SLIM node
107-
./scripts/slim-node.sh install slim-node
106+
# Install a SLIM node (StatefulSet by default)
107+
./scripts/slim-node.sh install
108+
109+
# Install as DaemonSet
110+
SLIM_STRATEGY=daemonset ./scripts/slim-node.sh install
108111

109112
# Check status
110-
./scripts/slim-node.sh status slim-node
113+
./scripts/slim-node.sh status
111114

112115
# View logs
113-
./scripts/slim-node.sh logs slim-node
114-
115-
# List all nodes
116-
./scripts/slim-node.sh list
116+
./scripts/slim-node.sh logs
117117

118118
# Uninstall
119-
./scripts/slim-node.sh uninstall slim-node
119+
./scripts/slim-node.sh uninstall
120120

121-
# Force clean
122-
./scripts/slim-node.sh force-clean slim-node
121+
# Clean
122+
./scripts/slim-node.sh clean
123123
```
124124

125125
### Environment Variables
126126

127127
| Variable | Default | Description |
128128
|------------------------|---------------------------------------------------|--------------------------------|
129129
| `SLIM_NAMESPACE` | `lumuscar-jobs` | Target Kubernetes namespace |
130+
| `SLIM_STRATEGY` | `statefulset` | Deployment strategy (statefulset/daemonset) |
130131
| `SLIM_CONTROLLER_HOST` | `slim-control` | Controller service hostname |
131132
| `SLIM_CONTROLLER_PORT` | `50052` | Controller south API port |
132133
| `SPIRE_ENABLED` | `false` | Enable SPIRE mTLS mode |
@@ -141,13 +142,12 @@ To deploy SLIM with SPIRE mTLS:
141142
# 1. Install SPIRE first
142143
./scripts/spire.sh install
143144

144-
# 2. Register SLIM workloads with SPIRE
145-
./scripts/spire.sh register-slim
146-
147-
# 3. Install SLIM Controller with SPIRE
145+
# 2. Install SLIM Controller with SPIRE
146+
# This automatically applies the ClusterSPIFFEID
148147
SPIRE_ENABLED=true ./scripts/slim-controller.sh install
149148

150-
# 4. Install SLIM Node with SPIRE
149+
# 3. Install SLIM Node with SPIRE
150+
# This automatically applies the ClusterSPIFFEID
151151
SPIRE_ENABLED=true ./scripts/slim-node.sh install
152152
```
153153

0 commit comments

Comments
 (0)