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

Always set the route path to empty if not specified #466

Merged
merged 4 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all 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: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ endif

.PHONY: install
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -
$(KUSTOMIZE) build config/crd | kubectl create -f -

.PHONY: uninstall
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
Expand Down
10 changes: 10 additions & 0 deletions bundle/tests/scorecard/kuttl/routes/01-add-path.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: rc.app.stacks/v1
kind: RuntimeComponent
metadata:
name: route
spec:
route:
host: myapp.mycompany.com
path: /mypath


8 changes: 8 additions & 0 deletions bundle/tests/scorecard/kuttl/routes/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: route
spec:
host: myapp.mycompany.com
path: /mypath
19 changes: 19 additions & 0 deletions bundle/tests/scorecard/kuttl/routes/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: route
annotations:
step: "02"
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: route
annotations:
step: "02"
spec:
host: myapp.mycompany.com
9 changes: 9 additions & 0 deletions bundle/tests/scorecard/kuttl/routes/02-errors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: route
annotations:
step: "02"
spec:
path: /mypath

12 changes: 12 additions & 0 deletions bundle/tests/scorecard/kuttl/routes/02-remove-route-spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rc.app.stacks/v1
kind: RuntimeComponent
metadata:
name: route
annotations:
step: "02"
spec:
# Add fields here
applicationImage: k8s.gcr.io/pause:2.0
replicas: 1
expose: true
route:
8 changes: 8 additions & 0 deletions bundle/tests/scorecard/kuttl/routes/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: route
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
3 changes: 3 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func CustomizeRoute(route *routev1.Route, ba common.BaseComponent, key string, c
}
}
}
if ba.GetRoute() == nil {
route.Spec.Path = ""
}
if ba.GetRoute() == nil || ba.GetRoute().GetTermination() == nil {
route.Spec.TLS = nil
}
Expand Down