Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RW-12876] Draft: Initial version of OfficeSuite support #4659

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ENV CROMWELL_CHART_VERSION 0.2.506
ENV HAIL_BATCH_CHART_VERSION 0.2.0
ENV RSTUDIO_CHART_VERSION 0.11.0
ENV SAS_CHART_VERSION 0.14.0
ENV OFFICE_SUITE_CHART_VERSION 0.1.0

RUN mkdir /leonardo
COPY ./leonardo*.jar /leonardo
Expand Down Expand Up @@ -67,6 +68,7 @@ RUN cd /leonardo && \
helm pull cromwell-helm/cromwell --version $CROMWELL_CHART_VERSION --untar && \
helm pull terra-helm/rstudio --version $RSTUDIO_CHART_VERSION --untar && \
helm pull terra-helm/sas --version $SAS_CHART_VERSION --untar && \
helm pull terra-helm/officesuite --version $OFFICE_SUITE_CHART_VERSION --untar && \
helm pull oci://terradevacrpublic.azurecr.io/hail/hail-batch-terra-azure --version $HAIL_BATCH_CHART_VERSION --untar && \
cd /

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,15 @@ object AllowedChartName {
def asString: String = "sas"
}

final case object OfficeSuite extends AllowedChartName {
def asString: String = "Officesuite"
}

// We used to have different chart names for RStudio and SAS. This is to handle the old names for backwards-compatibility
private val deprecatedName: Map[String, AllowedChartName] = Map(
"aou-rstudio-chart" -> RStudio,
"aou-sas-chart" -> Sas
"aou-sas-chart" -> Sas,
"aou-officesuite-chart" -> OfficeSuite
)

