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

Allow HTTP->HTTPS redirection on Istio Gateway #1888

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

penguinush
Copy link

Extends #1482.

One of the ServerTLSSettings on Istio Gatway is httpsRedirect that, according to docs, redirects HTTP traffic to HTTPS. Usually this is a desired behaviour for production setup, the only alternative would be to not create HTTP listener at all.

PR leverages combination of nullable property and oneOf with required fields - this works fine currently as there is 2 distinct options (mode: <>, which requires credentialName to be set, or httpsRedirect, which is mutually exclusive with every other option), but it might become cumbersome if more options of different combinations are added.

Tested with the following specs:

spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - '*.example.com'
    port:
      name: http
      number: 80
      protocol: HTTP
    tls:
      httpsRedirect: true
  - hosts:
    - '*.example.com'
    port:
      name: https-production
      number: 443
      protocol: https
    tls:
      credentialName: example-tls
      mode: SIMPLE

and

spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - '*.example.com'
    port:
      name: http
      number: 80
      protocol: HTTP
  - hosts:
    - '*.example.com'
    port:
      name: https-production
      number: 443
      protocol: https
    tls:
      credentialName: example-tls
      mode: SIMPLE

Both produce correct Gateways.

Kubernetes 1.30 (EKS), Knative Operator 1.15.4, Knative Serving 1.15.0, Istio 1.23.0.

Proposed Changes

  • Allows HTTP listener on Istio Gateway to be configured with automatic HTTP->HTTPS redirection.

Release Note

feature: Istio Gateway can be configured with automatic HTTP->HTTPS redirection

Copy link

linux-foundation-easycla bot commented Sep 19, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: penguinush / name: Constantine (a194e47)

@knative-prow knative-prow bot requested a review from aliok September 19, 2024 10:28
Copy link

knative-prow bot commented Sep 19, 2024

Welcome @penguinush! It looks like this is your first PR to knative/operator 🎉

Copy link

knative-prow bot commented Sep 19, 2024

Hi @penguinush. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow bot requested a review from matzew September 19, 2024 10:28
@knative-prow knative-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 19, 2024
Copy link

knative-prow bot commented Sep 19, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: penguinush
Once this PR has been reviewed and has the lgtm label, please assign psschwei for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.31%. Comparing base (5e034b0) to head (a194e47).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1888   +/-   ##
=======================================
  Coverage   66.31%   66.31%           
=======================================
  Files          53       53           
  Lines        2084     2084           
=======================================
  Hits         1382     1382           
  Misses        587      587           
  Partials      115      115           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@houshengbo houshengbo added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 24, 2024
@penguinush penguinush force-pushed the feature/istio-gateway-https-redirect branch from 78cd953 to a194e47 Compare September 25, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants