Skip to content

refactor: Flatten config maps and introduce RoleBuilder - #887

Open
adwk67 wants to merge 2 commits into
mainfrom
refactor/flatten-configmaps-add-rolebuilder
Open

adwk67 wants to merge 2 commits into
mainfrom
refactor/flatten-configmaps-add-rolebuilder

Conversation

@adwk67

@adwk67 adwk67 commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Description

Part of https://github.com/stackabletech/internal-issues/issues/167

Overview of logic flow

%%{init: {"flowchart": {"wrappingWidth": 900, "htmlLabels": true}}}%%
flowchart TB
    START["`**build()** mod.rs:160`"]
    START --> LCO
    START --> LBR
    START --> LHI
    START --> LMM
    START --> LRO

    subgraph coordinator_track["Coordinator"]
        direction TB
        LCO["`**build_pdb()** :166 · **build_group_listener()** :169
        **loop** over coordinator_role_group_configs :175`"]
        RCO["`**coordinator::build()** role_group/coordinator.rs:30
        **heap_memory()** :45 · no direct memory
        **RoleGroupInputs { .. }** :47
        listener: Some :58 · role_jvm_args: Derby log :64 · oidc_enabled: true :66`"]
        LCO --> RCO
    end

    subgraph broker_track["Broker"]
        direction TB
        LBR["`**build_pdb()** :184 · **build_group_listener()** :187
        **loop** over broker_role_group_configs :193`"]
        RBR["`**broker::build()** role_group/broker.rs:22
        **heap_memory()** :38 · 400 MiB direct memory :37
        **RoleGroupInputs { .. }** :40
        listener: Some :51 · oidc_enabled: true :58`"]
        LBR --> RBR
    end

    subgraph historical_track["Historical"]
        direction TB
        LHI["`**build_pdb()** :202 · no listener
        **loop** over historical_role_group_configs :205`"]
        RHI["`**historical::build()** role_group/historical.rs:29
        **HistoricalDerivedSettings::try_from()** :44 · heap + direct from memory limit
        **segment_cache_locations()** :50 · resource_runtime_properties
        **RoleGroupInputs { .. }** :54
        listener: None · role_pod_volumes: segment cache :66 · role_druid_mounts :67 · oidc_enabled: true :72`"]
        LHI --> RHI
    end

    subgraph middle_manager_track["MiddleManager"]
        direction TB
        LMM["`**build_pdb()** :214 · no listener
        **loop** over middle_manager_role_group_configs :221`"]
        RMM["`**middle_manager::build()** role_group/middle_manager.rs:56
        **heap_memory()** :71 · no direct memory
        **RoleGroupInputs { .. }** :73
        listener: None · **indexer_java_opts()** :90 · **drain_pre_stop_hook()** :98 · oidc_enabled: false :106`"]
        LMM --> RMM
    end

    subgraph router_track["Router"]
        direction TB
        LRO["`**build_pdb()** :230 · **build_group_listener()** :233
        **loop** over router_role_group_configs :239`"]
        RRO["`**router::build()** role_group/router.rs:22
        **heap_memory()** :38 · 128 MiB direct memory :37
        **RoleGroupInputs { .. }** :40
        listener: Some :51 · oidc_enabled: true :58`"]
        LRO --> RRO
    end

    RCO --> NEW
    RBR --> NEW
    RHI --> NEW
    RMM --> NEW
    RRO --> NEW

    NEW["`**RoleGroupBuilder::new(inputs)** role_group/mod.rs:163 · resolve, same for every role
    **config_map_data()** resource/config_map.rs:118 · runtime.properties layers: resource_runtime_properties :141, TLS :262, auth with oidc_enabled :266, indexer_java_opts :278, role_runtime_defaults :281, configOverrides :282
    · jvm.config: **construct_jvm_args()** :297 with role_jvm_args :301 · security.properties: indexer_java_opts :314
    **containers_and_volumes()** container.rs:107 · prepare :117, druid :118 with druid_pre_stop :121, role_druid_mounts :179, role_pod_volumes :181, listener PVC + mount if listener :186, Vector :333`"]

    NEW --> ADD["`**RoleGroupResources::add()** mod.rs:284 · emit
    **build_services()** role_group/mod.rs:190 · headless + metrics Service
    **build_config_map()** resource/config_map.rs:343 · wraps builder.config_map_data
    **build_statefulset()** resource/statefulset.rs:41 · affinity :48, grace period :51, pod_volumes :59, init_containers :83, containers :87, pod overrides :92, volume_claim_templates :113`"]

    ADD --> OUT["`**KubernetesResources { .. }** mod.rs:260
    PDBs and Listeners from the role level above · **build_discovery_configmap()** :255 · **build_service_account()** :266 · **build_role_binding()** :267`"]
    OUT --> APPLY["`**apply()** controller.rs:155 · outside build/`"]

    classDef coordinator fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
    classDef broker fill:#fde68a,stroke:#b45309,color:#78350f
    classDef historical fill:#bbf7d0,stroke:#15803d,color:#14532d
    classDef middle_manager fill:#fbcfe8,stroke:#be185d,color:#831843
    classDef router fill:#ddd6fe,stroke:#6d28d9,color:#4c1d95
    classDef shared fill:#e5e7eb,stroke:#4b5563,color:#111827
    classDef edge fill:#ffffff,stroke:#6b7280,color:#111827,stroke-dasharray:4 2
    class LCO,RCO coordinator
    class LBR,RBR broker
    class LHI,RHI historical
    class LMM,RMM middle_manager
    class LRO,RRO router
    class NEW,ADD,OUT shared
    class START,APPLY edge
    style coordinator_track fill:#eff6ff,stroke:#93c5fd
    style broker_track fill:#fffbeb,stroke:#fcd34d
    style historical_track fill:#f0fdf4,stroke:#86efac
    style middle_manager_track fill:#fdf2f8,stroke:#f9a8d4
    style router_track fill:#f5f3ff,stroke:#c4b5fd
Loading

Tests (one a little flakey which passed on the second attempt):

--- FAIL: kuttl (2835.27s)
    --- FAIL: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/smoke_druid-37.0.0_zookeeper-3.9.6_hadoop-3.5.0_openshift-false (237.63s)
        --- PASS: kuttl/harness/ingestion-s3-ext_druid-latest-37.0.0_zookeeper-latest-3.9.6_hadoop-3.5.0_openshift-false (332.82s)
        --- PASS: kuttl/harness/cluster-operation_druid-latest-37.0.0_zookeeper-latest-3.9.6_hadoop-latest-3.5.0_openshift-false (428.53s)
        --- PASS: kuttl/harness/s3-deep-storage_druid-latest-37.0.0_zookeeper-latest-3.9.6_s3-use-tls-true_openshift-false (558.54s)
        --- PASS: kuttl/harness/external-access_druid-37.0.0_zookeeper-latest-3.9.6_hadoop-3.5.0_openshift-false (251.86s)
        --- PASS: kuttl/harness/authorizer_druid-37.0.0_zookeeper-latest-3.9.6_opa-latest-1.16.2_hadoop-3.5.0_openshift-false (230.14s)
        --- PASS: kuttl/harness/tls_druid-latest-37.0.0_zookeeper-latest-3.9.6_tls-mode-internal-and-server-tls-and-tls-client-auth_openshift-false (277.94s)
        --- PASS: kuttl/harness/hdfs-deep-storage_druid-latest-37.0.0_zookeeper-latest-3.9.6_hadoop-3.5.0_openshift-false (267.80s)
        --- PASS: kuttl/harness/tls_druid-latest-37.0.0_zookeeper-latest-3.9.6_tls-mode-no-tls_openshift-false (252.92s)
        --- PASS: kuttl/harness/ingestion-no-s3-ext_druid-latest-37.0.0_zookeeper-latest-3.9.6_hadoop-3.5.0_openshift-false (298.25s)
        --- PASS: kuttl/harness/ldap_druid-37.0.0_zookeeper-latest-3.9.6_opa-latest-1.16.2_hadoop-latest-3.5.0_ldap-use-tls-true_ldap-no-bind-credentials-false_openshift-false (249.07s)
        --- FAIL: kuttl/harness/tls_druid-latest-37.0.0_zookeeper-latest-3.9.6_tls-mode-internal-and-server-tls_openshift-false (657.00s)
        --- PASS: kuttl/harness/logging_druid-37.0.0_zookeeper-latest-3.9.6_hadoop-3.5.0_openshift-false (251.85s)
        --- PASS: kuttl/harness/oidc_druid-37.0.0_zookeeper-latest-3.9.6_s3-use-tls-true_openshift-false_oidc-use-tls-true (272.68s)
        --- PASS: kuttl/harness/overrides_druid-latest-37.0.0_zookeeper-latest-3.9.6_hadoop-latest-3.5.0_openshift-false (488.91s)
        --- PASS: kuttl/harness/resources_druid-latest-37.0.0_zookeeper-latest-3.9.6_openshift-false (146.26s)
        --- PASS: kuttl/harness/orphaned-resources_druid-latest-37.0.0_zookeeper-latest-3.9.6_hadoop-3.5.0_openshift-false (300.05s)
FAIL

--- PASS: kuttl (238.96s)
    --- PASS: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/tls_druid-latest-37.0.0_zookeeper-latest-3.9.6_tls-mode-internal-and-server-tls_openshift-false (238.95s)
PASS

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Helm chart can be installed and deployed operator works
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible
  • Links to generated (nightly) docs added
  • Release note snippet added

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

@adwk67 adwk67 self-assigned this Oct 13, 2026
@adwk67
adwk67 marked this pull request as ready for review October 13, 2026 13:59
@siegfriedweber
siegfriedweber self-requested a review October 19, 2026 09:35
@siegfriedweber siegfriedweber moved this to Development: In Review in Stackable Engineering Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: In Review

Development

Successfully merging this pull request may close these issues.

2 participants