-
Notifications
You must be signed in to change notification settings - Fork 12
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
Subscription "hints" #37
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vmaheshw
reviewed
Jun 26, 2023
hoptimator-catalog/src/main/java/com/linkedin/hoptimator/catalog/Resource.java
Show resolved
Hide resolved
hoptimator-kafka-adapter/src/main/java/com/linkedin/hoptimator/catalog/kafka/KafkaTopic.java
Outdated
Show resolved
Hide resolved
hoptimator-kafka-adapter/src/main/java/com/linkedin/hoptimator/catalog/kafka/KafkaTopicAcl.java
Outdated
Show resolved
Hide resolved
...ator/src/main/java/com/linkedin/hoptimator/operator/subscription/SubscriptionReconciler.java
Outdated
Show resolved
Hide resolved
hshukla
reviewed
Jul 21, 2023
hoptimator-catalog/src/main/java/com/linkedin/hoptimator/catalog/Resource.java
Show resolved
Hide resolved
hshukla
approved these changes
Jul 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added
Subscription.spec.hints
field, which can be used to tweak sink resources, i.e. any resources created downstream of the SQL job (e.g. an output Kafka topic). Hints are ignored by the SQL engine.Added
SubscriptionEnvironment
, which exposes hints to resource templates. While I was here, I also exposed the computed Avro schema and changedname
andnamespace
topipeline.name
andpipeline.namespace
. This should be less confusing than having "name" in templates, since "name" is very overloaded in that context.Added support for default values in template expressions via
{{property : defaultValue}}
. This was required in order to support hints, since hints are usually undefined.Changed the KafkaTopic template to now use a
numPartitions
hint. This means you can change the number of partitions in a pipeline by specifyingSubscription.spec.hints.numPartitions
. This gets carried through to the KafkaTopic controller, which will add partitions if necessary.Details
The idea behind "hints" is that we need to be able to control low-level aspects of the data plane, but we also don't want to surface this complexity to the SQL layer. This is a unique aspect of Hoptimator -- the SQL is very generic, and purposefully avoids anything that may be considered an "implementation detail". One way this goal manifests is that we do not support a
WITH(...)
clause, unlike, say, Flink SQL or KSQLdb. Instead, we can give "hints" to the control plane out-of-band in the Subscription object.As the name implies, hints are not specifications. The underlying controllers may ignore hints, especially if they are impossible to satisfy.
Testing Done
To verify the new default values mechanism, we can have the CLI generate YAML for a pipeline:
As expected,
pipeline.name
andpipeline.namespace
are not expanded, as they are missing from the environment. (There is no Subscription being created here.)OTOH, we see the operator fills these in:
If we deploy a Subscription with hints:
... we see the operator generates appropriate YAML:
Most importantly, we see the KafkaTopic controller reacts to the change in
numPartitions
: