Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
backwards compatibility with generated route name
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitraz committed Apr 16, 2020
1 parent f7a0b83 commit 06a12a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SHELL=/bin/bash
REG=quay.io
ORG=integreatly
IMAGE=tutorial-web-app-operator
TAG=0.0.48
TAG=v0.0.48
KUBE_CMD=oc apply -f
DEPLOY_DIR=deploy
OUT_STATIC_DIR=tmp/_output
Expand Down
2 changes: 0 additions & 2 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ spec:
properties:
app_label:
type: string
routingSubdomain:
type: string
template:
type: object
properties:
Expand Down
5 changes: 2 additions & 3 deletions pkg/apis/integreatly/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ type WebApp struct {
}

type WebAppSpec struct {
AppLabel string `json:"app_label"`
Template WebAppTemplate `json:"template"`
RoutingSubdomain string `json:"routingSubdomain"`
AppLabel string `json:"app_label"`
Template WebAppTemplate `json:"template"`
}

type WebAppStatus struct {
Expand Down
8 changes: 6 additions & 2 deletions pkg/handlers/webhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (h *AppHandler) GetRuntimeObjs(exts []runtime.RawExtension) ([]runtime.Obje
}

func (h *AppHandler) CreateRoute(cr *v1alpha1.WebApp) *routev1.Route {
return &routev1.Route{
route := &routev1.Route{
TypeMeta: metav1.TypeMeta{
Kind: "Route",
APIVersion: "route.openshift.io/v1",
Expand All @@ -241,7 +241,6 @@ func (h *AppHandler) CreateRoute(cr *v1alpha1.WebApp) *routev1.Route {
Labels: cr.GetLabels(),
},
Spec: routev1.RouteSpec{
Host: fmt.Sprintf("%s.%s", routeName, cr.Spec.RoutingSubdomain),
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
Expand All @@ -251,6 +250,11 @@ func (h *AppHandler) CreateRoute(cr *v1alpha1.WebApp) *routev1.Route {
},
},
}
subdomain := cr.Spec.Template.Parameters["ROUTING_SUBDOMAIN"]
if subdomain != "" {
route.Spec.Host = fmt.Sprintf("%s.%s", routeName, subdomain)
}
return route
}

func (h *AppHandler) ProvisionObjects(objects []runtime.Object, cr *v1alpha1.WebApp) error {
Expand Down

0 comments on commit 06a12a6

Please sign in to comment.