Skip to content

Commit

Permalink
changing code to derive cloud type (#826)
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-db authored and sudharshanraja-db committed Apr 11, 2023
1 parent 1e48d17 commit 4de1e9a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/main/scala/com/databricks/labs/overwatch/utils/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.databricks.labs.overwatch.pipeline.PipelineFunctions
import org.apache.log4j.{Level, Logger}
import org.apache.spark.sql.Column
import org.apache.spark.sql.functions.col

import com.databricks.labs.overwatch.utils.Helpers.spark
import java.util.UUID

class Config() {
Expand Down Expand Up @@ -403,18 +403,17 @@ class Config() {
* @return
*/
private def deriveCloudProvider(): String = {
if(isPVC){
"aws"
}else(
workspaceURL.toLowerCase match {
case cloudType if cloudType.contains("azure") => "azure"
case cloudType if cloudType.contains("aws") => "aws"
case cloudType if cloudType.contains("gcp") => "gcp"
case _ => throw new BadConfigException(s"${workspaceURL.toLowerCase} NOT SUPPORTED: Supported clouds at this time " +
s"include azure, aws, gcp")
if(isMultiworkspaceDeployment) {
if (isPVC) {
"aws"
} else {
workspaceURL.toLowerCase match {
case cloudType if cloudType.contains("azure") => "azure"
case cloudType if cloudType.contains("gcp") => "gcp"
case _ => "aws"
}
}
)

} else spark.conf.get("spark.databricks.cloudProvider").toLowerCase
}

private[overwatch] def buildApiEnv(tokenSecret: Option[TokenSecret], apiEnvConfig: Option[ApiEnvConfig]): ApiEnv = {
Expand Down

0 comments on commit 4de1e9a

Please sign in to comment.