Skip to content

feat: ✨ Add service upgrade functionality - #685

Open
titigmr wants to merge 2 commits into
InseeFrLab:mainfrom
titigmr:feat/upgrade
Open

titigmr wants to merge 2 commits into
InseeFrLab:mainfrom
titigmr:feat/upgrade

Conversation

@titigmr

@titigmr titigmr commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Motivation

Onyxia can install, delete and suspend/resume a service, but not re-deploy an existing one with different parameters. To change something as simple as resource limits or network access, users had to delete the service and create a new one, losing its release.

This adds an upgrade operation that re-runs helm upgrade on the existing release.

What changed

  • New endpoint PUT /my-lab/app/{serviceId} with an UpgradeServiceDTO body:
    • options (required): the values of the release.
    • packageVersion (optional): defaults to the chart version of the running service.
    • friendlyName and share (optional): the current values are kept when omitted.
  • Fix: a pod being deleted keeps reporting ready: true during its grace period, so a restarting service still appeared as running. Containers of terminating pods are now reported as not ready.

Usage example

PUT /api/my-lab/app/vscode-python-132792
{
  "packageVersion": "2.6.6",
  "friendlyName": "my vscode",
  "share": false,
  "options": { "resources": { "limits": { "memory": "8Gi" } } }
}

options replaces the values of the release (--reuse-values is not used): omitted keys fall back to the chart defaults, so users should send the complete set of values.

Notes

  • Tested manually on a kind cluster with vscode-python: changing resource limits restarts the pod and the service shows as starting until it is ready again.
  • No rollback on failure. A failing helm upgrade is returned as a regular API error, and a follow-up can surface the Helm message to the user.
  • Add an “Upgrade” button to the service details page on UI

Copilot AI balanced review requested due to automatic review settings October 17, 2026 02:56
HelmInstaller res =
getHelmInstallService()
.installChart(
getHelmConfiguration(region, user),

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved correctness issues can create unintended releases, retain stale values, or fail after an upgrade has already succeeded.

5 open issues
What changed in this PR

Adds in-place service upgrades to Onyxia’s existing service lifecycle API.

Changes:

  • Adds an upgrade endpoint and request DTO, reusing chart schema validation.
  • Executes Helm upgrades, updates optional metadata, and publishes upgrade events.
  • Reports containers in terminating pods as not ready.
File Description
onyxia-model/​src/​main/​java/​fr/​insee/​onyxia/​model/​dto/​UpgradeServiceDTO.java Defines upgrade parameters.
onyxia-api/​src/​main/​java/​fr/​insee/​onyxia/​api/​services/​impl/​HelmAppsService.java Implements upgrades and adjusts readiness reporting.
onyxia-api/​src/​main/​java/​fr/​insee/​onyxia/​api/​services/​AppsService.java Adds the upgrade service contract.
onyxia-api/​src/​main/​java/​fr/​insee/​onyxia/​api/​events/​UpgradeServiceEvent.java Defines the upgrade event.
onyxia-api/​src/​main/​java/​fr/​insee/​onyxia/​api/​controller/​api/​mylab/​MyLabController.java Adds the endpoint and shared schema validation.

Review effort: Balanced

@RequestBody UpgradeServiceDTO requestDTO)
throws Exception {
User user = userProvider.getUser(region);
Service userService = helmAppsService.getUserService(region, project, user, serviceId);
Comment on lines +608 to +610
int split = chart.lastIndexOf('-');
String chartName = chart.substring(0, split);
String currentVersion = chart.substring(split + 1);
.orElseThrow(NotFoundException::new);

Map<String, Object> fusion = new HashMap<>();
fusion.putAll((Map<String, Object>) requestDTO.getOptions());
skipTlsVerify,
timeout,
caFile,
false);
metadata.put(SHARE, String.valueOf(share));
}
if (!metadata.isEmpty()) {
patchOnyxiaSecret(region, project, user, serviceId, metadata);
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants