Platform services for managing external resources (Kubernetes, etc.) in MindWeaver.
Platform services manage external resources (like Kubernetes deployments).
Define the Platform Model: Inherit from PlatformBase.
from mindweaver.platform_service.base import PlatformBase
class MyPlatform(PlatformBase, table=True):
__tablename__ = "my_platform"
# ... fields
Define the State Model: Inherit from PlatformStateBase.
from mindweaver.platform_service.base import PlatformStateBase
class MyPlatformState(PlatformStateBase, table=True):
__tablename__ = "my_platform_state"
# ... status fields
Define the Service: Inherit from PlatformService.
from mindweaver.platform_service.base import PlatformService
class MyPlatformService(PlatformService[MyPlatform]):
template_directory: str = "/path/to/templates"
state_model: type[MyPlatformState] = MyPlatformState
@classmethod
def model_class(cls):
return MyPlatform
async def poll_status(self, model: MyPlatform):
# Implement logic to check status and update state
pass
Create Templates: Add Jinja2/YAML templates for Kubernetes manifests in the template_directory.
Register the Router: As with standard services, register the router in app.py. The PlatformService adds _deploy, _decommission, _state, and _refresh endpoints.