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

feat: modifed kafka to use config received from config-be. #3205

Merged
merged 10 commits into from
May 5, 2023

Conversation

saurav-malani
Copy link
Contributor

Description

Modified kafka to get ssh config from config-BE in addition to from env.
NOTE: getting config via env has to be deprecated in future.

Notion Ticket

https://www.notion.so/rudderstacks/Kafka-with-SSH-control-plane-config-8a25b92171464903a2a5db9e40645290?pvs=4

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@saurav-malani saurav-malani changed the title feat: modifed kafka to use config received from config-be in place of env feat: modifed kafka to use config received from config-be. Apr 13, 2023
@saurav-malani saurav-malani marked this pull request as draft April 13, 2023 07:58
@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Patch coverage: 79.72% and project coverage change: -0.06 ⚠️

Comparison is base (a4f3b56) 51.95% compared to head (fe30de0) 51.90%.

❗ Current head fe30de0 differs from pull request most recent head a8a3d5a. Consider uploading reports for the commit a8a3d5a to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3205      +/-   ##
==========================================
- Coverage   51.95%   51.90%   -0.06%     
==========================================
  Files         321      322       +1     
  Lines       53194    53425     +231     
==========================================
+ Hits        27639    27732      +93     
- Misses      23910    24036     +126     
- Partials     1645     1657      +12     
Impacted Files Coverage Δ
services/streammanager/kafka/client/config.go 60.27% <ø> (ø)
services/controlplane/client.go 82.09% <62.50%> (-3.41%) ⬇️
services/streammanager/kafka/kafkamanager.go 76.67% <86.95%> (+0.90%) ⬆️
services/streammanager/kafka/client/client.go 83.33% <100.00%> (-0.20%) ⬇️

... and 27 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@saurav-malani saurav-malani marked this pull request as ready for review April 19, 2023 12:54
require.NoError(t, err)
require.Equal(t, controlplane.SSHKeyPair{
PrivateKey: "test-private-key",
PublicKey: "test-public-key",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@saurav-malani the public key was not being tested, I added it now.

@@ -342,3 +343,61 @@ func TestRetriesTimeout(t *testing.T) {
})
}
}

func TestGetDestinationSSHKeyPair(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@saurav-malani I converted some test checks to make use of require for a more succint test.

@@ -357,18 +366,6 @@ func NewProducer(destination *backendconfig.DestinationT, o common.Opts) (*Produ
return nil, fmt.Errorf("[Kafka] invalid SASL type: %w", err)
}
}

if destConfig.UseSSH {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@saurav-malani I moved the SSH block out of the if destConfig.SslEnabled { condition like it was before.

User: conf.SSHConfig.User,
Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)},
Timeout: conf.DialTimeout,
HostKeyCallback: ssh.InsecureIgnoreHostKey(), // skipcq: GSC-G106
Copy link
Collaborator

Choose a reason for hiding this comment

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

@saurav-malani as discussed over standup this is an important change I introduced (cc @lvrach) and it's going to apply to all SSH connections for kafka destinations.

@fracasula
Copy link
Collaborator

Let's not merge this one until we have the chance to do some proper manual end to end testing on dev.

Copy link
Collaborator

@fracasula fracasula left a comment

Choose a reason for hiding this comment

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

@saurav-malani can you please revert the changes you made after the approvals? It looks like the SSH configuration is again read only if SSL is enabled which is a bug I had already fixed. As discussed yesterday the embedding of the Avro schema ID should be done in a separate PR. I suggest you just drop the recent commits and leave this PR as it was right after the 2 approvals and open another one with just the embedding.

NOTE: See this comment from last week.

Copy link
Collaborator

@fracasula fracasula left a comment

Choose a reason for hiding this comment

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

@saurav-malani I forced push a local copy that I had of the branch before you forced pushed the commits I did. Please leave these changes as they are, we just need to test them. If you need to test other things I suggest you start from this branch and push a copy of it e.g. feat.kafkaOverSshViaCP-test.

@fracasula
Copy link
Collaborator

@saurav-malani I'll resolve the conflicts, don't worry 👍

@fracasula fracasula merged commit 0d1c75f into master May 5, 2023
16 checks passed
@fracasula fracasula deleted the feat.kafkaOverSshViaCP branch May 5, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants