diff --git a/docs/region-configuration.md b/docs/region-configuration.md index 2db14a2a..255d8ad8 100644 --- a/docs/region-configuration.md +++ b/docs/region-configuration.md @@ -58,7 +58,6 @@ Users can work on Onyxia as a User or as a Group to which they belong. Each user | `authenticationMode` | serviceAccount | serviceAccount, impersonate or tokenPassthrough : on serviceAccount mode Onyxia API uses its own serviceAccount (by default admin or cluster-admin), with impersonate mode Onyxia requests the API with user's permissions (helm option `--kube-as-user`). With tokenPassthrough, the authentication token is passed to the API server. | | | `expose` | | When users request to expose their service, only subdomain of this object domain are allowed | See [Expose properties](#expose-properties) | | `monitoring` | | Define the URL pattern of the monitoring service that is to be launched with each service. Only for client purposes. | {URLPattern: "https://$NAMESPACE-$INSTANCE.mymonitoring.sspcloud.fr"} | -| `cloudshell` | | Define the catalog and package name where to fetch the cloudshell in the helm catalog. | {catalogId: "inseefrlab-helm-charts-datascience", packageName: "cloudshell"} | | `initScript` | | Define where to fetch a script that will be launched on some service on startup. | "https://inseefrlab.github.io/onyxia/onyxia-init.sh" | | `allowedURIPattern` | "^https://" | Init scripts set by the user have to respect this pattern. | | | `server` | | Define the configuration of the services provider API server, this value is not served on the API as it contains credentials for the API. | See [Server properties](#server-properties) | diff --git a/onyxia-api/src/main/java/fr/insee/onyxia/api/controller/api/cloudshell/CloudShellController.java b/onyxia-api/src/main/java/fr/insee/onyxia/api/controller/api/cloudshell/CloudShellController.java deleted file mode 100644 index 67ac7958..00000000 --- a/onyxia-api/src/main/java/fr/insee/onyxia/api/controller/api/cloudshell/CloudShellController.java +++ /dev/null @@ -1,118 +0,0 @@ -package fr.insee.onyxia.api.controller.api.cloudshell; - -import fr.insee.onyxia.api.services.AppsService; -import fr.insee.onyxia.api.services.CatalogService; -import fr.insee.onyxia.api.services.UserProvider; -import fr.insee.onyxia.model.catalog.Pkg; -import fr.insee.onyxia.model.project.Project; -import fr.insee.onyxia.model.region.Region; -import fr.insee.onyxia.model.service.Service; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.commons.lang3.NotImplementedException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@Tag(name = "Cloud Shell", description = "Cloud shell") -@RequestMapping("/cloudshell") -@RestController -@SecurityRequirement(name = "auth") -public class CloudShellController { - - @Autowired private AppsService helmAppsService; - - @Autowired private UserProvider userProvider; - - @Autowired private CatalogService catalogService; - - @GetMapping - public CloudShellStatus getCloudShellStatus( - @Parameter(hidden = true) Region region, @Parameter(hidden = true) Project project) { - CloudShellStatus status = new CloudShellStatus(); - Region.CloudshellConfiguration cloudshellConfiguration = - region.getServices().getCloudshell(); - try { - if (region.getServices().getType().equals(Service.ServiceType.KUBERNETES)) { - Service service = - helmAppsService.getUserService( - region, - project, - userProvider.getUser(region), - cloudshellConfiguration.getPackageName() + "*"); - status.setStatus(CloudShellStatus.STATUS_UP); - service.getUrls().stream().findFirst().ifPresent(status::setUrl); - } else { - throw new NotImplementedException( - "Cloudshell is only supported for Kubernetes service provider"); - } - } catch (Exception e) { - status.setStatus(CloudShellStatus.STATUS_DOWN); - status.setPackageToDeploy( - catalogService - .getPackage( - cloudshellConfiguration.getCatalogId(), - cloudshellConfiguration.getPackageName()) - .get()); - status.setCatalogId(cloudshellConfiguration.getCatalogId()); - status.setUrl(null); - } - - return status; - } - - @Schema(description = "Cloudshell data and health") - public static class CloudShellStatus { - - public static final String STATUS_UP = "UP", - STATUS_LOADING = "LOADING", - STATUS_DOWN = "DOWN"; - - @Schema(description = "Status of the connexion to the cloudshell") - private String status = STATUS_UP; - - @Schema(description = "URL of the cloudshell") - private String url = null; - - @Schema(description = "?") - private Pkg packageToDeploy = null; - - @Schema(description = "?") - private String catalogId; - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public Pkg getPackageToDeploy() { - return packageToDeploy; - } - - public void setPackageToDeploy(Pkg packageToDeploy) { - this.packageToDeploy = packageToDeploy; - } - - public String getCatalogId() { - return catalogId; - } - - public void setCatalogId(String catalogId) { - this.catalogId = catalogId; - } - } -} diff --git a/onyxia-api/src/main/resources/regions.json b/onyxia-api/src/main/resources/regions.json index a1b15ac7..2f39e2ed 100644 --- a/onyxia-api/src/main/resources/regions.json +++ b/onyxia-api/src/main/resources/regions.json @@ -60,10 +60,6 @@ }, "monitoring": { "URLPattern": "https://graphana.kub.example.com/$appIdSlug" - }, - "cloudshell": { - "catalogId": "inseefrlab-helm-charts-datascience", - "packageName": "cloudshell" } }, "data": { diff --git a/onyxia-model/src/main/java/fr/insee/onyxia/model/catalog/Config/Property.java b/onyxia-model/src/main/java/fr/insee/onyxia/model/catalog/Config/Property.java index 99560a51..09883472 100644 --- a/onyxia-model/src/main/java/fr/insee/onyxia/model/catalog/Config/Property.java +++ b/onyxia-model/src/main/java/fr/insee/onyxia/model/catalog/Config/Property.java @@ -7,7 +7,7 @@ import java.util.Map; @JsonIgnoreProperties(ignoreUnknown = true) -@Schema(description = "Cloudshell data and health") +@Schema(description = "") public class Property { @Schema(description = "") String type; @@ -270,7 +270,7 @@ public void setxGenerated(XGenerated xGenerated) { } @JsonIgnoreProperties(ignoreUnknown = true) - @Schema(description = "Cloudshell data and health") + @Schema(description = "") public static class Media { String type; @@ -284,7 +284,7 @@ public void setType(String type) { } @JsonIgnoreProperties(ignoreUnknown = true) - @Schema(description = "Cloudshell data and health") + @Schema(description = "") public static class Hidden { Object value; String path; diff --git a/onyxia-model/src/main/java/fr/insee/onyxia/model/helm/Chart.java b/onyxia-model/src/main/java/fr/insee/onyxia/model/helm/Chart.java index 02e1cd42..93db0ef6 100644 --- a/onyxia-model/src/main/java/fr/insee/onyxia/model/helm/Chart.java +++ b/onyxia-model/src/main/java/fr/insee/onyxia/model/helm/Chart.java @@ -24,7 +24,7 @@ "urls", "version" }) -@Schema(description = "Cloudshell data and health") +@Schema(description = "") public class Chart extends Pkg { @Schema(description = "") diff --git a/onyxia-model/src/main/java/fr/insee/onyxia/model/region/Region.java b/onyxia-model/src/main/java/fr/insee/onyxia/model/region/Region.java index 9b893e54..18c2dd3e 100644 --- a/onyxia-model/src/main/java/fr/insee/onyxia/model/region/Region.java +++ b/onyxia-model/src/main/java/fr/insee/onyxia/model/region/Region.java @@ -199,7 +199,6 @@ public static class Services { private Expose expose; private Server server; private Monitoring monitoring; - private CloudshellConfiguration cloudshell; private String initScript; private String allowedURIPattern = "^https://"; private Quotas quotas = new Quotas(); @@ -313,14 +312,6 @@ public void setServer(Server server) { this.server = server; } - public CloudshellConfiguration getCloudshell() { - return cloudshell; - } - - public void setCloudshell(CloudshellConfiguration cloudshell) { - this.cloudshell = cloudshell; - } - public Monitoring getMonitoring() { return monitoring; } @@ -728,7 +719,7 @@ public void setUrlPattern(String urlPattern) { } } - @Schema(description = "Cloudshell data and health") + @Schema(description = "") public static class Data { private Atlas atlas; @@ -1211,7 +1202,7 @@ public void setAuth(Auth auth) { } public static class OnyxiaAPI { - @Schema(description = "Cloudshell data and health") + @Schema(description = "") private String baseURL; public String getBaseURL() { @@ -1340,7 +1331,7 @@ public void setPypiProxyUrl(String pypiProxyUrl) { } } - @Schema(description = "Cloudshell data and health") + @Schema(description = "") public static class Location { private double lat; @@ -1375,27 +1366,6 @@ public void setName(String name) { } } - public static class CloudshellConfiguration { - - private String catalogId, packageName; - - public String getCatalogId() { - return catalogId; - } - - public void setCatalogId(String catalogId) { - this.catalogId = catalogId; - } - - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - } - public static class Auth { private String token; private String username, password; diff --git a/onyxia-model/src/main/java/fr/insee/onyxia/model/service/Service.java b/onyxia-model/src/main/java/fr/insee/onyxia/model/service/Service.java index 4c8525f4..451c28b3 100644 --- a/onyxia-model/src/main/java/fr/insee/onyxia/model/service/Service.java +++ b/onyxia-model/src/main/java/fr/insee/onyxia/model/service/Service.java @@ -253,19 +253,19 @@ public String getPostInstallInstructions() { return postInstallInstructions; } - @Schema(description = "Cloudshell data and health") + @Schema(description = "") public static enum ServiceStatus { DEPLOYING, RUNNING, STOPPED; } - @Schema(description = "Cloudshell data and health") + @Schema(description = "") public static enum ServiceType { KUBERNETES } - @Schema(description = "Cloudshell data and health") + @Schema(description = "") public static class Monitoring { private String url;