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

duplicate ingress.InsertProbe in same hosts and probe path isn't /healthz #848

Closed
wu0407 opened this issue Jan 14, 2022 · 4 comments
Closed
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@wu0407
Copy link

wu0407 commented Jan 14, 2022

Net-istio probe ingress is health by request each host path /healthz and with headers "User-Agent: Knative-Ingress-Probe" "K-Network-Hash: override" "K-Network-Probe: probe". But ingress.InsertProbe is only copy the origin path and not duplicate host.
Each host set and each backend, only need set one probe istio HTTPMatchRequest.

situation:

  1. one host and multi paths and each path has multi backends
  2. multi hosts and multi path and each path has one backend

I think probe ingress should base on the backend and host.

knative version: v1.1.0
net-istio version: v1.1.0

case duplicate probe rule:

1. create knative ingress

apiVersion: networking.internal.knative.dev/v1alpha1
kind: Ingress
metadata:
  annotations:
    networking.knative.dev/ingress.class: istio.ingress.networking.knative.dev
  name: url-1
  namespace: default
spec:
  httpOption: Enabled
  rules:
  - hosts:
    - url.com
    http:
      paths:
      - headers:
          abc:
            exact: abc
          version:
            exact: canary
        path: /url-1
        splits:
        - appendHeaders:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00006
          percent: 100
          serviceName: example-nginx-00006
          serviceNamespace: default
          servicePort: 80
      - headers:
          acd:
            exact: acd
          edfc:
            exact: edfc
        splits:
        - appendHeaders:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00005
          percent: 100
          serviceName: example-nginx-00005
          serviceNamespace: default
          servicePort: 80
    visibility: ExternalIP

2. generated virtualservice

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  annotations:
    networking.knative.dev/ingress.class: istio.ingress.networking.knative.dev
  creationTimestamp: "2022-01-12T09:15:03Z"
  generation: 70
  labels:
    networking.internal.knative.dev/ingress: url-1
  name: url-1-ingress
  namespace: default
  ownerReferences:
  - apiVersion: networking.internal.knative.dev/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: Ingress
    name: url-1
    uid: b731f15b-6e9d-421c-86d0-078957f62dfe
  resourceVersion: "398305697"
  selfLink: /apis/networking.istio.io/v1beta1/namespaces/default/virtualservices/url-1-ingress
  uid: f5acca7f-44f5-4f74-a6e5-ffb501e4b9c5
spec:
  gateways:
  - knative/knative-ingress-gateway
  hosts:
  - url.com
  http:
  - headers:
      request:
        set:
          K-Network-Hash: 905736950394f47c3cc89e3eaaf854fae3cc357ddedd5fbfc6f50f06cf66c7aa
    match:
    - authority:
        prefix: url.com
      gateways:
      - knative/knative-ingress-gateway
      headers:
        K-Network-Hash:
          exact: override
      uri:
        prefix: /url-1
    retries: {}
    route:
    - destination:
        host: example-nginx-00006.default.svc.cluster.local
        port:
          number: 80
      headers:
        request:
          set:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00006
      weight: 100
  - headers:
      request:
        set:
          K-Network-Hash: 905736950394f47c3cc89e3eaaf854fae3cc357ddedd5fbfc6f50f06cf66c7aa
    match:
    - authority:
        prefix: url.com
      gateways:
      - knative/knative-ingress-gateway
      headers:
        K-Network-Hash:
          exact: override
    retries: {}
    route:
    - destination:
        host: example-nginx-00005.default.svc.cluster.local
        port:
          number: 80
      headers:
        request:
          set:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00005
      weight: 100
  - match:
    - authority:
        prefix: url.com
      gateways:
      - knative/knative-ingress-gateway
      headers:
        version:
          exact: canary
      uri:
        prefix: /url-1
    retries: {}
    route:
    - destination:
        host: example-nginx-00006.default.svc.cluster.local
        port:
          number: 80
      headers:
        request:
          set:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00006
      weight: 100
  - match:
    - authority:
        prefix: url.com
      gateways:
      - knative/knative-ingress-gateway
      headers:
        edfc:
          exact: edfc
    retries: {}
    route:
    - destination:
        host: example-nginx-00005.default.svc.cluster.local
        port:
          number: 80
      headers:
        request:
          set:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00005
      weight: 10

case probe path incorrect

  1. create knative ingress
metadata:
  annotations:
    networking.knative.dev/ingress.class: istio.ingress.networking.knative.dev
  name: url-1
