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

Matcher v2 init #541

Merged
merged 2 commits into from
Sep 5, 2024
Merged

Matcher v2 init #541

merged 2 commits into from
Sep 5, 2024

Conversation

maurafortino
Copy link
Contributor

What's Included:

  • added MatcherV2 for kafka (would like to refactor the Matchers though as noted previously)
  • fixed a couple of formatting issues
  • added logger to the kafka struct as it was causing a panic

Copy link

guardrails bot commented Sep 5, 2024

⚠️ We detected 3 security issues in this pull request:

Hard-Coded Secrets (1)
Severity Details Docs
Medium Title: Secret Keyword
secret := "placeholderSecret"
📚

More info on how to fix Hard-Coded Secrets in General.


Insecure Network Communication (1)
Severity Details Docs
Medium Title: Insecure SSL/TLS versions allowed
TLSClientConfig: &tls.Config{InsecureSkipVerify: config.DisableClientHostnameValidation},
📚

More info on how to fix Insecure Network Communication in Go.


Vulnerable Libraries (1)
Severity Details
Medium pkg:golang/github.com/aws/[email protected] - no patch available

More info on how to fix Vulnerable Libraries in Go.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

@maurafortino maurafortino changed the base branch from main to denopink/feat/rewrite September 5, 2024 15:52
}

// TODO: this is a big reason why I want to refactor the Matcher logic
func (m2 *MatcherV2) getUrls() (urls *ring.Ring) {
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 don't believe MatcherV2 is going to need getUrls - in my refactored branch i move the urls to the matcher to get rid of this function which is also called here:

urls = s.matcher.getUrls()
and why I originally had getUrls a part of the interface


config.Producer.Return.Successes = true
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 added back in the default config because it kept failing due to certain fields not being set. i'm setting these fields this way based on a tutorial I found: https://youtu.be/j6bqJKxb2w0?si=-htt-I0kgF8RqHMy&t=1384

// Create a new Kafka producer
producer, err := sarama.NewSyncProducer(kafka.brokerAddr, config)
if err != nil {
kafka.logger.Error("Could not create Kafka producer", zap.Error(err))
return nil
}
defer producer.Close()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -68,31 +67,32 @@ func NewSink(c Config, logger *zap.Logger, listener ancla.Register) Sink {
kafka := &Kafka{
id: l.Registration.CanonicalName,
brokerAddr: k.BootstrapServers,
topic: "test",
topic: "quickstart-events",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is based off the kafka docs for testing locally... i imagine we will be including topic as a part of the kafka webhook struct that users will be sending us?

Copy link
Contributor

Choose a reason for hiding this comment

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

yup

Copy link
Contributor

@denopink denopink left a comment

Choose a reason for hiding this comment

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

from the title it sounds like this is just laying out the ground work and it's not the final version of matcher v2.

in that case, lgtm!

@maurafortino maurafortino merged commit 06d3a4e into denopink/feat/rewrite Sep 5, 2024
4 of 5 checks passed
@maurafortino maurafortino deleted the MatcherV2-init branch September 5, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants