-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Filebeat] Add pubsub_alternative_host to gcp pubsub input #23215
Conversation
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
return nil, fmt.Errorf("grpc.Dial: %v", err) | ||
} | ||
opts = append(opts, option.WithGRPCConn(conn), option.WithTelemetryDisabled()) | ||
} else if in.CredentialsFile != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PubsubAlternativeHost and Credentials* options are not mutually exclusive, right?
} else if in.CredentialsFile != "" { | |
} | |
if in.CredentialsFile != "" { |
@@ -36,6 +36,8 @@ type config struct { | |||
|
|||
// JSON blob containing authentication credentials and key. | |||
CredentialsJSON []byte `config:"credentials_json"` | |||
|
|||
PubsubAlternativeHost string `config:"pubsub_alternative_host"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm debating about the pubsub
prefix. I thinking to remove it since the package is called pubsub and the in config it will be part of the gcp-pubsub input.
PubsubAlternativeHost string `config:"pubsub_alternative_host"` | |
// Overrides the default Pub/Sub service address and disables TLS. For testing. | |
AlternativeHost string `config:"alternative_host"` |
// this will be typically set because we want to point the input to a testing pubsub emulator | ||
conn, err := grpc.Dial(in.PubsubAlternativeHost, grpc.WithInsecure()) | ||
if err != nil { | ||
return nil, fmt.Errorf("grpc.Dial: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("grpc.Dial: %v", err) | |
return nil, fmt.Errorf("grpc.Dial: %w", err) |
fa06828
to
6b36a30
Compare
"google.golang.org/grpc" | ||
|
||
"cloud.google.com/go/pubsub" | ||
"github.com/pkg/errors" | ||
"google.golang.org/api/option" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"google.golang.org/grpc" | |
"cloud.google.com/go/pubsub" | |
"github.com/pkg/errors" | |
"google.golang.org/api/option" | |
"cloud.google.com/go/pubsub" | |
"github.com/pkg/errors" | |
"google.golang.org/api/option" | |
"google.golang.org/grpc" |
// this will be typically set because we want to point the input to a testing pubsub emulator | ||
conn, err := grpc.Dial(in.AlternativeHost, grpc.WithInsecure()) | ||
if err != nil { | ||
return nil, fmt.Errorf("grpc.Dial: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this error more descriptive? "cannot connect to alternative_host" or similar
dc20b57
to
7a947e3
Compare
7a947e3
to
5e9b674
Compare
What does this PR do?
Adds an option to set a custom pubsub alternative host to pubsub input.
Why is it important?
To be able to start the input using the GCP Pubsub emulator we needed a way to configure it to point to our testing host and bypass credential initialization.
Checklist
- [ ] I have made corresponding changes to the documentation(we do not want to document that as it is intended for testing)- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.