MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
Upgrade Paths

Upgrade Paths

The UpgradePathCalculationService manages the registration and calculation of upgrade paths between component versions. It uses BFS-based graph traversal to find all possible routes from a source version to a target version, ranking them by step count, risk level, downtime requirements, and estimated duration.


Register an Upgrade Path

Endpoint: POST /api/v1/registry/upgrade-paths

curl -X POST http://localhost:8084/api/v1/registry/upgrade-paths \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${TOKEN}" \
  -d '{
    "fromVersion": { "id": "aaa-111" },
    "toVersion": { "id": "bbb-222" },
    "direct": true,
    "requiresDowntime": false,
    "estimatedDurationMinutes": 15,
    "riskLevel": "LOW",
    "preUpgradeSteps": "[\"Backup current configuration\", \"Verify disk space\"]",
    "upgradeSteps": "[\"Apply Helm chart update\", \"Wait for rolling restart\"]",
    "postUpgradeSteps": "[\"Run smoke tests\", \"Verify data integrity\"]",
    "rollbackSteps": "[\"Revert Helm chart\", \"Restore configuration backup\"]",
    "validationSteps": "[\"Check health endpoints\", \"Run integration tests\"]",
    "tested": true,
    "notes": "Backward-compatible minor upgrade"
  }'

When an upgrade path is registered, the service automatically determines the upgrade type (PATCH, MINOR, MAJOR) by comparing the semantic versions. If no risk level is specified, it defaults based on upgrade type: PATCH maps to LOW, MINOR to MEDIUM, MAJOR to HIGH.


UpgradePath Structure

FieldTypeDescription
idUUIDPath identifier
componentIdUUIDComponent this path belongs to
fromVersionComponentVersionSource version
toVersionComponentVersionTarget version
upgradeTypeUpgradeTypeClassification of the upgrade
directbooleanWhether this is a single-step path
requiresDowntimebooleanWhether downtime is needed
estimatedDurationMinutesIntegerEstimated upgrade duration
riskLevelRiskLevelRisk assessment
preUpgradeStepsJSONSteps to execute before upgrade
upgradeStepsJSONCore upgrade procedure steps
postUpgradeStepsJSONSteps to execute after upgrade
rollbackStepsJSONProcedure to roll back the upgrade
validationStepsJSONSteps to validate upgrade success
migrationScriptsJSONData migration scripts to run
breakingChangesStringDescription of breaking changes
testedbooleanWhether this path has been tested
testResultsJSONResults from path testing

Upgrade Types

TypeDescriptionDefault Risk
PATCHBug fixes only, no API changesLOW
MINORNew features, backward compatibleMEDIUM
MAJORBreaking changes, API modificationsHIGH
HOTFIXCritical security or bug fixLOW

Risk Levels

LevelDescriptionRecommendation
LOWSafe to upgrade, minimal riskCan proceed with standard monitoring
MEDIUMSome care needed, minor risksTest in staging first
HIGHSignificant changes, potential issuesFull staging validation required
CRITICALMajor breaking changesRequires maintenance window and backup

Calculate Upgrade Paths

Endpoint: GET /api/v1/registry/upgrade-paths/calculate?fromVersionId=:fromId&toVersionId=:toId

Calculates all possible upgrade routes between two versions using breadth-first search. The algorithm traverses the graph of registered upgrade paths, building multi-step routes when no direct path exists.

The service returns up to 10 routes, sorted by preference:

  1. Fewer steps (direct paths preferred)
  2. Lower risk level
  3. No downtime required
  4. Shorter estimated duration

UpgradeRoute Structure

FieldTypeDescription
stepsListOrdered list of UpgradePath entries
totalStepsintNumber of steps in the route
totalDurationMinutesintSum of estimated durations across all steps
requiresDowntimebooleanTrue if any step requires downtime
maxRiskLevelRiskLevelHighest risk level across all steps
breakingChangesListAggregated breaking changes from all steps

Optimal Upgrade Path

Endpoint: GET /api/v1/registry/upgrade-paths/optimal?fromVersionId=:fromId&toVersionId=:toId

Returns the single best upgrade route based on the sorting criteria described above. This is a convenience endpoint that returns the first result from the full path calculation.


Upgrade to Latest

Endpoint: GET /api/v1/registry/versions/:versionId/upgrade-to-latest

Calculates the optimal upgrade path from the specified version to the latest version of the same component. Returns 404 if the specified version is already the latest.


Upgrade to Recommended

Endpoint: GET /api/v1/registry/versions/:versionId/upgrade-to-recommended

Calculates the optimal upgrade path from the specified version to the recommended version of the same component. Returns 404 if the specified version is already the recommended version or no recommended version is set.


Available Upgrade Targets

Endpoint: GET /api/v1/registry/versions/:versionId/upgrade-targets

Lists all stable versions that are newer than the specified version, along with metadata about the upgrade path to each target.

UpgradeTarget Structure

FieldTypeDescription
targetVersionComponentVersionThe target version details
hasDirectPathbooleanWhether a single-step path exists
stepsRequiredintNumber of steps needed (-1 if no path exists)
isRecommendedbooleanWhether this is the recommended version
isLtsbooleanWhether this is a long-term support version
riskLevelRiskLevelRisk level of the optimal path
requiresDowntimebooleanWhether the optimal path requires downtime

Targets are sorted by preference: recommended versions first, then LTS versions, then lower risk, then fewer steps.


Validate Upgrade

Endpoint: POST /api/v1/registry/upgrade-paths/validate?fromVersionId=:fromId&toVersionId=:toId

Validates whether an upgrade is safe to execute by checking dependency compatibility, version status, path testing status, and risk level.

curl -X POST "http://localhost:8084/api/v1/registry/upgrade-paths/validate?fromVersionId=aaa&toVersionId=bbb" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${TOKEN}" \
  -d '{
    "kafka": "3.6.0",
    "postgresql": "16.1"
  }'

UpgradeValidation Structure

FieldTypeDescription
validbooleanWhether the upgrade can proceed (no blockers)
blockersListIssues that prevent the upgrade
warningsListNon-blocking concerns
prerequisitesListActions required before proceeding
suggestedRouteUpgradeRouteThe recommended upgrade path

Validation checks include:

  • Upgrade path existence between the two versions
  • Required dependency availability in installed components
  • No end-of-life versions in the upgrade path
  • Deprecation warnings for deprecated intermediate versions
  • Untested path warnings
  • Downtime scheduling requirements for paths that require downtime
  • Backup prerequisites for critical risk paths

Zero-Downtime Paths

Endpoint: GET /api/v1/registry/components/:componentId/upgrade-paths/zero-downtime

Returns all registered upgrade paths for a component that do not require downtime, useful for planning live upgrades.