You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/12/20 10:35:48 UTC

[GitHub] [pulsar] alpreu opened a new pull request, #19004: [improve][io] Debezium sources: Support loading config from secrets

alpreu opened a new pull request, #19004:
URL: https://github.com/apache/pulsar/pull/19004

   <!--
   ### Contribution Checklist
     
     - PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://docs.google.com/document/d/1d8Pw6ZbWk-_pCKdOmdvx9rnhPiyuxwq60_TrD68d7BA/edit#heading=h.trs9rsex3xom)*. 
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   -->
   
   
   ### Motivation
   
   Currently the Debezium sources don't support loading sensitive configuration from secrets. 
   
   ### Modifications
   
   Most sources can rely on `IOConfigUtils.loadWithSecrets` because they provide a specific Config class with `FieldDoc` annotations. The Debezium sources work differently because there is no specific Config class but rather just a Map with some basic validation that is passed to Debezium. Therefore we need to directly get the secrets from the `sourceContext`.
   
   Most of the Debezium sources rely on the same config properties (`database.user`, `database.password`) to configure the connector so I decided to move the secret-handling code into the abstract `DebeziumSource` class that all the individual connectors inherit from. There are exceptions to this, such as the MongoDB source, which uses another set of config properties (e.g. `mongodb.user` instead of `database.user`), these sources will have to call the secret-handling code by overriding the `open` method.
   
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   I would be open to adding a unit test as well, but I feel it does not add a lot of value because the sourceContext already has unit tests for this functionality.
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. Please attach the local preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR description, or else your PR might not get merged. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: https://github.com/alpreu/pulsar/pull/4
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi commented on pull request #19004: [improve][io] Debezium sources: Support loading config from secrets

Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on PR #19004:
URL: https://github.com/apache/pulsar/pull/19004#issuecomment-1361389234

   /pulsarbot rerun-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Technoboy- merged pull request #19004: [improve][io] Debezium sources: Support loading config from secrets

Posted by GitBox <gi...@apache.org>.
Technoboy- merged PR #19004:
URL: https://github.com/apache/pulsar/pull/19004


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] alpreu commented on a diff in pull request #19004: [improve][io] Debezium sources: Support loading config from secrets

Posted by GitBox <gi...@apache.org>.
alpreu commented on code in PR #19004:
URL: https://github.com/apache/pulsar/pull/19004#discussion_r1054386245


##########
pulsar-io/debezium/core/src/main/java/org/apache/pulsar/io/debezium/DebeziumSource.java:
##########
@@ -60,11 +62,24 @@ public static String topicNamespace(SourceContext sourceContext) {
                 + (StringUtils.isEmpty(namespace) ? TopicName.DEFAULT_NAMESPACE : namespace);
     }
 
