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

HTTP Policy/behaviour is not supported by KSVC #772

Closed
RamyChaabane opened this issue Feb 16, 2022 · 6 comments
Closed

HTTP Policy/behaviour is not supported by KSVC #772

RamyChaabane opened this issue Feb 16, 2022 · 6 comments

Comments

@RamyChaabane
Copy link
Contributor

Hello

I want to change the default behaviour of HTTP traffic from "enabled" to whether "redirected" or "disabled".

According to knative documentation , we can do that in different ways:

  • Global by editing config-network configmap
  • Per service by adding networking.knative.dev/http-protocol: "<option>" annotation

Also There is an inconsistency between this doc and this thread as "disabled" option is not mentioned in the first doc

When testing with Kourier, I noticed that only Global setup is supported

Do you confirm that this is a bug?
I can open a PR if necessary

Thank you!

@nak3
Copy link
Contributor

nak3 commented Feb 16, 2022

Hi @RamyChaabane

Also There is an inconsistency between this doc and this thread as "disabled" option is not mentioned in the first doc

We have an on-going discussion in knative/networking#417. If you want to have a disable option support, could you please comment your use-case on knative/networking#417?

When testing with Kourier, I noticed that only Global setup is supported

Do you mean that the annotation did not work? What values are set in the httpOption of Kingress? Please check it in your Kingress like:

$ kubectl get king -o yaml
 ...
  spec:
    httpOption: Enabled

Kourier does not support disabled but redirect option should work.

@RamyChaabane
Copy link
Contributor Author

RamyChaabane commented Feb 16, 2022

Hello @nak3
Exactly! the annotation did not work, and httpOption equals to Enabled with or without annotation and I think that's why it's not working, as here we don't check the annotation

# netkubectl describe king  pproxmigddnsuxyb-toto

Name:         pproxmigddnsuxyb-toto
...
Annotations:  networking.internal.knative.dev/rollout:
                {"configurations":[{"configurationName":"pproxmigddnsuxyb-toto","percent":100,"revisions":[{"revisionName":"pproxmigddnsuxyb-toto-00002","...
              networking.knative.dev/disableAutoTLS: false
              networking.knative.dev/http-protocol: redirected
              networking.knative.dev/ingress.class: kourier.ingress.networking.knative.dev
...
Spec:
  Http Option:  Enabled
  Rules:
    Hosts:
      ...

However, I've just tested with this annotation networking.knative.dev/httpOption: redirected and it works as the value of http Option changed to Redirected in the ingress

# netkubectl describe king  pproxmigddnsuxyb-toto

Name:         pproxmigddnsuxyb-toto
...
Annotations:  networking.internal.knative.dev/rollout:
                {"configurations":[{"configurationName":"pproxmigddnsuxyb-toto","percent":100,"revisions":[{"revisionName":"pproxmigddnsuxyb-toto-00002","...
              networking.knative.dev/disableAutoTLS: false
              networking.knative.dev/httpOption: redirected
              networking.knative.dev/ingress.class: kourier.ingress.networking.knative.dev
...
Spec:
  Http Option:  Redirected
  Rules:
    Hosts:
      ...

@nak3
Copy link
Contributor

nak3 commented Feb 16, 2022

Hmm... Strange. http-protocol works fine on my local.

$ kubectl annotate ksvc hello-example networking.knative.dev/http-protocol=redirected --overwrite
service.serving.knative.dev/hello-example annotated

$ kubectl get king -o template={{.spec.httpOption}} hello-example 
Redirected

$ kubectl annotate ksvc hello-example networking.knative.dev/http-protocol=enabled --overwrite
service.serving.knative.dev/hello-example annotated

$ kubectl get king -o template={{.spec.httpOption}} hello-example 
Enabled

The translation from annotation to spec.httpOption is implemented in serving https://github.com/knative/serving/blob/main/pkg/reconciler/route/resources/ingress.go#L207-L231. So if you can still produce the issue, could you please open an issue report in serving repo?

@RamyChaabane
Copy link
Contributor Author

RamyChaabane commented Feb 16, 2022

Maybe it's a knative/net-kourier version related issue 🤔
What version of knative/net-kourier are you using? I'm using v1.0.1 for both
here is the code in v1.0; https://github.com/knative/serving/blob/release-1.0/pkg/reconciler/route/resources/ingress.go#L210

@nak3
Copy link
Contributor

nak3 commented Feb 16, 2022

Ah, yes. You are correct. v1.0 does not support http-protocol.
If you are using an old version, you might want to refer to the v1.0 docs as https://knative.dev/v1.0-docs/serving/services/http-option/#overriding-the-default-http-behavior
I would like you to use the newest version, though 😅

@RamyChaabane
Copy link
Contributor Author

Yes my bad
I'll test it with the newest version ASAP
I'm closing the issue for now, and I will reopen it if I can still reproduce the problem with a recent version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants