MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
Service Discovery

Service Discovery

The ServiceController manages data plane service deployments within tenant namespaces. It handles service deployment, scaling (both horizontal and vertical), health checking, and service endpoint discovery across the platform.


Service Deployment

Deploy a Service

Endpoint: POST /api/v1/infrastructure/services/tenants/:tenantId/deploy

curl -X POST http://localhost:8089/api/v1/infrastructure/services/tenants/550e8400/deploy \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${TOKEN}" \
  -d '{
    "serviceName": "ai-service",
    "version": "1.2.0",
    "replicas": 2,
    "resources": {
      "cpuRequest": "500m",
      "cpuLimit": "2000m",
      "memoryRequest": "1Gi",
      "memoryLimit": "4Gi"
    }
  }'

List Tenant Services

Endpoint: GET /api/v1/infrastructure/services/tenants/:tenantId

Returns all deployed services for a tenant with their status, version, and endpoint information.

Get Service Status

Endpoint: GET /api/v1/infrastructure/services/tenants/:tenantId/:serviceName


Scaling

Scale a Service

Endpoint: POST /api/v1/infrastructure/services/tenants/:tenantId/:serviceName/scale

curl -X POST http://localhost:8089/api/v1/infrastructure/services/tenants/550e8400/ai-service/scale \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${TOKEN}" \
  -d '{
    "replicas": 4
  }'

Horizontal Pod Autoscaler (HPA)

The HorizontalPodAutoscalerManager manages Kubernetes HPA resources for automatic horizontal scaling based on CPU, memory, or custom metrics.

Vertical Pod Autoscaler (VPA)

The VerticalPodAutoscalerManager manages Kubernetes VPA resources for automatic resource right-sizing.


TenantService Entity

FieldTypeDescription
idUUIDService record ID
tenantIdUUIDOwning tenant
serviceNameStringService identifier
versionStringDeployed version
replicasintDesired replica count
statusStringDEPLOYING, RUNNING, DEGRADED, STOPPED
endpointStringInternal service endpoint
healthStatusStringLast health check result
configurationJSONService-specific configuration

Health Checking

The HealthCheckService periodically probes deployed services:

Check TypeDescription
HTTP healthGET request to /health endpoint
TCP connectivityTCP connection to service port
ReadinessKubernetes readiness probe status
LivenessKubernetes liveness probe status

Health results feed into the topology view and trigger alerts when services become unhealthy.


Service Endpoints

Services are discoverable within the Kubernetes cluster via standard DNS:

<service-name>.<tenant-namespace>.svc.cluster.local:<port>

For example: ai-service.tenant-acme.svc.cluster.local:8000