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 to set https as the default scheme #8729

Merged
merged 3 commits into from
May 24, 2022

Conversation

klsince
Copy link
Contributor

@klsince klsince commented May 18, 2022

This PR adds a switch to set 'https' as the default scheme for Swagger UI, so that in TLS enabled env, requests issued from Swagger UI will use https automatically.

Release notes

New configs are added for each Pinot component and followed the existing naming convention. By default, http is used as before.

  • controller.swagger.use.https
  • pinot.broker.swagger.use.https
  • pinot.server.swagger.use.https
  • pinot.minion.swagger.use.https

@codecov-commenter
Copy link

codecov-commenter commented May 18, 2022

Codecov Report

Merging #8729 (4a808cd) into master (1b3819e) will increase coverage by 0.08%.
The diff coverage is 47.05%.

@@             Coverage Diff              @@
##             master    #8729      +/-   ##
============================================
+ Coverage     69.66%   69.74%   +0.08%     
+ Complexity     4616     4614       -2     
============================================
  Files          1730     1730              
  Lines         90341    90325      -16     
  Branches      13442    13425      -17     
============================================
+ Hits          62932    63001      +69     
+ Misses        23045    22954      -91     
- Partials       4364     4370       +6     
Flag Coverage Δ
integration1 26.96% <47.05%> (+0.09%) ⬆️
integration2 25.26% <47.05%> (+0.03%) ⬆️
unittests1 66.21% <ø> (-0.03%) ⬇️
unittests2 14.27% <33.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...va/org/apache/pinot/controller/ControllerConf.java 57.31% <ø> (ø)
...va/org/apache/pinot/spi/utils/CommonConstants.java 21.31% <ø> (ø)
...inot/server/starter/helix/AdminApiApplication.java 85.00% <40.00%> (-2.94%) ⬇️
...pinot/broker/broker/BrokerAdminApiApplication.java 89.36% <50.00%> (-3.83%) ⬇️
.../controller/api/ControllerAdminApiApplication.java 87.09% <50.00%> (-2.74%) ⬇️
...apache/pinot/minion/MinionAdminApiApplication.java 87.50% <50.00%> (-4.40%) ⬇️
...ache/pinot/core/operator/docidsets/OrDocIdSet.java 86.36% <0.00%> (-11.37%) ⬇️
.../common/request/context/predicate/EqPredicate.java 92.30% <0.00%> (-7.70%) ⬇️
.../common/request/context/predicate/InPredicate.java 88.88% <0.00%> (-5.56%) ⬇️
...mmon/request/context/predicate/NotInPredicate.java 88.88% <0.00%> (-5.56%) ⬇️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b3819e...4a808cd. Read the comment docs.

@Jackie-Jiang Jackie-Jiang added the release-notes Referenced by PRs that need attention when compiling the next release notes label May 18, 2022
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making it more explicit (as boolean)?

  • controller.swagger.use.https
  • pinot.broker.swagger.use.https
  • pinot.server.swagger.use.https
  • pinot.minion.swagger.use.https

@@ -89,7 +91,11 @@ private void setupSwagger() {
beanConfig.setDescription("APIs for accessing Pinot broker information");
beanConfig.setContact("https://github.com/apache/pinot");
beanConfig.setVersion("1.0");
beanConfig.setSchemes(new String[]{CommonConstants.HTTP_PROTOCOL, CommonConstants.HTTPS_PROTOCOL});
if (CommonConstants.HTTPS_PROTOCOL.equalsIgnoreCase(_swaggerDefaultProtocol)) {
beanConfig.setSchemes(new String[]{CommonConstants.HTTPS_PROTOCOL, CommonConstants.HTTP_PROTOCOL});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we still set HTTP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, still needed at least for those quickstart examples, and perhaps for users not enabling TLS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, got your point. Taking the new configs suggested by you above, we ca save http here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... on a second thought, I'd prefer to leave http there, in case someone wants to debug issues like when TLS doesn't work and he/she wants to switch to http for some quick checks.

@@ -63,6 +63,7 @@ public class ControllerConf extends PinotConfiguration {
public static final String HELIX_CLUSTER_NAME = "controller.helix.cluster.name";
public static final String CLUSTER_TENANT_ISOLATION_ENABLE = "cluster.tenant.isolation.enable";
public static final String CONSOLE_WEBAPP_ROOT_PATH = "controller.query.console";
public static final String CONSOLE_WEBAPP_DEFAULT_PROTOCOL = "controller.query.console.default.protocol";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is controller key different from others? I don't think it applies to the query console

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is some legacy naming convention, so I just kept it for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I'll take your controller.swagger.use.https

@Jackie-Jiang Jackie-Jiang merged commit 1c3a215 into apache:master May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Referenced by PRs that need attention when compiling the next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants