Skip to content

As a user I'd like to add Ingestion specs/Datasources programatically #168

Closed

Description

@lfrancke

I'd like to have a CustomResource/ConfigMap that I can use to define all my Datasources/Ingestions in Druid.

We decided to just take the verbatim JSON as it is generated by the Druid Web UI and have this in a CustomResource.
I thought about having just a ConfigMap instead of a CR but that opens the question on how to reference the Druid cluster in question.

It could be the other way around: A "config map selector" in Druid that selects all ConfigMaps that should be added but that also doesn't seem very agile. Either way this needs to be authorized later.

  • Please come up with a final architecture (CustomResource vs. other options)
  • Bring up the architecture at the weekly architecture meeting for discussion
  • Implement
  • Add Integration Tests
  • Add documentation

Activity

  1. razvan commented on Mar 3, 2022

    @razvan
    Member

    I thought about having just a ConfigMap instead of a CR but that opens the question on how to reference the Druid cluster in question.

    If each druid cluster runs in it's own namespace, there is no need to reference it. The ConfigMap is created in the appropriate namespace.

    If multiple clusters can run in the same namespace, a label can be used to select the cluster.

  2. assigned and unassigned on Mar 7, 2022
  3. siegfriedweber commented on Mar 11, 2022

    @siegfriedweber
    Member

    Ingestion Specs

    Ingestion specs can be created with the wizard in the Druid web UI. If there is already an ingestion spec as JSON then it can be pasted into the web UI and submitted. Druid begins ingesting data once the ingestion spec is submitted. The web UI just calls a REST endpoint which also can be used directly:

    curl -X POST -H "Content-type: application/json" -d @ingestion-spec.json http://druid-coordinator:8081/druid/indexer/v1/task
    

    The endpoint is not about declaring an ingestion spec, it is used for creating a task which ingests the data according to the spec. The ingestion is idempotent iff some conditions are met (see the druid documentation). For instance, if the user sets appendToExisting to true in the ingestion spec then it is not idempotent. In this case the chosen solution must not create a task more than once. So it is best to not rely on idempotency.

    Discovery

    In the previous comments there was already a discussion how the ingestion specs should be discovered an assigned to Druid clusters. If the ingestion specs are part of the cluster specification then this discussion is unnecessary. If the ingestion specs are separate resources, like config maps or custom resources, then the according references can be made in the cluster specification or in the ingestion specs if the specs are custom resources. The references can be explicitly named or implicitly described by labels.

    In my opinion, we should not inline the ingestion specs to keep the cluster specification small and to allow ingestion specs to be referenced by other clusters (if this is ever a real use case). I prefer config maps over a custom resource definition for the ingestion specs because I see no benefit of using custom resources. The config maps should be referenced in the cluster specification because that is what we do in all other cases, too. I have no opinion if they should be referenced by (config map) names or by labels.

    Options

    Custom resource managed by the operator

    A little digression to Superset: The database used by Superset must be initialized. The data necessary for the initialization (a secret with the admin user data and a flag indicating if examples should be loaded) are provided in the specification of the Superset cluster. The Superset operator uses a custom resource of kind SupersetDB to ensure that the database is initialized with the given data. The custom resource is created by the operator and the SupersetDB controller handles the reconciliation. The SupersetDB resource then provides information about the status of the database initialization. The initialization is only performed once. (Not important here but for the sake of completeness: Another reason for this approach is that the Druid connection can only be set up after the database is initialized. The Druid connection is also modelled as a custom resource. The controller of the Druid connection watches the status of the database resource and creates the job after the database is ready.)

    The database initialization in Superset solves a similar problem as given in this ticket. The user creates config maps with the ingestion specs and references them in the Druid cluster specification. The Druid operator then creates a custom resource to handle the ingestion after the cluster is up-and-running. The status of the ingestion could also be reflected in the custom resource.

    A job creates the ingestion tasks

    The ingestion specs are stored in config maps and referenced by the Druid cluster. A job is created together with the cluster which waits until the cluster is up-and-running and then creates the ingestion tasks. This is a simple solution but I do not like the busy waiting.

    No implementation

    Druid already offers a very convenient way of adding ingestion specs. Users will probably use the option which is the most convenient one. Therefore, not implementing this functionality in the Stackable platform is also an option.

  4. siegfriedweber commented on Mar 11, 2022

    @siegfriedweber
    Member

    As discussed in the daily, the implementation part will be outsourced to a separate ticket.

  5. lfrancke commented on Mar 21, 2022

    @lfrancke
    MemberAuthor

    Thank you, very thorough.

    Do the ingestion specs have a "name" (I assume so because as far as I understood you they do create tables in the end) which means multiple specs could conflict with each other?

  6. siegfriedweber commented on Mar 23, 2022

    @siegfriedweber
    Member

    The datasources have a name (e.g. "wikipedia"):

    image

    The ingestion spec contains the name of the datasource:

    {
      "spec": {
        "dataSchema": {
          "dataSource": "wikipedia",

    If a new task (with a different ingestion spec) is created for the same datasource then the datasource is changed accordingly. The tasks have unique identifiers:

    image

    Therefore the order in which ingestion specs for the same datasource are applied, matters.

    However, I have no experience with Druid. So, @adwk67, please correct me if my explanation is inaccurate.

  7. adwk67 commented on Mar 23, 2022

    @adwk67
    Member

    In default mode an ingestion spec for an existing datasource will just overwrite it. There is an append option, so data can be extended, although deduplication is not attempted in any kind of thorough way (if the same data exists in different segments, then they exist as duplicates within that datasource. See here.

  8. sbernauer commented on Apr 4, 2022

    @sbernauer
    Member

    Meeting with @lfrancke regarding deeper understanding outstanding and decision

  9. lfrancke commented on Apr 6, 2022

    @lfrancke
    MemberAuthor

    Thank you!
    @sbernauer do you want to be part of that meeting?

  10. sbernauer commented on Apr 6, 2022

    @sbernauer
    Member

    Not from my side, thanks. I just commented that in our daily as i was sharing my screen

  11. soenkeliebau commented on Apr 25, 2022

    @soenkeliebau
    Member

    ping @lfrancke - do you remember why this is still open?

  12. soenkeliebau commented on Apr 29, 2022

    @soenkeliebau
    Member

    Feedback from Lars: Waiting for a meeting on this, but holiday season interferred, will be picked up next week.

  13. soenkeliebau commented on May 3, 2022

    @soenkeliebau
    Member

    @siegfriedweber @adwk67 @lfrancke just had a brief meeting on this and took the following decision:

    Ingestion specs can be defined by the user via a customresource, which is watched by a controller in the Druid operator that then provisions these specs.
    The crd will contain at least the following:

    • type of source (stream, flat file, ...)
    • failure behavior
      • none
      • retry
      • delete and retry
    • specification of the ingest job
      • inline
      • reference to configmap
      • reference to pvc (or file therein)

    These objects will initially be considered read-only, so changes to them will not be propagated to Druid by the controller.

  14. soenkeliebau commented on May 3, 2022

    @soenkeliebau
    Member

    implementation will be tracked in #226

  15. lfrancke commented on May 3, 2022

    @lfrancke
    MemberAuthor

    Thank you @soenkeliebau for the ticket and @adwk67 @siegfriedweber for the preparation and help.
    I think this issue can be closed then in favor of #226.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions