0

We can create a knative service which have two revisions, then we can config traffic like this.

 traffic:
  - latestRevision: false
    percent: 100
    revisionName: header-v1
  - latestRevision: false
    percent: 0
    revisionName: header-v2
    tag: v2

We can use header "Knative-Serving-Tag: v2" to route to header-v2 revision. However, we want to route to specific revision using custom header, like "User: v2". What should we do? We tried some method. First, we try to edit the corresponding virtualservice, but the new rules will be automatically deleted. Then, we try to add a new virtualservice.

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: header-custom-ingress
  namespace: default
spec:
  gateways:
  - knative-serving/knative-ingress-gateway
  hosts:
  - header-test.default.XXXXXXXXXXXXXXX.io
  http:
  - match:
    - headers:
        User:
          exact: v2
    retries: {}
    rewrite:
      authority: v2-header.default.XXXXXXXXXXXXXXX.io
    route:
    - destination:
        host: istio-ingressgateway.istio-system.svc.cluster.local
        port:
          number: 80
      weight: 100

Hosts cannot be the same as the previous one, otherwise it will not take effect. We don't want to change the host, we just want to route through the custom header. What would be the better way to do that? Thanks in advance.

julie
  • 43
  • 3

2 Answers2

0

I don't think Knative Serving doesn't support this in the way you wanted.

There's an open issue for this: https://github.com/knative/serving/issues/4736. There are some concerns there and no decision yet made.

What you make with the VirtualService is right configuration, but the VirtualService will be reconciled and your changes will be gone. So, that's not an option.

Ali Ok
  • 716
  • 1
  • 8
  • 23
  • Thanks, this is exactly what I want to ask. By the way, i have another question. Does knative support ARM architecture? – julie Aug 28 '20 at 08:28
  • If Kubernetes support ARM architecture, Knative would too. I personally have no knowledge about it though. – Ali Ok Aug 29 '20 at 20:00
0

Execute me. Have you ever got a solution to route based on custom headers?