+    public static void tryLoadingConfigSecret(String secretName, Map<String, Object> config, SourceContext context) {
+        try {
+            String secret = context.getSecret(secretName);
+            if (secret != null) {
+                config.put(secretName, secret);

Review Comment:
   Good point, added!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi commented on a diff in pull request #19004: [improve][io] Debezium sources: Support loading config from secrets

Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on code in PR #19004:
URL: https://github.com/apache/pulsar/pull/19004#discussion_r1054378260


##########
pulsar-io/debezium/core/src/main/java/org/apache/pulsar/io/debezium/DebeziumSource.java:
##########
@@ -60,11 +62,24 @@ public static String topicNamespace(SourceContext sourceContext) {
                 + (StringUtils.isEmpty(namespace) ? TopicName.DEFAULT_NAMESPACE : namespace);
     }
 
+    public static void tryLoadingConfigSecret(String secretName, Map<String, Object> config, SourceContext context) {
+        try {
+            String secret = context.getSecret(secretName);
+            if (secret != null) {
+                config.put(secretName, secret);
+            }
+        } catch (Exception e) {
+            log.warn("Failed to read secret {}", secretName);

Review Comment:
   print the exception ? 



##########
pulsar-io/debezium/core/src/main/java/org/apache/pulsar/io/debezium/DebeziumSource.java:
##########
@@ -60,11 +62,24 @@ public static String topicNamespace(SourceContext sourceContext) {
                 + (StringUtils.isEmpty(namespace) ? TopicName.DEFAULT_NAMESPACE : namespace);
     }
 
+    public static void tryLoadingConfigSecret(String secretName, Map<String, Object> config, SourceContext context) {
+        try {
+            String secret = context.getSecret(secretName);
+            if (secret != null) {
+                config.put(secretName, secret);

Review Comment:
   it's better to output that we've just overwritten the user config. This would also helps troubleshooting
   
   something like
   
   log.info("Config key {} set from secret", secretName)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] codecov-commenter commented on pull request #19004: [improve][io] Debezium sources: Support loading config from secrets

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #19004:
URL: https://github.com/apache/pulsar/pull/19004#issuecomment-1361473009

   # [Codecov](https://codecov.io/gh/apache/pulsar/pull/19004?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19004](https://codecov.io/gh/apache/pulsar/pull/19004?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9d5a50c) into [master](https://codecov.io/gh/apache/pulsar/commit/feb3cb4d7a484a284e06474713870609b220abfc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (feb3cb4) will **increase** coverage by `3.09%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/pulsar/pull/19004/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pulsar/pull/19004?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #19004      +/-   ##
   ============================================
   + Coverage     46.35%   49.45%   +3.09%     
   + Complexity     8939     7008    -1931     
   ============================================
     Files           597      394     -203     
     Lines         56858    42916   -13942     
     Branches       5905     4384    -1521     
   ============================================
   - Hits          26357    21224    -5133     
   + Misses        27616    19384    -8232     
   + Partials       2885     2308     -577     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | unittests | `49.45% <ø> (+3.09%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/pulsar/pull/19004?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../pulsar/broker/service/SharedConsumerAssignor.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL1NoYXJlZENvbnN1bWVyQXNzaWdub3IuamF2YQ==) | `3.70% <0.00%> (-64.82%)` | :arrow_down: |
   | [...apache/pulsar/broker/service/EntryAndMetadata.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL0VudHJ5QW5kTWV0YWRhdGEuamF2YQ==) | `0.00% <0.00%> (-40.75%)` | :arrow_down: |
   | [...lsar/broker/loadbalance/impl/ThresholdShedder.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9sb2FkYmFsYW5jZS9pbXBsL1RocmVzaG9sZFNoZWRkZXIuamF2YQ==) | `3.27% <0.00%> (-27.05%)` | :arrow_down: |
   | [...che/pulsar/broker/intercept/BrokerInterceptor.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9pbnRlcmNlcHQvQnJva2VySW50ZXJjZXB0b3IuamF2YQ==) | `0.00% <0.00%> (-13.05%)` | :arrow_down: |
   | [...tent/NonPersistentDispatcherMultipleConsumers.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL25vbnBlcnNpc3RlbnQvTm9uUGVyc2lzdGVudERpc3BhdGNoZXJNdWx0aXBsZUNvbnN1bWVycy5qYXZh) | `40.74% <0.00%> (-12.35%)` | :arrow_down: |
   | [...apache/pulsar/broker/service/TopicListService.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL1RvcGljTGlzdFNlcnZpY2UuamF2YQ==) | `40.80% <0.00%> (-12.00%)` | :arrow_down: |
   | [...sistent/PersistentDispatcherMultipleConsumers.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL3BlcnNpc3RlbnQvUGVyc2lzdGVudERpc3BhdGNoZXJNdWx0aXBsZUNvbnN1bWVycy5qYXZh) | `49.47% <0.00%> (-8.51%)` | :arrow_down: |
   | [...org/apache/pulsar/broker/loadbalance/LoadData.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9sb2FkYmFsYW5jZS9Mb2FkRGF0YS5qYXZh) | `58.33% <0.00%> (-8.34%)` | :arrow_down: |
   | [...ction/buffer/impl/TransactionBufferClientImpl.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci90cmFuc2FjdGlvbi9idWZmZXIvaW1wbC9UcmFuc2FjdGlvbkJ1ZmZlckNsaWVudEltcGwuamF2YQ==) | `76.74% <0.00%> (-4.66%)` | :arrow_down: |
   | [.../buffer/impl/TransactionBufferClientStatsImpl.java](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci90cmFuc2FjdGlvbi9idWZmZXIvaW1wbC9UcmFuc2FjdGlvbkJ1ZmZlckNsaWVudFN0YXRzSW1wbC5qYXZh) | `82.00% <0.00%> (-4.00%)` | :arrow_down: |
   | ... and [250 more](https://codecov.io/gh/apache/pulsar/pull/19004/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org