Skip to content

Commit

Permalink
add ingress support
Browse files Browse the repository at this point in the history
  • Loading branch information
test committed Oct 24, 2022
1 parent 3358f2d commit a37fc1e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/picsum-dash-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine
FROM python:3.10-alpine

USER root

Expand Down
13 changes: 13 additions & 0 deletions pkg/controller/dash_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controller

import (
"context"
"fmt"

"github.com/go-logr/logr"
dashv1alpha1 "github.com/pluralsh/dash-controller/apis/dash/v1alpha1"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -182,6 +194,7 @@ func genDeployment(dashApp *dashv1alpha1.DashApplication) *appsv1.Deployment {
Name: name,
},
},
Env: envVars,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion resources/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a37fc1e

Please sign in to comment.