Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
14 changes: 3 additions & 11 deletions deploy/crd/druidcluster.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -541,7 +533,7 @@ spec:
- middleManagers
- routers
- version
- zookeeperReference
- zookeeperConfigMapName
type: object
status:
nullable: true
Expand Down
14 changes: 3 additions & 11 deletions deploy/helm/druid-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -543,7 +535,7 @@ spec:
- middleManagers
- routers
- version
- zookeeperReference
- zookeeperConfigMapName
type: object
status:
nullable: true
Expand Down
14 changes: 3 additions & 11 deletions deploy/manifests/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -544,7 +536,7 @@ spec:
- middleManagers
- routers
- version
- zookeeperReference
- zookeeperConfigMapName
type: object
status:
nullable: true
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions examples/derby/druidcluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions examples/psql-s3/druidcluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions examples/psql/druidcluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 2 additions & 9 deletions rust/crd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub struct DruidClusterSpec {
pub metadata_storage_database: DatabaseConnectionSpec,
pub deep_storage: DeepStorageSpec,
pub s3: Option<S3Spec>,
pub zookeeper_reference: ZookeeperReference,
pub zookeeper_config_map_name: String,
}

#[derive(
Expand Down Expand Up @@ -184,13 +184,6 @@ pub struct DatabaseConnectionSpec {
pub password: Option<String>,
}

#[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,
Expand Down Expand Up @@ -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(),
},
);

Expand Down
25 changes: 10 additions & 15 deletions rust/operator-binary/src/druid_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -94,21 +95,18 @@ pub enum Error {
druid: ObjectRef<DruidCluster>,
},
#[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,
Expand All @@ -131,20 +129,17 @@ pub async fn reconcile_druid(druid: DruidCluster, ctx: Context<Ctx>) -> Result<R
let druid_ref = ObjectRef::from_obj(&druid);
let client = &ctx.get_ref().client;

let zk_confmap = druid.spec.zookeeper_reference.config_map_name.clone();
let zk_cm_ns = druid.spec.zookeeper_reference.namespace.clone();
let zk_confmap = druid.spec.zookeeper_config_map_name.clone();
let zk_connstr = client
.get::<ConfigMap>(&zk_confmap, Some(&zk_cm_ns))
.get::<ConfigMap>(&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();
Expand Down