knctl icon indicating copy to clipboard operation
knctl copied to clipboard

Add support for custom routing

Open drnic opened this issue 5 years ago • 5 comments

Knative/Istio supports custom host/path routing:

  • https://github.com/knative/docs/tree/master/serving/samples/knative-routing-go
  • https://github.com/knative/docs/blob/master/serving/samples/knative-routing-go/routing.yaml

Would be lovely for this to be nicely handled by knctl.

drnic avatar Oct 16 '18 03:10 drnic

WIP, I tried adding simple.knative.starkandwayne.com to the existing virtualservice but a) the route never worked; and b) within a few seconds knative re-wrote the virtualservice to remove my appended /spec/hosts item.

kubectl patch virtualservices.networking.istio.io -n my-simple-app --type json --patch '[{"op": "add", "path": "/spec/hosts/-", "value": "simple.knative.starkandwayne.com"}]' simple-app

drnic avatar Oct 16 '18 07:10 drnic

Sweet, the following worked:

---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: simple-app-entry-route
  namespace: my-simple-app
spec:
  gateways:
  - knative-shared-gateway.knative-serving.svc.cluster.local
  hosts:
  - simple.knative.starkandwayne.com
  http:
  - match:
    - uri:
        prefix: "/"
    rewrite:
      authority: simple-app.my-simple-app.svc.cluster.local
    route:
    - destination:
        host: knative-ingressgateway.istio-system.svc.cluster.local
      weight: 100
$ curl simple-app.my-simple-app.knative.starkandwayne.com
<h1>Built from Git repo using Buildpack template</h1>
$ curl simple.knative.starkandwayne.com
<h1>Built from Git repo using Buildpack template</h1>

drnic avatar Oct 16 '18 07:10 drnic

Draft blog post which sets up two routes to two apps https://starkandwayne.com/blog/p/8a1e05ef-b2f8-4ac3-93cd-d2421ddddeca/ (will be published in a couple weeks)

drnic avatar Oct 18 '18 01:10 drnic

very nice! one concern i have is how to make sure istio doesnt creep in too much into knctl since knative community is in the midst of making routing (istio) pluggable.

cppforlife avatar Oct 22 '18 17:10 cppforlife

i am marking this feature request as blocked on public api from knative.

cppforlife avatar Nov 14 '18 19:11 cppforlife