diff --git a/example/picsum-dash-app/Dockerfile b/example/picsum-dash-app/Dockerfile index af706d5..2b5e8da 100644 --- a/example/picsum-dash-app/Dockerfile +++ b/example/picsum-dash-app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-alpine +FROM python:3.10-alpine USER root diff --git a/pkg/controller/dash_controller.go b/pkg/controller/dash_controller.go index 6ff37a3..669ad42 100644 --- a/pkg/controller/dash_controller.go +++ b/pkg/controller/dash_controller.go @@ -2,6 +2,7 @@ package controller import ( "context" + "fmt" "github.com/go-logr/logr" dashv1alpha1 "github.com/pluralsh/dash-controller/apis/dash/v1alpha1" @@ -152,6 +153,17 @@ func genIngress(dashApp *dashv1alpha1.DashApplication) *networkingv1.Ingress { func genDeployment(dashApp *dashv1alpha1.DashApplication) *appsv1.Deployment { name := dashApp.Name + var envVars []corev1.EnvVar + + if dashApp.Spec.Ingress != nil && dashApp.Spec.Ingress.Path != "" && dashApp.Spec.Ingress.Path != "/" { + envVars = []corev1.EnvVar{ + { + Name: "DASH_ROUTES_PATHNAME_PREFIX", + Value: fmt.Sprintf("%s/", dashApp.Spec.Ingress.Path), + }, + } + } + deployment := &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -182,6 +194,7 @@ func genDeployment(dashApp *dashv1alpha1.DashApplication) *appsv1.Deployment { Name: name, }, }, + Env: envVars, }, }, }, diff --git a/resources/deployment.yaml b/resources/deployment.yaml index 008abcd..82a69fe 100644 --- a/resources/deployment.yaml +++ b/resources/deployment.yaml @@ -22,5 +22,5 @@ spec: serviceAccountName: dash-controller-sa containers: - name: dash-controller - image: ghcr.io/pluralsh/dash-controller:0.0.4 + image: ghcr.io/pluralsh/dash-controller:0.0.6 imagePullPolicy: Always