diff --git a/CHANGELOG.md b/CHANGELOG.md index 6507e152..18cc28b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Changed + +- Removed the option to set a namespace for the zookeeper reference ([#140]) + +[#140]: https://github.com/stackabletech/druid-operator/pull/140 + ## [0.3.0] - 2022-01-27 diff --git a/deploy/crd/druidcluster.crd.yaml b/deploy/crd/druidcluster.crd.yaml index 41c51b18..6513fe09 100644 --- a/deploy/crd/druidcluster.crd.yaml +++ b/deploy/crd/druidcluster.crd.yaml @@ -522,16 +522,8 @@ spec: version: description: Desired Druid version type: string - zookeeperReference: - properties: - configMapName: - type: string - namespace: - type: string - required: - - configMapName - - namespace - type: object + zookeeperConfigMapName: + type: string required: - brokers - coordinators @@ -541,7 +533,7 @@ spec: - middleManagers - routers - version - - zookeeperReference + - zookeeperConfigMapName type: object status: nullable: true diff --git a/deploy/helm/druid-operator/crds/crds.yaml b/deploy/helm/druid-operator/crds/crds.yaml index 6f980506..e9fc6a5b 100644 --- a/deploy/helm/druid-operator/crds/crds.yaml +++ b/deploy/helm/druid-operator/crds/crds.yaml @@ -524,16 +524,8 @@ spec: version: description: Desired Druid version type: string - zookeeperReference: - properties: - configMapName: - type: string - namespace: - type: string - required: - - configMapName - - namespace - type: object + zookeeperConfigMapName: + type: string required: - brokers - coordinators @@ -543,7 +535,7 @@ spec: - middleManagers - routers - version - - zookeeperReference + - zookeeperConfigMapName type: object status: nullable: true diff --git a/deploy/manifests/crds.yaml b/deploy/manifests/crds.yaml index 99cb14b0..34d55280 100644 --- a/deploy/manifests/crds.yaml +++ b/deploy/manifests/crds.yaml @@ -525,16 +525,8 @@ spec: version: description: Desired Druid version type: string - zookeeperReference: - properties: - configMapName: - type: string - namespace: - type: string - required: - - configMapName - - namespace - type: object + zookeeperConfigMapName: + type: string required: - brokers - coordinators @@ -544,7 +536,7 @@ spec: - middleManagers - routers - version - - zookeeperReference + - zookeeperConfigMapName type: object status: nullable: true diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index 053a0bb6..960b90aa 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -40,7 +40,7 @@ metadata: name: simple-druid spec: version: 0.22.0 - zookeeperReference: simple-zk + zookeeperConfigMapName: simple-zk metadataStorageDatabase: dbType: postgresql connString: jdbc:postgresql://druid-postgresql/druid diff --git a/examples/derby/druidcluster.yaml b/examples/derby/druidcluster.yaml index 7758d010..e81ab45f 100644 --- a/examples/derby/druidcluster.yaml +++ b/examples/derby/druidcluster.yaml @@ -4,9 +4,7 @@ metadata: name: derby-druid spec: version: 0.22.0 - zookeeperReference: - configMapName: simple - namespace: default + zookeeperConfigMapName: simple metadataStorageDatabase: dbType: derby connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true diff --git a/examples/psql-s3/druidcluster.yaml b/examples/psql-s3/druidcluster.yaml index c71f9f95..79ba2ecb 100644 --- a/examples/psql-s3/druidcluster.yaml +++ b/examples/psql-s3/druidcluster.yaml @@ -4,9 +4,7 @@ metadata: name: psqls3-druid spec: version: 0.22.0 - zookeeperReference: - configMapName: simple - namespace: default + zookeeperConfigMapName: simple metadataStorageDatabase: dbType: postgresql connString: jdbc:postgresql://druid-postgresql/druid diff --git a/examples/psql/druidcluster.yaml b/examples/psql/druidcluster.yaml index c7c4d232..449bbfdd 100644 --- a/examples/psql/druidcluster.yaml +++ b/examples/psql/druidcluster.yaml @@ -4,9 +4,7 @@ metadata: name: psql-druid spec: version: 0.22.0 - zookeeperReference: - configMapName: simple - namespace: default + zookeeperConfigMapName: simple metadataStorageDatabase: dbType: postgresql connString: jdbc:postgresql://druid-postgresql/druid diff --git a/rust/crd/src/lib.rs b/rust/crd/src/lib.rs index 5bc8e6c4..664f3233 100644 --- a/rust/crd/src/lib.rs +++ b/rust/crd/src/lib.rs @@ -83,7 +83,7 @@ pub struct DruidClusterSpec { pub metadata_storage_database: DatabaseConnectionSpec, pub deep_storage: DeepStorageSpec, pub s3: Option, - pub zookeeper_reference: ZookeeperReference, + pub zookeeper_config_map_name: String, } #[derive( @@ -184,13 +184,6 @@ pub struct DatabaseConnectionSpec { pub password: Option, } -#[derive(Clone, Debug, Default, Deserialize, JsonSchema, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ZookeeperReference { - pub config_map_name: String, - pub namespace: String, -} - #[derive( Clone, Debug, @@ -454,7 +447,7 @@ mod tests { metadata_storage_database: Default::default(), deep_storage: Default::default(), s3: None, - zookeeper_reference: Default::default(), + zookeeper_config_map_name: Default::default(), }, ); diff --git a/rust/operator-binary/src/druid_controller.rs b/rust/operator-binary/src/druid_controller.rs index 67705781..33b2d9fa 100644 --- a/rust/operator-binary/src/druid_controller.rs +++ b/rust/operator-binary/src/druid_controller.rs @@ -39,6 +39,7 @@ use stackable_operator::{ controller::{Context, ReconcilerAction}, reflector::ObjectRef, }, + ResourceExt, }, labels::{role_group_selector_labels, role_selector_labels}, product_config::{types::PropertyNameKind, ProductConfigManager}, @@ -94,21 +95,18 @@ pub enum Error { druid: ObjectRef, }, #[snafu(display( - "Failed to get ZooKeeper connection string from config map {} in namespace {}", - cm_name, - namespace + "Failed to get ZooKeeper discovery config map for cluster: {}", + cm_name ))] GetZookeeperConnStringConfigMap { source: stackable_operator::error::Error, cm_name: String, - namespace: String, }, #[snafu(display( - "Failed to get ZooKeeper connection string from config map {} in namespace {}", - cm_name, - namespace + "Failed to get ZooKeeper connection string from config map {}", + cm_name ))] - MissingZookeeperConnString { cm_name: String, namespace: String }, + MissingZookeeperConnString { cm_name: String }, #[snafu(display("Failed to transform configs"))] ProductConfigTransform { source: stackable_operator::product_config_utils::ConfigError, @@ -131,20 +129,17 @@ pub async fn reconcile_druid(druid: DruidCluster, ctx: Context) -> Result(&zk_confmap, Some(&zk_cm_ns)) + .get::(&zk_confmap, druid.namespace().as_deref()) .await - .with_context(|| GetZookeeperConnStringConfigMap { + .context(GetZookeeperConnStringConfigMap { cm_name: zk_confmap.clone(), - namespace: zk_cm_ns.clone(), })? .data .and_then(|mut data| data.remove("ZOOKEEPER")) - .with_context(|| MissingZookeeperConnString { + .context(MissingZookeeperConnString { cm_name: zk_confmap.clone(), - namespace: zk_cm_ns.clone(), })?; let mut roles = HashMap::new();