spec:
  httpOption: Enabled
  rules:
  - hosts:
    - url.com
    http:
      paths:
      - headers:
          version:
            exact: canary
          abc:
            exact: abc
        path: "/url-1"
        splits:
        - appendHeaders:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00006
          percent: 100
          serviceName: example-nginx-00006
          serviceNamespace: default
          servicePort: 80
  1. virtureservice
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"networking.internal.knative.dev/v1alpha1","kind":"Ingress","metadata":{"annotations":{"networking.knative.dev/ingress.class":"istio.ingress.networking.knative.dev"},"name":"url-1","namespace":"default"},"spec":{"httpOption":"Enabled","rules":[{"hosts":["url.com"],"http":{"paths":[{"headers":{"abc":{"exact":"abc"},"version":{"exact":"canary"}},"path":"/url-1","splits":[{"appendHeaders":{"Knative-Serving-Namespace":"default","Knative-Serving-Revision":"example-nginx-00006"},"percent":100,"serviceName":"example-nginx-00006","serviceNamespace":"default","servicePort":80}]}]},"visibility":"ExternalIP"}]}}
    networking.knative.dev/ingress.class: istio.ingress.networking.knative.dev
  creationTimestamp: "2022-01-15T10:35:46Z"
  generation: 1
  labels:
    networking.internal.knative.dev/ingress: url-1
  name: url-1-ingress
  namespace: default
  ownerReferences:
  - apiVersion: networking.internal.knative.dev/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: Ingress
    name: url-1
    uid: 0a1f2e17-cacf-4656-8b75-8f3df9296372
  resourceVersion: "399816649"
  selfLink: /apis/networking.istio.io/v1beta1/namespaces/default/virtualservices/url-1-ingress
  uid: 58d750d0-150a-4baa-8100-030e7c8bd40c
spec:
  gateways:
  - knative/knative-ingress-gateway
  hosts:
  - url.com
  http:
  - headers:
      request:
        set:
          K-Network-Hash: 1eb7ef10f7c01124526d9c594a088852b7146b167a1641af4b62eb3278e2ff59
    match:
    - authority:
        prefix: url.com
      gateways:
      - knative/knative-ingress-gateway
      headers:
        K-Network-Hash:
          exact: override
      uri:
        prefix: /url-1
    retries: {}
    route:
    - destination:
        host: example-nginx-00006.default.svc.cluster.local
        port:
          number: 80
      headers:
        request:
          set:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00006
      weight: 100
  - match:
    - authority:
        prefix: url.com
      gateways:
      - knative/knative-ingress-gateway
      headers:
        version:
          exact: canary
      uri:
        prefix: /url-1
    retries: {}
    route:
    - destination:
        host: example-nginx-00006.default.svc.cluster.local
        port:
          number: 80
      headers:
        request:
          set:
            Knative-Serving-Namespace: default
            Knative-Serving-Revision: example-nginx-00006
      weight: 100
  1. net-istio logs
{"severity":"ERROR","timestamp":"2022-01-15T14:29:39.001894423Z","logger":"net-istio-controller.istio-ingress-controller","caller":"status/status.go:403","message":"Probing of http://url.com:80 failed, IP: 10.253.4.36:8080, ready: false, error: unexpected status code: want 200, got 404 (depth: 0)","commit":"c9e88c5","knative.dev/controller":"istio-ingress-controller","knative.dev/controller":"knative.dev.net-istio.pkg.reconciler.ingress.Reconciler","knative.dev/kind":"networking.internal.knative.dev.Ingress","knative.dev/traceid":"079f07f3-6a69-4206-9cae-8d76a0439cba","knative.dev/key":"default/url-1","stacktrace":"knative.dev/networking/pkg/status.(*Prober).processWorkItem\n\tknative.dev/networking@v0.0.0-20211209101835-8ef631418fc0/pkg/status/status.go:403\nknative.dev/networking/pkg/status.(*Prober).Start.func1\n\tknative.dev/networking@v0.0.0-20211209101835-8ef631418fc0/pkg/status/status.go:288"}
@wu0407
Copy link
Author

wu0407 commented Jan 15, 2022

my target is use net-istio to support path based routing and header based routing. But not logic is not deployed in current net-istio.
knative/serving#11997

@nak3
Copy link
Contributor

nak3 commented Jan 17, 2022

Hi @wu0407

my target is use net-istio to support path based routing and header based routing.

Sorry if you have already checked, but have you already checked the following docs? These doc might help your requirement.
https://github.com/knative/docs/tree/main/code-samples/serving/tag-header-based-routing (tag header based routing)
https://github.com/knative/docs/tree/main/code-samples/serving/knative-routing-go (path based routing by using front VirtualService.)

@wu0407
Copy link
Author

wu0407 commented Jan 18, 2022

yes, I known that method to support this function. but it is not beautiful and native.
Proposal support path based routing and header based routing when knative object Dispatcher is achieved.

@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

2 participants