def stringToObject: Map[String, AllowedChartName] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class kubernetesModelsSpec extends LeonardoTestSuite with Matchers with AnyFlatS
it should "convert chartName to AllowedChartName correctly" in {
AllowedChartName.fromChartName(ChartName("/leonardo/cromwell")) shouldBe None
AllowedChartName.fromChartName(ChartName("/leonardo/sas")) shouldBe Some(AllowedChartName.Sas)
AllowedChartName.fromChartName(ChartName("/leonardo/officesuite")) shouldBe Some(AllowedChartName.OFFICESUITE)
AllowedChartName.fromChartName(ChartName("/leonardo/rstudio")) shouldBe Some(
AllowedChartName.RStudio
)
Expand Down
1 change: 1 addition & 0 deletions http/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ gke {
chartName = "/leonardo/"
rstudioChartVersion = "0.11.0"
sasChartVersion = "0.14.0"
officeSuiteChartVersion = "0.1.0"

services = [
{
Expand Down
1 change: 1 addition & 0 deletions http/src/main/resources/swagger/api-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2993,6 +2993,7 @@ components:
enum:
- rstudio
- sas
- officesuite
AppStatus:
type: string
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ object Config {
config.as[ChartName]("chartName"),
config.as[ChartVersion]("rstudioChartVersion"),
config.as[ChartVersion]("sasChartVersion"),
config.as[ChartVersion]("officeSuiteChartVersion"),
config.as[NamespaceNameSuffix]("namespaceNameSuffix"),
config.as[ReleaseNameSuffix]("releaseNameSuffix"),
config.as[List[ServiceConfig]]("services"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ final case class ContainerRegistryCredentials(username: ContainerRegistryUsernam
final case class AllowedAppConfig(chartName: ChartName,
rstudioChartVersion: ChartVersion,
sasChartVersion: ChartVersion,
officeSuiteChartVersion: ChartVersion,
namespaceNameSuffix: NamespaceNameSuffix,
releaseNameSuffix: ReleaseNameSuffix,
services: List[ServiceConfig],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ final class LeoAppServiceInterp[F[_]: Parallel](config: AppServiceConfig,
case Some(cn) =>
cn match {
case AllowedChartName.RStudio => F.unit
case AllowedChartName.OfficeSuite => F.unit
case AllowedChartName.Sas =>
if (config.enableSasApp) {
if (enableIntraNodeVisibility) {
Expand Down Expand Up @@ -1464,6 +1465,7 @@ final class LeoAppServiceInterp[F[_]: Parallel](config: AppServiceConfig,
val chartVersion = req.allowedChartName.get match {
case AllowedChartName.RStudio => config.leoKubernetesConfig.allowedAppConfig.rstudioChartVersion
case AllowedChartName.Sas => config.leoKubernetesConfig.allowedAppConfig.sasChartVersion
case AllowedChartName.OfficeSuite => config.leoKubernetesConfig.allowedAppConfig.officeSuiteChartVersion
}
gkeAppConfig.chart
.lens(_.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,17 @@ private[leonardo] object BuildHelmChartValues {
raw"""imageCredentials.username=${config.allowedAppConfig.sasContainerRegistryCredentials.username.asString}""",
raw"""imageCredentials.password=${config.allowedAppConfig.sasContainerRegistryCredentials.password.asString}"""
) ++ common

case AllowedChartName.OfficeSuite =>
List(
raw"""ingress.officesuite.path=${ingressPath}${"(/|$)(.*)"}""",
raw"""ingress.welder.path=${welderIngressPath}${"(/|$)(.*)"}""",
raw"""ingress.annotations.nginx\.ingress\.kubernetes\.io/proxy-redirect-from=https://${
k8sProxyHost
.address()
}""",
raw"""proxySubpath=${ingressPath.drop(1)}""",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to remove the first / from url, something like proxy/google/v1/app/office/app

) ++ common
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,63 @@ class BuildHelmChartValuesSpec extends AnyFlatSpecLike with LeonardoTestSuite {
"""gcsfuse.enabled=false"""
}

it should "build OfficeSuite override values string" in {
val savedCluster1 = makeKubeCluster(1)
val savedDisk1 = makePersistentDisk(Some(DiskName("disk1")))
val envVariables = Map("WORKSPACE_NAME" -> "test-workspace-name")
val res = buildAllowedAppChartOverrideValuesString(
Config.gkeInterpConfig,
AllowedChartName.OfficeSuite,
appName = AppName("app1"),
cluster = savedCluster1,
nodepoolName = Some(NodepoolName("pool1")),
namespaceName = NamespaceName("ns"),
disk = savedDisk1,
ksaName = ServiceAccountName("app1-officesuite-ksa"),
userEmail = userEmail2,
stagingBucket = GcsBucketName("test-staging-bucket"),
envVariables,
None,
Some(GcsBucketName("fc-bucket"))
)

res.mkString(",") shouldBe
"""ingress.officesuite.path=/proxy/google/v1/apps/dsp-leo-test1/app1/app(/|$)(.*),""" +
"""ingress.welder.path=/proxy/google/v1/apps/dsp-leo-test1/app1/welder-service(/|$)(.*),""" +
"""ingress.annotations.nginx\.ingress\.kubernetes\.io/proxy-redirect-from=https://1455694897.jupyter.firecloud.org,""" +
"""fullnameOverride=app1,""" +
"""persistence.size=250G,""" +
"""persistence.gcePersistentDisk=disk1,""" +
"""serviceAccount.name=app1-officesuite-ksa,""" +
"""ingress.enabled=true,""" +
"""ingress.annotations.nginx\.ingress\.kubernetes\.io/auth-tls-secret=ns/ca-secret,""" +
"""ingress.annotations.nginx\.ingress\.kubernetes\.io/proxy-redirect-to=https://leo/proxy/google/v1/apps/dsp-leo-test1/app1/app,""" +
"""ingress.annotations.nginx\.ingress\.kubernetes\.io/rewrite-target=/$2,""" +
"""ingress.annotations.nginx\.ingress\.kubernetes\.io/proxy-cookie-path=/ "/; Secure; SameSite=None; HttpOnly",""" +
"""ingress.host=1455694897.jupyter.firecloud.org,""" +
"""ingress.tls[0].secretName=tls-secret,""" +
"""ingress.tls[0].hosts[0]=1455694897.jupyter.firecloud.org,""" +
"""welder.extraEnv[0].name=GOOGLE_PROJECT,""" +
"""welder.extraEnv[0].value=dsp-leo-test1,""" +
"""welder.extraEnv[1].name=STAGING_BUCKET,""" +
"""welder.extraEnv[1].value=test-staging-bucket,""" +
"""welder.extraEnv[2].name=CLUSTER_NAME,""" +
"""welder.extraEnv[2].value=app1,""" +
"""welder.extraEnv[3].name=OWNER_EMAIL,""" +
"""welder.extraEnv[3][email protected],""" +
"""welder.extraEnv[4].name=WORKSPACE_ID,""" +
"""welder.extraEnv[4].value=dummy,""" +
"""welder.extraEnv[5].name=WSM_URL,""" +
"""welder.extraEnv[5].value=dummy,""" +
"""extraEnv[0].name=WORKSPACE_NAME,""" +
"""extraEnv[0].value=test-workspace-name,""" +
"""replicaCount=1,""" +
"""nodeSelector.cloud\.google\.com/gke-nodepool=pool1,""" +
"""gcsfuse.enabled=true,""" +
"""gcsfuse.bucket=fc-bucket"""
"""proxySubpath=proxy/google/v1/apps/dsp-leo-test1/app1/app"""
}

it should "build SAS override values string in autopilot mode" in {
val savedCluster1 = makeKubeCluster(1)
val savedDisk1 = makePersistentDisk(Some(DiskName("disk1")))
Expand Down
Loading