-
Notifications
You must be signed in to change notification settings - Fork 20
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
Running Jikkou as a cloud function (FaaS) #324
Labels
enhancement
New feature or request
Comments
Hi @gquintana, I don't have any particular experience with Lambda but from what I've read, it should be possible to use Jikkou with it. Basically, use the Jikkou Core dependency: <dependency>
<groupId>io.streamthoughts</groupId>
<artifactId>jikkou-core</artifactId>
<version>0.31.0</version>
</dependency> Write a Here's an ugly, non-compilable example of how the Jikkou API can be used : public class JikkouReconciliationHandler implements RequestHandler<ResourceReconcileRequest, ResourceReconcileResponse>{
@Override
public JikkouHandlerOutput handleRequest(ResourceReconcileRequest event, Context context)
{
var resources = .... // get resource from event
var mode = .... // get mode from event
var context = getReconciliationContext(event, false);
ApiChangeResultList result = api.reconcile(resources, mode, context);
return new ResourceReconcileResponse(result);
}
private JikkouApi createJikkouApi() {
// Create your configuration
Configuration configuration = Configuration.from(...);
// Create the DefaultExtensionRegistry
DefaultExtensionRegistry registry = new DefaultExtensionRegistry(
new DefaultExtensionDescriptorFactory(),
new ClassExtensionAliasesGenerator()
);
// Create the DefaultExtensionFactory
DefaultExtensionFactory extensionFactory = new DefaultExtensionFactory(
registry,
configuration
);
// Create the DefaultResourceRegistry
DefaultResourceRegistry resourceRegistry = new DefaultResourceRegistry();
// Configure validations, transformations, reporters from the configuration.
ApiConfigurator[] configurators = {
new ValidationApiConfigurator(registry),
new TransformationApiConfigurator(registry),
new ChangeReporterApiConfigurator(registry)
};
// Context loads all extensions using ServiceLoader
JikkouContext jikkouContext = new JikkouContext(configuration, extensionFactory, resourceRegistry);
// Create the default API
DefaultApi.Builder builder = new DefaultApi.Builder(
extensionFactory,
resourceRegistry
);
return jikkouContext.createApi(builder, configurators);
}
public ReconciliationContext getReconciliationContext(ResourceReconcileRequest request, boolean dryRun) {
var selectorFactory = new ExpressionSelectorFactory();
ResourceReconcileRequest.Params params = request.params();
return ReconciliationContext
.builder()
.dryRun(dryRun)
.configuration(Configuration.from(params.options()))
.selectors(selectorFactory.make(params.selectors()))
.annotations(NamedValue.setOf(params.annotations()))
.labels(NamedValue.setOf(params.labels()))
.build();
}
} Does this give you any idea how to do it? Thanks for your feedback. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
**Is your feature request related to a problem? Please describe **
My Kafka cluster is running as a service (MSK).
I don't want to create a server to run Jikkou.
Jikkou can run as a container (CaaS) but as it is not a server app it shouldn't be up all the time.
Running Jikkou as a function (FaaS, Lambda) may be a good fit.
Describe the solution you'd like
Run Jikkou as a function where the input is a YAML/JSON thing describing topics... and the output describes the action realized on the Kafka cluster. Environment variables could be used to describe Kafka connection or other global settings.
Describe alternatives you've considered
See above
Additional context
I ignore whether this idea would be possible.
I know it represents a huge change from the current tool.
The text was updated successfully, but these errors were encountered: