From c142f7e5c4ab3b45d6ff6026c951f2a50e42b8db Mon Sep 17 00:00:00 2001 From: ilewis Date: Thu, 9 Mar 2023 15:48:15 +0000 Subject: [PATCH 1/3] Use create instead of apply for make install This is because the CRD is now too long, and 'apply' will refuse to create it. Apply adds the whole resource as annotation, but create doesn't --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 799f4015..eae65879 100644 --- a/Makefile +++ b/Makefile @@ -224,7 +224,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. @@ -336,4 +336,4 @@ catalog-push: ## Push a catalog image. $(MAKE) docker-push IMG=$(CATALOG_IMG) dev: - ./scripts/dev.sh all \ No newline at end of file + ./scripts/dev.sh all From fb90c21ea65fb526b979c9b373c52b5f98057f58 Mon Sep 17 00:00:00 2001 From: ilewis Date: Fri, 10 Mar 2023 14:01:27 +0000 Subject: [PATCH 2/3] Always set the route path to empty if not specified As otherwise a previous path may continue to exist in the route, even if it has been removed from the spec --- .../scorecard/kuttl/routes/01-add-path.yaml | 14 ++++++++++++++ .../scorecard/kuttl/routes/01-assert.yaml | 8 ++++++++ .../scorecard/kuttl/routes/02-assert.yaml | 19 +++++++++++++++++++ .../scorecard/kuttl/routes/02-errors.yaml | 9 +++++++++ .../kuttl/routes/02-remove-route-spec.yaml | 12 ++++++++++++ .../scorecard/kuttl/routes/03-assert.yaml | 8 ++++++++ ...delete-route.yaml => 03-delete-route.yaml} | 0 .../routes/{01-errors.yaml => 03-errors.yaml} | 0 utils/utils.go | 3 +++ 9 files changed, 73 insertions(+) create mode 100644 bundle/tests/scorecard/kuttl/routes/01-add-path.yaml create mode 100644 bundle/tests/scorecard/kuttl/routes/02-assert.yaml create mode 100644 bundle/tests/scorecard/kuttl/routes/02-errors.yaml create mode 100644 bundle/tests/scorecard/kuttl/routes/02-remove-route-spec.yaml create mode 100644 bundle/tests/scorecard/kuttl/routes/03-assert.yaml rename bundle/tests/scorecard/kuttl/routes/{01-delete-route.yaml => 03-delete-route.yaml} (100%) rename bundle/tests/scorecard/kuttl/routes/{01-errors.yaml => 03-errors.yaml} (100%) diff --git a/bundle/tests/scorecard/kuttl/routes/01-add-path.yaml b/bundle/tests/scorecard/kuttl/routes/01-add-path.yaml new file mode 100644 index 00000000..64274add --- /dev/null +++ b/bundle/tests/scorecard/kuttl/routes/01-add-path.yaml @@ -0,0 +1,14 @@ +apiVersion: rc.app.stacks/v1 +kind: RuntimeComponent +metadata: + name: route +spec: + # Add fields here + applicationImage: k8s.gcr.io/pause:2.0 + replicas: 1 + expose: true + route: + host: myapp.mycompany.com + path: /mypath + + diff --git a/bundle/tests/scorecard/kuttl/routes/01-assert.yaml b/bundle/tests/scorecard/kuttl/routes/01-assert.yaml index cb36302e..d5c74d71 100644 --- a/bundle/tests/scorecard/kuttl/routes/01-assert.yaml +++ b/bundle/tests/scorecard/kuttl/routes/01-assert.yaml @@ -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 diff --git a/bundle/tests/scorecard/kuttl/routes/02-assert.yaml b/bundle/tests/scorecard/kuttl/routes/02-assert.yaml new file mode 100644 index 00000000..ddea1af7 --- /dev/null +++ b/bundle/tests/scorecard/kuttl/routes/02-assert.yaml @@ -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 diff --git a/bundle/tests/scorecard/kuttl/routes/02-errors.yaml b/bundle/tests/scorecard/kuttl/routes/02-errors.yaml new file mode 100644 index 00000000..5af9067f --- /dev/null +++ b/bundle/tests/scorecard/kuttl/routes/02-errors.yaml @@ -0,0 +1,9 @@ +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: route + annotations: + step: "02" +spec: + path: /mypath + diff --git a/bundle/tests/scorecard/kuttl/routes/02-remove-route-spec.yaml b/bundle/tests/scorecard/kuttl/routes/02-remove-route-spec.yaml new file mode 100644 index 00000000..1486c3ff --- /dev/null +++ b/bundle/tests/scorecard/kuttl/routes/02-remove-route-spec.yaml @@ -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: diff --git a/bundle/tests/scorecard/kuttl/routes/03-assert.yaml b/bundle/tests/scorecard/kuttl/routes/03-assert.yaml new file mode 100644 index 00000000..cb36302e --- /dev/null +++ b/bundle/tests/scorecard/kuttl/routes/03-assert.yaml @@ -0,0 +1,8 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: route +status: + replicas: 1 + readyReplicas: 1 + updatedReplicas: 1 diff --git a/bundle/tests/scorecard/kuttl/routes/01-delete-route.yaml b/bundle/tests/scorecard/kuttl/routes/03-delete-route.yaml similarity index 100% rename from bundle/tests/scorecard/kuttl/routes/01-delete-route.yaml rename to bundle/tests/scorecard/kuttl/routes/03-delete-route.yaml diff --git a/bundle/tests/scorecard/kuttl/routes/01-errors.yaml b/bundle/tests/scorecard/kuttl/routes/03-errors.yaml similarity index 100% rename from bundle/tests/scorecard/kuttl/routes/01-errors.yaml rename to bundle/tests/scorecard/kuttl/routes/03-errors.yaml diff --git a/utils/utils.go b/utils/utils.go index 8eea994c..e149d4f5 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -151,6 +151,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 } From 23023849e6447091fe762ae80f13c6ec0f88860b Mon Sep 17 00:00:00 2001 From: Leo Christy Jesuraj Date: Tue, 11 Apr 2023 18:01:09 -0400 Subject: [PATCH 3/3] Update 01-add-path.yaml --- bundle/tests/scorecard/kuttl/routes/01-add-path.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bundle/tests/scorecard/kuttl/routes/01-add-path.yaml b/bundle/tests/scorecard/kuttl/routes/01-add-path.yaml index 64274add..ab1e3f05 100644 --- a/bundle/tests/scorecard/kuttl/routes/01-add-path.yaml +++ b/bundle/tests/scorecard/kuttl/routes/01-add-path.yaml @@ -3,10 +3,6 @@ kind: RuntimeComponent metadata: name: route spec: - # Add fields here - applicationImage: k8s.gcr.io/pause:2.0 - replicas: 1 - expose: true route: host: myapp.mycompany.com path: /mypath