-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[component/functions|component/go] Propagate user-config parameter into instances of Golang pulsar functions #8132
[component/functions|component/go] Propagate user-config parameter into instances of Golang pulsar functions #8132
Conversation
354ed6a
to
0b91888
Compare
@@ -72,8 +73,8 @@ func newInstanceConf() *instanceConf { | |||
SubscriptionType: pb.SubscriptionType(cfg.SubscriptionType), | |||
InputSpecs: map[string]*pb.ConsumerSpec{ | |||
cfg.SourceSpecTopic: { | |||
SchemaType: cfg.SourceSchemaType, | |||
IsRegexPattern: cfg.IsRegexPatternSubscription, | |||
SchemaType: "", |
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.
Why do you change the SchemaType
to an empty string?
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.
Good catch, I might've overlooked after some testing.
I'll revert that.
SchemaType: cfg.SourceSchemaType, | ||
IsRegexPattern: cfg.IsRegexPatternSubscription, | ||
SchemaType: "", | ||
IsRegexPattern: false, |
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.
Why do you change this to false
?
@sijie Addressed both comments. |
…to instances of Golang pulsar functions (apache#8132) ### Motivation Currently, pulsar functions written in Golang have no access to the content of the user-config parameter from admin CLI. That's the simplest way to pass custom configuration into a go function right now because neither secretsMap nor Kubernetes runtime is available for Golang functions yet. **Note**: For the `secretsMap` parameter, the same technique can be used, but this has to be addressed in a separate PR. ### Modifications - Added `String GoInstanceConfig#userConfig` attribute - Propagated user-config parameter in `RuntimeUtils.getGoInstanceCmd` - Exposed userConfig in `pulsar-function-go` and made it available in the `FunctionContext` - Add unit tests for the affected code
depends by #8268 |
…to instances of Golang pulsar functions (#8132) ### Motivation Currently, pulsar functions written in Golang have no access to the content of the user-config parameter from admin CLI. That's the simplest way to pass custom configuration into a go function right now because neither secretsMap nor Kubernetes runtime is available for Golang functions yet. **Note**: For the `secretsMap` parameter, the same technique can be used, but this has to be addressed in a separate PR. ### Modifications - Added `String GoInstanceConfig#userConfig` attribute - Propagated user-config parameter in `RuntimeUtils.getGoInstanceCmd` - Exposed userConfig in `pulsar-function-go` and made it available in the `FunctionContext` - Add unit tests for the affected code (cherry picked from commit d6f18ab)
Motivation
Currently, pulsar functions written in Golang have no access to the content of the user-config parameter from admin CLI.
That's the simplest way to pass custom configuration into a go function right now because neither secretsMap nor Kubernetes runtime is available for Golang functions yet.
Note: For the
secretsMap
parameter, the same technique can be used, but this has to be addressed in a separate PR.Modifications
String GoInstanceConfig#userConfig
attributeRuntimeUtils.getGoInstanceCmd
pulsar-function-go
and made it available in theFunctionContext
Verifying this change
This change added tests and can be verified as follows:
RuntimeUtils.getGoInstanceCmd
inpulsar-functions
instanceConf
andFunctionContext
inpulsar-function-go
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesgo mod tidy
inpulsar-function-go
.Documentation
The respective documentation has to be updated: User Config#Go
Question: Does it have to be done in the scope of current PR?