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

Conversation

penguinush
Copy link
Contributor

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 (7280323)

@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

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.49%. Comparing base (6dce5ef) to head (7280323).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1888      +/-   ##
==========================================
+ Coverage   66.31%   66.49%   +0.17%     
==========================================
  Files          53       54       +1     
  Lines        2084     2107      +23     
==========================================
+ Hits         1382     1401      +19     
- Misses        587      589       +2     
- Partials      115      117       +2     

☔ 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
@houshengbo
Copy link
Contributor

@penguinush could you rebase this pr?

@penguinush penguinush force-pushed the feature/istio-gateway-https-redirect branch from a194e47 to 7280323 Compare October 4, 2024 06:23
@houshengbo
Copy link
Contributor

/test all

@houshengbo
Copy link
Contributor

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Oct 14, 2024
Copy link

knative-prow bot commented Oct 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: houshengbo, penguinush

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

The pull request process is described 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

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 14, 2024
@houshengbo
Copy link
Contributor

Please check this PR: #1912

@houshengbo houshengbo closed this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. 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