-
Notifications
You must be signed in to change notification settings - Fork 266
Milestone
Description
Currently, WoT validation configuration in Ditto is static and can only be modified through configuration files or ConfigMaps. This makes it challenging to handle model migrations and deployment transitions where temporary validation relaxation might be needed.
Proposed Solution:
Add a new DevOps REST API that provides CRUD operations for WoT validation settings, using Ditto's existing caching infrastructure and MongoDB for persistence.
Technical Details:
-
Storage Layer:
- MongoDB for persistent storage using pekko persistence
- Caffeine cache for in-memory caching
- Ditto's pub/sub system for cluster-wide cache invalidation
-
Startup Process:
- On service startup, load static configuration from
things.conf - Initialize Caffeine cache with static configuration
- Subscribe to pub/sub topic for dynamic updates
- Load dynamic configurations from MongoDB
- Merge static and dynamic configurations
- Cache the merged result
- On service startup, load static configuration from
-
Cache Invalidation Flow:
- When config is updated via API:
- Update MongoDB
- Update local cache
- Publish update event via pub/sub
- Other instances receive event and update their caches
- On instance startup:
- Load static config
- Load dynamic configs from MongoDB
- Subscribe to pub/sub updates
- Cache merged configuration
- When config is updated via API:
-
API Endpoints:
GET /api/2/devops/wot/validationConfigs GET /api/2/devops/wot/validationConfigs/{scopeId} PUT /api/2/devops/wot/validationConfigs/{scopeId} PATCH /api/2/devops/wot/validationConfigs/{scopeId} DELETE /api/2/devops/wot/validationConfigs/{scopeId} GET /api/2/devops/wot/validationConfigs/merged -
Configuration Structure:
{ "validation-context": { "ditto-headers-patterns": [ { "header-name": "pattern" } ], "thing-definition-patterns": [ "pattern" ], "feature-definition-patterns": [ "pattern" ] }, "config-overrides": { "enabled": true, "log-warning-instead-of-failing-api-calls": false, "thing": { "enforce": { }, "forbid": { } }, "feature": { "enforce": { }, "forbid": { } } } }
Benefits:
- Real-time configuration updates across all Ditto instances
- Temporary validation relaxation for migrations
- No service restart required
- Built-in persistence and caching
- Automatic cache synchronization on startup and updates
Reactions are currently unavailable