You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by yk...@apache.org on 2021/02/22 10:21:13 UTC
[incubator-datalab] branch DATALAB-2228 updated: [DATALAB-2228] -
added GKE support
This is an automated email from the ASF dual-hosted git repository.
ykinash pushed a commit to branch DATALAB-2228
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/DATALAB-2228 by this push:
new bc19bbb [DATALAB-2228] - added GKE support
bc19bbb is described below
commit bc19bbb3770052d7a8401748b0b46bf4987157c7
Author: KinashYurii <ur...@gmail.com>
AuthorDate: Mon Feb 22 12:19:48 2021 +0200
[DATALAB-2228] - added GKE support
---
.../conf/SelfServiceApplicationConfiguration.java | 7 +++++++
.../datalab/backendapi/modules/ChangePropertiesConst.java | 14 ++++++++------
.../datalab/backendapi/resources/KeycloakResource.java | 2 +-
.../resources/admin/ChangePropertiesResource.java | 15 +++++++++++----
4 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/conf/SelfServiceApplicationConfiguration.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/conf/SelfServiceApplicationConfiguration.java
index 9bdde34..66ccb72 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/conf/SelfServiceApplicationConfiguration.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/conf/SelfServiceApplicationConfiguration.java
@@ -149,6 +149,8 @@ public class SelfServiceApplicationConfiguration extends ServiceConfiguration {
return gcpOuauth2AuthenticationEnabled;
}
+ public String deployed;
+
/**
* Returns the minimum number of slave EMR instances than could be created.
*/
@@ -268,4 +270,9 @@ public class SelfServiceApplicationConfiguration extends ServiceConfiguration {
public String getOs() {
return os;
}
+
+ public String getDeployed() {
+ return deployed;
+ }
+
}
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/modules/ChangePropertiesConst.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/modules/ChangePropertiesConst.java
index 3fc77b6..bc33e6d 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/modules/ChangePropertiesConst.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/modules/ChangePropertiesConst.java
@@ -1,19 +1,21 @@
package com.epam.datalab.backendapi.modules;
public interface ChangePropertiesConst {
- // /root/self-service.yaml
- // /root/billing.yaml
+ String GKE_SELF_SERVICE_PATH = "/root/self-service.yaml";
+ String GKE_SELF_SERVICE = "self-service.yaml";
String SELF_SERVICE = "self-service.yml";
-// String SELF_SERVICE_PROP_PATH = "services/self-service/self-service.yml";
- String SELF_SERVICE_PROP_PATH = "/opt/datalab/conf/self-service.yml";
+ // String SELF_SERVICE_PROP_PATH = "services/self-service/self-service.yml";
+ String SELF_SERVICE_PROP_PATH = "/opt/datalab/conf/self-service.yml";
String PROVISIONING_SERVICE = "provisioning.yml";
-// String PROVISIONING_SERVICE_PROP_PATH = "services/provisioning-service/provisioning.yml";
- String PROVISIONING_SERVICE_PROP_PATH = "/opt/datalab/conf/provisioning.yml";
+ // String PROVISIONING_SERVICE_PROP_PATH = "services/provisioning-service/provisioning.yml";
+ String PROVISIONING_SERVICE_PROP_PATH = "/opt/datalab/conf/provisioning.yml";
String BILLING_SERVICE = "billing.yml";
// String BILLING_SERVICE_PROP_PATH = "services/billing-gcp/billing.yml";
// String BILLING_SERVICE_PROP_PATH = "services/billing-azure/billing.yml";
// String BILLING_SERVICE_PROP_PATH = "services/billing-aws/billing.yml";
String BILLING_SERVICE_PROP_PATH = "/opt/datalab/conf/billing.yml";
+ String GKE_BILLING_PATH = "/root/billing.yaml";
+ String GKE_BILLING_SERVICE = "billing.yml";
String SELF_SERVICE_SUPERVISORCTL_RUN_NAME = " ui ";
String PROVISIONING_SERVICE_SUPERVISORCTL_RUN_NAME = " provserv ";
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/KeycloakResource.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/KeycloakResource.java
index 066037f..6e44494 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/KeycloakResource.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/KeycloakResource.java
@@ -116,7 +116,7 @@ public class KeycloakResource {
public Response refreshAccessToken(@PathParam("refresh_token") String refreshToken) throws URISyntaxException {
AccessTokenResponse tokenResponse;
try {
- tokenResponse = keycloakService.generateAccessToken(refreshToken);
+ tokenResponse = keycloakService.generateAccessToken(refreshToken);
} catch (DatalabException e) {
log.error("Cannot refresh token due to: {}", e.getMessage(), e);
return Response.status(Response.Status.BAD_REQUEST)
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/admin/ChangePropertiesResource.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/admin/ChangePropertiesResource.java
index b964f2f..6d5a7aa 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/admin/ChangePropertiesResource.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/admin/ChangePropertiesResource.java
@@ -1,6 +1,7 @@
package com.epam.datalab.backendapi.resources.admin;
import com.epam.datalab.auth.UserInfo;
+import com.epam.datalab.backendapi.conf.SelfServiceApplicationConfiguration;
import com.epam.datalab.backendapi.modules.ChangePropertiesConst;
import com.epam.datalab.backendapi.modules.RestartForm;
import com.epam.datalab.backendapi.resources.dto.YmlDTO;
@@ -13,16 +14,18 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-@Path("config")
+@Path("admin")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class ChangePropertiesResource implements ChangePropertiesConst {
private final DynamicChangeProperties dynamicChangeProperties;
+ private final String deployedOn;
@Inject
- public ChangePropertiesResource(DynamicChangeProperties dynamicChangeProperties) {
+ public ChangePropertiesResource(DynamicChangeProperties dynamicChangeProperties, SelfServiceApplicationConfiguration selfServiceApplicationConfiguration) {
this.dynamicChangeProperties = dynamicChangeProperties;
+ deployedOn = selfServiceApplicationConfiguration.getDeployed();
}
@GET
@@ -30,7 +33,9 @@ public class ChangePropertiesResource implements ChangePropertiesConst {
public Response getSelfServiceProperties(@Auth UserInfo userInfo) {
if (UserRoles.isAdmin(userInfo)) {
return Response
- .ok(dynamicChangeProperties.getProperties(SELF_SERVICE_PROP_PATH, SELF_SERVICE))
+ .ok(deployedOn.equals("onPremise") ?
+ dynamicChangeProperties.getProperties(SELF_SERVICE_PROP_PATH, SELF_SERVICE) :
+ dynamicChangeProperties.getProperties(GKE_SELF_SERVICE_PATH, GKE_SELF_SERVICE))
.build();
} else {
return Response
@@ -58,7 +63,9 @@ public class ChangePropertiesResource implements ChangePropertiesConst {
public Response getBillingServiceProperties(@Auth UserInfo userInfo) {
if (UserRoles.isAdmin(userInfo)) {
return Response
- .ok(dynamicChangeProperties.getProperties(BILLING_SERVICE_PROP_PATH, BILLING_SERVICE))
+ .ok(deployedOn.equals("onPremise") ?
+ dynamicChangeProperties.getProperties(BILLING_SERVICE_PROP_PATH, BILLING_SERVICE) :
+ dynamicChangeProperties.getProperties(GKE_BILLING_PATH, GKE_BILLING_SERVICE))
.build();
} else {
return Response
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org