diff --git a/CHANGELOG.md b/CHANGELOG.md index ecc99301..8711264d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Add support for non-TLS LDAP authentication. ([#374]) - Deploy default and support custom affinities ([#406]). +- Log aggregation added ([#407]). ### Changed @@ -24,6 +25,7 @@ All notable changes to this project will be documented in this file. [#387]: https://github.com/stackabletech/druid-operator/pull/387 [#404]: https://github.com/stackabletech/druid-operator/pull/404 [#406]: https://github.com/stackabletech/druid-operator/pull/406 +[#407]: https://github.com/stackabletech/druid-operator/pull/407 ## [23.1.0] - 2023-01-23 diff --git a/deploy/helm/druid-operator/crds/crds.yaml b/deploy/helm/druid-operator/crds/crds.yaml index 266c20a4..61fa04cd 100644 --- a/deploy/helm/druid-operator/crds/crds.yaml +++ b/deploy/helm/druid-operator/crds/crds.yaml @@ -514,6 +514,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -1053,6 +1129,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -1475,6 +1627,10 @@ spec: nullable: true type: string type: object + vectorAggregatorConfigMapName: + description: Name of the Vector aggregator discovery ConfigMap. It must contain the key `ADDRESS` with the address of the Vector aggregator. + nullable: true + type: string zookeeperConfigMapName: description: ZooKeeper discovery ConfigMap type: string @@ -1973,6 +2129,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -2512,6 +2744,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -3092,6 +3400,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -3658,6 +4042,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -4308,6 +4768,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -4847,6 +5383,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -5427,6 +6039,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: @@ -5966,6 +6654,82 @@ spec: type: array type: object type: object + logging: + default: + enableVectorAgent: null + containers: {} + properties: + containers: + additionalProperties: + anyOf: + - required: + - custom + - {} + description: Fragment derived from `ContainerLogConfigChoice` + properties: + console: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + custom: + description: Custom log configuration provided in a ConfigMap + properties: + configMap: + nullable: true + type: string + type: object + file: + nullable: true + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + loggers: + additionalProperties: + properties: + level: + description: Log levels + enum: + - TRACE + - DEBUG + - INFO + - WARN + - ERROR + - FATAL + - NONE + nullable: true + type: string + type: object + default: {} + type: object + type: object + type: object + enableVectorAgent: + nullable: true + type: boolean + type: object resources: default: memory: diff --git a/docs/modules/druid/examples/getting_started/druid.yaml b/docs/modules/druid/examples/getting_started/druid.yaml index 41713e50..053e66e8 100644 --- a/docs/modules/druid/examples/getting_started/druid.yaml +++ b/docs/modules/druid/examples/getting_started/druid.yaml @@ -6,7 +6,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: deepStorage: hdfs: diff --git a/docs/modules/druid/examples/getting_started/hdfs.yaml b/docs/modules/druid/examples/getting_started/hdfs.yaml index 1fe31205..62a1a53e 100644 --- a/docs/modules/druid/examples/getting_started/hdfs.yaml +++ b/docs/modules/druid/examples/getting_started/hdfs.yaml @@ -6,7 +6,7 @@ metadata: spec: image: productVersion: 3.3.4 - stackableVersion: 0.2.0 + stackableVersion: 23.4.0-rc2 zookeeperConfigMapName: simple-hdfs-znode dfsReplication: 3 nameNodes: diff --git a/docs/modules/druid/examples/getting_started/zookeeper.yaml b/docs/modules/druid/examples/getting_started/zookeeper.yaml index 913f179f..8f6d2f5b 100644 --- a/docs/modules/druid/examples/getting_started/zookeeper.yaml +++ b/docs/modules/druid/examples/getting_started/zookeeper.yaml @@ -6,7 +6,7 @@ metadata: spec: image: productVersion: 3.8.0 - stackableVersion: 0.8.0 + stackableVersion: 23.4.0-rc2 servers: roleGroups: default: diff --git a/docs/modules/druid/pages/usage.adoc b/docs/modules/druid/pages/usage.adoc index 9a9c3023..0b750a3b 100644 --- a/docs/modules/druid/pages/usage.adoc +++ b/docs/modules/druid/pages/usage.adoc @@ -54,7 +54,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: deepStorage: hdfs: @@ -390,6 +390,41 @@ The operator creates a `ConfigMap` with the name of the cluster which contains c The managed Druid instances are automatically configured to export Prometheus metrics. See xref:operators:monitoring.adoc[] for more details. +== Log aggregation + +The logs can be forwarded to a Vector log aggregator by providing a discovery +ConfigMap for the aggregator and by enabling the log agent: + +[source,yaml] +---- +spec: + clusterConfig: + vectorAggregatorConfigMapName: vector-aggregator-discovery + brokers: + config: + logging: + enableVectorAgent: true + coordinators: + config: + logging: + enableVectorAgent: true + historicals: + config: + logging: + enableVectorAgent: true + middleManagers: + config: + logging: + enableVectorAgent: true + routers: + config: + logging: + enableVectorAgent: true +---- + +Further information on how to configure logging, can be found in +xref:home:concepts:logging.adoc[]. + == Configuration & Environment Overrides The cluster definition also supports overriding configuration properties and environment variables, either per role or per role group, where the more specific override (role group) has precedence over the less specific one (role). diff --git a/examples/psql-s3/psql-s3-druid-cluster.yaml b/examples/psql-s3/psql-s3-druid-cluster.yaml index 1c3d920d..b9acfef2 100644 --- a/examples/psql-s3/psql-s3-druid-cluster.yaml +++ b/examples/psql-s3/psql-s3-druid-cluster.yaml @@ -6,7 +6,7 @@ metadata: spec: image: productVersion: 3.8.0 - stackableVersion: 0.8.0 + stackableVersion: 23.4.0-rc2 servers: roleGroups: default: @@ -47,7 +47,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: deepStorage: s3: diff --git a/examples/psql/psql-hdfs-druid-cluster.yaml b/examples/psql/psql-hdfs-druid-cluster.yaml index 4e954cdf..5d3b648f 100644 --- a/examples/psql/psql-hdfs-druid-cluster.yaml +++ b/examples/psql/psql-hdfs-druid-cluster.yaml @@ -6,7 +6,7 @@ metadata: spec: image: productVersion: 3.8.0 - stackableVersion: 0.8.0 + stackableVersion: 23.4.0-rc2 servers: roleGroups: default: @@ -35,7 +35,7 @@ metadata: spec: image: productVersion: 3.3.4 - stackableVersion: 0.2.0 + stackableVersion: 23.4.0-rc2 zookeeperConfigMapName: psql-druid-znode dfsReplication: 1 nameNodes: @@ -58,7 +58,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: deepStorage: hdfs: diff --git a/examples/tls/tls-druid-cluster.yaml b/examples/tls/tls-druid-cluster.yaml index e1f4c7d5..f1da07f5 100644 --- a/examples/tls/tls-druid-cluster.yaml +++ b/examples/tls/tls-druid-cluster.yaml @@ -6,7 +6,7 @@ metadata: spec: image: productVersion: 3.8.0 - stackableVersion: 0.8.0 + stackableVersion: 23.4.0-rc2 servers: roleGroups: default: @@ -27,7 +27,7 @@ metadata: spec: image: productVersion: 3.3.4 - stackableVersion: 0.2.0 + stackableVersion: 23.4.0-rc2 zookeeperConfigMapName: druid-hdfs-znode dfsReplication: 1 nameNodes: @@ -80,7 +80,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: authentication: - authenticationClass: druid-mtls-authentication-class diff --git a/rust/crd/src/lib.rs b/rust/crd/src/lib.rs index b319653a..d53cfe37 100644 --- a/rust/crd/src/lib.rs +++ b/rust/crd/src/lib.rs @@ -34,6 +34,7 @@ use stackable_operator::{ labels::ObjectLabels, product_config::types::PropertyNameKind, product_config_utils::{ConfigError, Configuration}, + product_logging::{self, spec::Logging}, role_utils::{CommonConfiguration, Role, RoleGroup}, schemars::{self, JsonSchema}, }; @@ -47,12 +48,13 @@ pub const OPERATOR_NAME: &str = "druid.stackable.tech"; // config directories pub const DRUID_CONFIG_DIRECTORY: &str = "/stackable/config"; pub const HDFS_CONFIG_DIRECTORY: &str = "/stackable/hdfs"; +pub const LOG_CONFIG_DIRECTORY: &str = "/stackable/log_config"; pub const RW_CONFIG_DIRECTORY: &str = "/stackable/rwconfig"; // config file names pub const JVM_CONFIG: &str = "jvm.config"; pub const RUNTIME_PROPS: &str = "runtime.properties"; -pub const LOG4J2_CONFIG: &str = "log4j2.xml"; +pub const LOG4J2_CONFIG: &str = "log4j2.properties"; // store directories pub const SYSTEM_TRUST_STORE: &str = "/etc/pki/java/cacerts"; @@ -60,6 +62,10 @@ pub const SYSTEM_TRUST_STORE_PASSWORD: &str = "changeit"; pub const STACKABLE_TRUST_STORE: &str = "/stackable/truststore.p12"; pub const STACKABLE_TRUST_STORE_PASSWORD: &str = "changeit"; pub const CERTS_DIR: &str = "/stackable/certificates"; +pub const LOG_DIR: &str = "/stackable/log"; + +// store file names +pub const DRUID_LOG_FILE: &str = "druid.log4j2.xml"; pub const PROP_SEGMENT_CACHE_LOCATIONS: &str = "druid.segmentCache.locations"; pub const PATH_SEGMENT_CACHE: &str = "/stackable/var/druid/segment-cache"; @@ -100,6 +106,11 @@ pub const PROCESSING_NUM_MERGE_BUFFERS: &str = "druid.processing.numMergeBuffers pub const PROCESSING_NUM_THREADS: &str = "druid.processing.numThreads"; // extra pub const CREDENTIALS_SECRET_PROPERTY: &str = "credentialsSecret"; +// logs +pub const MAX_DRUID_LOG_FILES_SIZE_IN_MIB: u32 = 10; +const MAX_PREPARE_LOG_FILE_SIZE_IN_MIB: u32 = 1; +pub const LOG_VOLUME_SIZE_IN_MIB: u32 = + MAX_DRUID_LOG_FILES_SIZE_IN_MIB + MAX_PREPARE_LOG_FILE_SIZE_IN_MIB; // metrics pub const PROMETHEUS_PORT: &str = "druid.emitter.prometheus.port"; pub const METRICS_PORT: u16 = 9090; @@ -172,6 +183,27 @@ pub struct DruidClusterSpec { pub cluster_config: DruidClusterConfig, } +#[derive( + Clone, + Debug, + Deserialize, + Display, + Eq, + EnumIter, + JsonSchema, + Ord, + PartialEq, + PartialOrd, + Serialize, +)] +#[serde(rename_all = "kebab-case")] +#[strum(serialize_all = "kebab-case")] +pub enum Container { + Druid, + Prepare, + Vector, +} + #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(rename_all = "camelCase")] pub struct DruidClusterConfig { @@ -195,11 +227,16 @@ pub struct DruidClusterConfig { pub tls: Option, /// ZooKeeper discovery ConfigMap pub zookeeper_config_map_name: String, + /// Name of the Vector aggregator discovery ConfigMap. + /// It must contain the key `ADDRESS` with the address of the Vector aggregator. + #[serde(skip_serializing_if = "Option::is_none")] + pub vector_aggregator_config_map_name: Option, } /// Common configuration for all role groups pub struct CommonRoleGroupConfig { pub resources: RoleResource, + pub logging: Logging, pub replicas: Option, pub selector: Option, pub affinity: StackableAffinity, @@ -238,6 +275,7 @@ impl MergedConfig { .context(CannotRetrieveRoleGroupSnafu { rolegroup_name })?; Ok(CommonRoleGroupConfig { resources: RoleResource::Druid(rolegroup.config.config.resources.to_owned()), + logging: rolegroup.config.config.logging.to_owned(), replicas: rolegroup.replicas, selector: rolegroup.selector.to_owned(), affinity: rolegroup.config.config.affinity.clone(), @@ -250,6 +288,7 @@ impl MergedConfig { .context(CannotRetrieveRoleGroupSnafu { rolegroup_name })?; Ok(CommonRoleGroupConfig { resources: RoleResource::Druid(rolegroup.config.config.resources.to_owned()), + logging: rolegroup.config.config.logging.to_owned(), replicas: rolegroup.replicas, selector: rolegroup.selector.to_owned(), affinity: rolegroup.config.config.affinity.clone(), @@ -264,6 +303,7 @@ impl MergedConfig { resources: RoleResource::Historical( rolegroup.config.config.resources.to_owned(), ), + logging: rolegroup.config.config.logging.to_owned(), replicas: rolegroup.replicas, selector: rolegroup.selector.to_owned(), affinity: rolegroup.config.config.affinity.clone(), @@ -276,6 +316,7 @@ impl MergedConfig { .context(CannotRetrieveRoleGroupSnafu { rolegroup_name })?; Ok(CommonRoleGroupConfig { resources: RoleResource::Druid(rolegroup.config.config.resources.to_owned()), + logging: rolegroup.config.config.logging.to_owned(), replicas: rolegroup.replicas, selector: rolegroup.selector.to_owned(), affinity: rolegroup.config.config.affinity.clone(), @@ -288,6 +329,7 @@ impl MergedConfig { .context(CannotRetrieveRoleGroupSnafu { rolegroup_name })?; Ok(CommonRoleGroupConfig { resources: RoleResource::Druid(rolegroup.config.config.resources.to_owned()), + logging: rolegroup.config.config.logging.to_owned(), replicas: rolegroup.replicas, selector: rolegroup.selector.to_owned(), affinity: rolegroup.config.config.affinity.clone(), @@ -390,6 +432,13 @@ impl DruidRole { rw_conf = RW_CONFIG_DIRECTORY )); + // copy log config to rw config + shell_cmd.push(format!( + "cp -RL {conf}/* {rw_conf}", + conf = LOG_CONFIG_DIRECTORY, + rw_conf = RW_CONFIG_DIRECTORY + )); + // copy hdfs config to RW_CONFIG_DIRECTORY folder (if available) shell_cmd.push(format!( "cp -RL {hdfs_conf}/* {rw_conf} 2>/dev/null || :", // NOTE: the OR part is here because the command is not applicable sometimes, and would stop everything else from executing @@ -471,7 +520,6 @@ impl DruidCluster { // metrics result.insert(PROMETHEUS_PORT.to_string(), Some(METRICS_PORT.to_string())); } - LOG4J2_CONFIG => {} _ => {} } @@ -490,7 +538,6 @@ impl DruidCluster { let config_files = vec![ PropertyNameKind::Env, PropertyNameKind::File(JVM_CONFIG.to_string()), - PropertyNameKind::File(LOG4J2_CONFIG.to_string()), PropertyNameKind::File(RUNTIME_PROPS.to_string()), ]; @@ -816,6 +863,8 @@ pub struct BrokerConfig { #[fragment_attrs(serde(default))] resources: Resources, #[fragment_attrs(serde(default))] + pub logging: Logging, + #[fragment_attrs(serde(default))] pub affinity: StackableAffinity, } @@ -827,6 +876,7 @@ impl BrokerConfig { ) -> BrokerConfigFragment { BrokerConfigFragment { resources: resource::DEFAULT_RESOURCES.to_owned(), + logging: product_logging::spec::default_logging(), affinity: get_affinity(cluster_name, role, deep_storage), } } @@ -850,6 +900,8 @@ pub struct CoordinatorConfig { #[fragment_attrs(serde(default))] resources: Resources, #[fragment_attrs(serde(default))] + pub logging: Logging, + #[fragment_attrs(serde(default))] pub affinity: StackableAffinity, } @@ -861,6 +913,7 @@ impl CoordinatorConfig { ) -> CoordinatorConfigFragment { CoordinatorConfigFragment { resources: resource::DEFAULT_RESOURCES.to_owned(), + logging: product_logging::spec::default_logging(), affinity: get_affinity(cluster_name, role, deep_storage), } } @@ -884,6 +937,8 @@ pub struct MiddleManagerConfig { #[fragment_attrs(serde(default))] resources: Resources, #[fragment_attrs(serde(default))] + pub logging: Logging, + #[fragment_attrs(serde(default))] pub affinity: StackableAffinity, } @@ -895,6 +950,7 @@ impl MiddleManagerConfig { ) -> MiddleManagerConfigFragment { MiddleManagerConfigFragment { resources: resource::DEFAULT_RESOURCES.to_owned(), + logging: product_logging::spec::default_logging(), affinity: get_affinity(cluster_name, role, deep_storage), } } @@ -918,6 +974,8 @@ pub struct RouterConfig { #[fragment_attrs(serde(default))] resources: Resources, #[fragment_attrs(serde(default))] + pub logging: Logging, + #[fragment_attrs(serde(default))] pub affinity: StackableAffinity, } @@ -929,6 +987,7 @@ impl RouterConfig { ) -> RouterConfigFragment { RouterConfigFragment { resources: resource::DEFAULT_RESOURCES.to_owned(), + logging: product_logging::spec::default_logging(), affinity: get_affinity(cluster_name, role, deep_storage), } } @@ -952,6 +1011,8 @@ pub struct HistoricalConfig { #[fragment_attrs(serde(default))] resources: Resources, #[fragment_attrs(serde(default))] + pub logging: Logging, + #[fragment_attrs(serde(default))] pub affinity: StackableAffinity, } @@ -963,6 +1024,7 @@ impl HistoricalConfig { ) -> HistoricalConfigFragment { HistoricalConfigFragment { resources: resource::HISTORICAL_RESOURCES.to_owned(), + logging: product_logging::spec::default_logging(), affinity: get_affinity(cluster_name, role, deep_storage), } } diff --git a/rust/crd/src/resource.rs b/rust/crd/src/resource.rs index 2b81a5e7..2250e508 100644 --- a/rust/crd/src/resource.rs +++ b/rust/crd/src/resource.rs @@ -19,6 +19,9 @@ use stackable_operator::{ }; use strum::{EnumDiscriminants, IntoStaticStr}; +// volume names +const SEGMENT_CACHE_VOLUME_NAME: &str = "segment-cache"; + /// This Error cannot derive PartialEq because fragment::ValidationError doesn't derive it #[derive(Snafu, Debug, EnumDiscriminants)] #[strum_discriminants(derive(IntoStaticStr))] @@ -87,9 +90,9 @@ impl RoleResource { pub fn update_volumes_and_volume_mounts(&self, cb: &mut ContainerBuilder, pb: &mut PodBuilder) { if let Self::Historical(r) = self { - cb.add_volume_mount("segment-cache", PATH_SEGMENT_CACHE); + cb.add_volume_mount(SEGMENT_CACHE_VOLUME_NAME, PATH_SEGMENT_CACHE); pb.add_volume( - VolumeBuilder::new("segment-cache") + VolumeBuilder::new(SEGMENT_CACHE_VOLUME_NAME) .empty_dir(EmptyDirVolumeSource { medium: r.storage.segment_cache.empty_dir.medium.clone(), size_limit: Some(r.storage.segment_cache.empty_dir.capacity.clone()), diff --git a/rust/crd/src/security.rs b/rust/crd/src/security.rs index dc6ca4fb..19154fa9 100644 --- a/rust/crd/src/security.rs +++ b/rust/crd/src/security.rs @@ -81,6 +81,10 @@ impl DruidTlsSecurity { const STACKABLE_MOUNT_TLS_DIR: &str = "/stackable/mount_tls"; const STACKABLE_TLS_DIR: &str = "/stackable/tls"; + // volume names + const TLS_VOLUME_NAME: &str = "tls"; + const TLS_MOUNT_VOLUME_NAME: &str = "tls-mount"; + pub fn new( resolved_authentication_classes: ResolvedAuthenticationClasses, server_and_internal_secret_class: Option, @@ -178,7 +182,7 @@ impl DruidTlsSecurity { // uses the same SecretClass as the Druid server itself. if let Some(secret_class) = &self.server_and_internal_secret_class { pod.add_volume( - VolumeBuilder::new("tls-mount") + VolumeBuilder::new(Self::TLS_MOUNT_VOLUME_NAME) .ephemeral( SecretOperatorVolumeSourceBuilder::new(secret_class) .with_pod_scope() @@ -187,16 +191,16 @@ impl DruidTlsSecurity { ) .build(), ); - prepare.add_volume_mount("tls-mount", Self::STACKABLE_MOUNT_TLS_DIR); - druid.add_volume_mount("tls-mount", Self::STACKABLE_MOUNT_TLS_DIR); + prepare.add_volume_mount(Self::TLS_MOUNT_VOLUME_NAME, Self::STACKABLE_MOUNT_TLS_DIR); + druid.add_volume_mount(Self::TLS_MOUNT_VOLUME_NAME, Self::STACKABLE_MOUNT_TLS_DIR); pod.add_volume( - VolumeBuilder::new("tls") + VolumeBuilder::new(Self::TLS_VOLUME_NAME) .with_empty_dir(Option::<&str>::None, None) .build(), ); - prepare.add_volume_mount("tls", Self::STACKABLE_TLS_DIR); - druid.add_volume_mount("tls", Self::STACKABLE_TLS_DIR); + prepare.add_volume_mount(Self::TLS_VOLUME_NAME, Self::STACKABLE_TLS_DIR); + druid.add_volume_mount(Self::TLS_VOLUME_NAME, Self::STACKABLE_TLS_DIR); } Ok(()) } diff --git a/rust/crd/test/resources/resource_merge/druid_cluster.yaml b/rust/crd/test/resources/resource_merge/druid_cluster.yaml index 401fb5e0..61ac4c3b 100644 --- a/rust/crd/test/resources/resource_merge/druid_cluster.yaml +++ b/rust/crd/test/resources/resource_merge/druid_cluster.yaml @@ -8,7 +8,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: deepStorage: hdfs: diff --git a/rust/crd/test/resources/resource_merge/segment_cache.yaml b/rust/crd/test/resources/resource_merge/segment_cache.yaml index d85ece29..fe830526 100644 --- a/rust/crd/test/resources/resource_merge/segment_cache.yaml +++ b/rust/crd/test/resources/resource_merge/segment_cache.yaml @@ -8,7 +8,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: deepStorage: hdfs: diff --git a/rust/crd/test/resources/role_service/druid_cluster.yaml b/rust/crd/test/resources/role_service/druid_cluster.yaml index c6f40787..44a61780 100644 --- a/rust/crd/test/resources/role_service/druid_cluster.yaml +++ b/rust/crd/test/resources/role_service/druid_cluster.yaml @@ -8,7 +8,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: deepStorage: hdfs: diff --git a/rust/operator-binary/src/config.rs b/rust/operator-binary/src/config.rs index e9b75498..c0463f94 100644 --- a/rust/operator-binary/src/config.rs +++ b/rust/operator-binary/src/config.rs @@ -1,6 +1,9 @@ use indoc::formatdoc; use snafu::{ResultExt, Snafu}; -use stackable_druid_crd::{DruidRole, STACKABLE_TRUST_STORE, STACKABLE_TRUST_STORE_PASSWORD}; +use stackable_druid_crd::{ + DruidRole, LOG4J2_CONFIG, RW_CONFIG_DIRECTORY, STACKABLE_TRUST_STORE, + STACKABLE_TRUST_STORE_PASSWORD, +}; use stackable_operator::memory::MemoryQuantity; #[derive(Snafu, Debug)] @@ -36,6 +39,7 @@ pub fn get_jvm_config( -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/tmp -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager + -Dlog4j.configurationFile={RW_CONFIG_DIRECTORY}/{LOG4J2_CONFIG} -XX:+UseG1GC -XX:+ExitOnOutOfMemoryError -Djavax.net.ssl.trustStore={STACKABLE_TRUST_STORE} @@ -53,39 +57,3 @@ pub fn get_jvm_config( } Ok(config) } - -pub fn get_log4j_config(_role: &DruidRole) -> String { - " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" - .to_string() -} diff --git a/rust/operator-binary/src/druid_controller.rs b/rust/operator-binary/src/druid_controller.rs index a9fce6b3..c22cc4b9 100644 --- a/rust/operator-binary/src/druid_controller.rs +++ b/rust/operator-binary/src/druid_controller.rs @@ -1,17 +1,17 @@ //! Ensures that `Pod`s are configured and running for each [`DruidCluster`] use crate::{ - config::{get_jvm_config, get_log4j_config}, + config::get_jvm_config, discovery::{self, build_discovery_configmaps}, extensions::get_extension_list, internal_secret::{ build_shared_internal_secret_name, create_shared_internal_secret, env_var_from_secret, ENV_INTERNAL_SECRET, }, + product_logging::{extend_role_group_config_map, resolve_vector_aggregator_address}, OPERATOR_NAME, }; use snafu::{OptionExt, ResultExt, Snafu}; -use stackable_druid_crd::build_recommended_labels; use stackable_druid_crd::{ authorization::DruidAuthorization, build_string_list, @@ -22,10 +22,11 @@ use stackable_druid_crd::{ security::{resolve_authentication_classes, DruidTlsSecurity}, CommonRoleGroupConfig, DeepStorageSpec, DruidCluster, DruidRole, APP_NAME, AUTH_AUTHORIZER_OPA_URI, CERTS_DIR, CREDENTIALS_SECRET_PROPERTY, DRUID_CONFIG_DIRECTORY, - DS_BUCKET, EXTENSIONS_LOADLIST, HDFS_CONFIG_DIRECTORY, JVM_CONFIG, LOG4J2_CONFIG, - RUNTIME_PROPS, RW_CONFIG_DIRECTORY, S3_ENDPOINT_URL, S3_PATH_STYLE_ACCESS, S3_SECRET_DIR_NAME, - ZOOKEEPER_CONNECTION_STRING, + DS_BUCKET, EXTENSIONS_LOADLIST, HDFS_CONFIG_DIRECTORY, JVM_CONFIG, LOG_CONFIG_DIRECTORY, + LOG_DIR, LOG_VOLUME_SIZE_IN_MIB, RUNTIME_PROPS, RW_CONFIG_DIRECTORY, S3_ENDPOINT_URL, + S3_PATH_STYLE_ACCESS, S3_SECRET_DIR_NAME, ZOOKEEPER_CONNECTION_STRING, }; +use stackable_druid_crd::{build_recommended_labels, Container}; use stackable_operator::{ builder::{ ConfigMapBuilder, ContainerBuilder, ObjectMetaBuilder, PodBuilder, @@ -43,7 +44,7 @@ use stackable_operator::{ apps::v1::{StatefulSet, StatefulSetSpec}, core::v1::{ConfigMap, EnvVar, Service, ServiceSpec}, }, - apimachinery::pkg::apis::meta::v1::LabelSelector, + apimachinery::pkg::{api::resource::Quantity, apis::meta::v1::LabelSelector}, }, kube::{ runtime::{controller::Action, reflector::ObjectRef}, @@ -53,6 +54,13 @@ use stackable_operator::{ logging::controller::ReconcilerError, product_config::{types::PropertyNameKind, ProductConfigManager}, product_config_utils::{transform_all_roles_to_config, validate_all_roles_and_groups_config}, + product_logging::{ + self, + spec::{ + ConfigMapLogConfig, ContainerLogConfig, ContainerLogConfigChoice, + CustomContainerLogConfig, + }, + }, role_utils::RoleGroupRef, }; use std::{ @@ -68,6 +76,13 @@ pub const CONTROLLER_NAME: &str = "druidcluster"; const DOCKER_IMAGE_BASE_NAME: &str = "druid"; +// volume names +const DRUID_CONFIG_VOLUME_NAME: &str = "config"; +const HDFS_CONFIG_VOLUME_NAME: &str = "hdfs"; +const LOG_CONFIG_VOLUME_NAME: &str = "log-config"; +const LOG_VOLUME_NAME: &str = "log"; +const RW_CONFIG_VOLUME_NAME: &str = "rwconfig"; + pub struct Ctx { pub client: stackable_operator::client::Client, pub product_config: ProductConfigManager, @@ -200,6 +215,15 @@ pub enum Error { "failed to access bind credentials although they are required for LDAP to work" ))] LdapBindCredentialsAreRequired, + #[snafu(display("failed to resolve the Vector aggregator address"))] + ResolveVectorAggregatorAddress { + source: crate::product_logging::Error, + }, + #[snafu(display("failed to add the logging configuration to the ConfigMap [{cm_name}]"))] + InvalidLoggingConfig { + source: crate::product_logging::Error, + cm_name: String, + }, } type Result = std::result::Result; @@ -234,6 +258,10 @@ pub async fn reconcile_druid(druid: Arc, ctx: Arc) -> Result< cm_name: zk_confmap.clone(), })?; + let vector_aggregator_address = resolve_vector_aggregator_address(&druid, client) + .await + .context(ResolveVectorAggregatorAddressSnafu)?; + // Assemble the OPA connection string from the discovery and the given path, if a spec is given. let opa_connstr = if let Some(DruidAuthorization { opa: opa_config }) = &druid.spec.cluster_config.authorization @@ -346,6 +374,7 @@ pub async fn reconcile_druid(druid: Arc, ctx: Arc) -> Result< rolegroup_config, &merged_rolegroup_config, &zk_connstr, + vector_aggregator_address.as_deref(), opa_connstr.as_deref(), s3_conn.as_ref(), deep_storage_bucket_name.as_deref(), @@ -454,6 +483,7 @@ fn build_rolegroup_config_map( rolegroup_config: &HashMap>, merged_rolegroup_config: &CommonRoleGroupConfig, zk_connstr: &str, + vector_aggregator_address: Option<&str>, opa_connstr: Option<&str>, s3_conn: Option<&S3ConnectionSpec>, deep_storage_bucket_name: Option<&str>, @@ -550,12 +580,6 @@ fn build_rolegroup_config_map( // if this is changed in the future, make sure to respect overrides! cm_conf_data.insert(JVM_CONFIG.to_string(), jvm_config); } - PropertyNameKind::File(file_name) if file_name == LOG4J2_CONFIG => { - let log_config = get_log4j_config(&role); - // the user can set overrides in the config, but currently they have no effect - // if this is changed in the future, make sure to respect overrides! - cm_conf_data.insert(LOG4J2_CONFIG.to_string(), log_config); - } _ => {} } } @@ -579,6 +603,17 @@ fn build_rolegroup_config_map( for (filename, file_content) in cm_conf_data.iter() { config_map_builder.add_data(filename, file_content); } + + extend_role_group_config_map( + rolegroup, + vector_aggregator_address, + &merged_rolegroup_config.logging, + &mut config_map_builder, + ) + .context(InvalidLoggingConfigSnafu { + cm_name: rolegroup.object_name(), + })?; + config_map_builder .build() .with_context(|_| BuildRoleGroupConfigSnafu { @@ -647,11 +682,19 @@ fn build_rolegroup_statefulset( })?; // init container builder - let mut cb_prepare = ContainerBuilder::new("prepare") - .context(FailedContainerBuilderCreationSnafu { name: "prepare" })?; + let prepare_container_name = Container::Prepare.to_string(); + let mut cb_prepare = ContainerBuilder::new(&prepare_container_name).context( + FailedContainerBuilderCreationSnafu { + name: &prepare_container_name, + }, + )?; // druid container builder - let mut cb_druid = ContainerBuilder::new(APP_NAME) - .context(FailedContainerBuilderCreationSnafu { name: APP_NAME })?; + let druid_container_name = Container::Druid.to_string(); + let mut cb_druid = ContainerBuilder::new(&druid_container_name).context( + FailedContainerBuilderCreationSnafu { + name: &druid_container_name, + }, + )?; // init pod builder let mut pb = PodBuilder::new(); pb.affinity(&merged_rolegroup_config.affinity); @@ -676,6 +719,13 @@ fn build_rolegroup_statefulset( .context(FailedToInitializeSecurityContextSnafu)?; add_s3_volume_and_volume_mounts(s3_conn, &mut cb_druid, &mut pb)?; add_config_volume_and_volume_mounts(rolegroup_ref, &mut cb_druid, &mut pb); + add_log_config_volume_and_volume_mounts( + rolegroup_ref, + merged_rolegroup_config, + &mut cb_druid, + &mut pb, + ); + add_log_volume_and_volume_mounts(&mut cb_druid, &mut cb_prepare, &mut pb); add_hdfs_cm_volume_and_volume_mounts( &druid.spec.cluster_config.deep_storage, &mut cb_druid, @@ -685,7 +735,23 @@ fn build_rolegroup_statefulset( .resources .update_volumes_and_volume_mounts(&mut cb_druid, &mut pb); - let prepare_container_command = druid_tls_security.build_tls_key_stores_cmd(); + let mut prepare_container_command = vec![]; + + if let Some(ContainerLogConfig { + choice: Some(ContainerLogConfigChoice::Automatic(log_config)), + }) = merged_rolegroup_config + .logging + .containers + .get(&Container::Prepare) + { + prepare_container_command.push(product_logging::framework::capture_shell_output( + LOG_DIR, + &prepare_container_name, + log_config, + )); + } + + prepare_container_command.extend(druid_tls_security.build_tls_key_stores_cmd()); cb_prepare .image_from_product_image(resolved_product_image) @@ -742,6 +808,18 @@ fn build_rolegroup_statefulset( .build(), ); + if merged_rolegroup_config.logging.enable_vector_agent { + pb.add_container(product_logging::framework::vector_container( + resolved_product_image, + DRUID_CONFIG_VOLUME_NAME, + LOG_VOLUME_NAME, + merged_rolegroup_config + .logging + .containers + .get(&Container::Vector), + )); + } + Ok(StatefulSet { metadata: ObjectMetaBuilder::new() .name_and_namespace(druid) @@ -787,9 +865,9 @@ fn add_hdfs_cm_volume_and_volume_mounts( ) { // hdfs deep storage mount if let DeepStorageSpec::HDFS(hdfs) = deep_storage_spec { - cb_druid.add_volume_mount("hdfs", HDFS_CONFIG_DIRECTORY); + cb_druid.add_volume_mount(HDFS_CONFIG_VOLUME_NAME, HDFS_CONFIG_DIRECTORY); pb.add_volume( - VolumeBuilder::new("hdfs") + VolumeBuilder::new(HDFS_CONFIG_VOLUME_NAME) .with_config_map(&hdfs.config_map_name) .build(), ); @@ -834,20 +912,67 @@ fn add_config_volume_and_volume_mounts( cb_druid: &mut ContainerBuilder, pb: &mut PodBuilder, ) { - cb_druid.add_volume_mount("config", DRUID_CONFIG_DIRECTORY); + cb_druid.add_volume_mount(DRUID_CONFIG_VOLUME_NAME, DRUID_CONFIG_DIRECTORY); pb.add_volume( - VolumeBuilder::new("config") + VolumeBuilder::new(DRUID_CONFIG_VOLUME_NAME) .with_config_map(rolegroup_ref.object_name()) .build(), ); - cb_druid.add_volume_mount("rwconfig", RW_CONFIG_DIRECTORY); + cb_druid.add_volume_mount(RW_CONFIG_VOLUME_NAME, RW_CONFIG_DIRECTORY); pb.add_volume( - VolumeBuilder::new("rwconfig") + VolumeBuilder::new(RW_CONFIG_VOLUME_NAME) .with_empty_dir(Some(""), None) .build(), ); } +fn add_log_config_volume_and_volume_mounts( + rolegroup_ref: &RoleGroupRef, + merged_rolegroup_config: &CommonRoleGroupConfig, + cb_druid: &mut ContainerBuilder, + pb: &mut PodBuilder, +) { + cb_druid.add_volume_mount(LOG_CONFIG_VOLUME_NAME, LOG_CONFIG_DIRECTORY); + + let config_map = if let Some(ContainerLogConfig { + choice: + Some(ContainerLogConfigChoice::Custom(CustomContainerLogConfig { + custom: ConfigMapLogConfig { config_map }, + })), + }) = merged_rolegroup_config + .logging + .containers + .get(&Container::Druid) + { + config_map.into() + } else { + rolegroup_ref.object_name() + }; + + pb.add_volume( + VolumeBuilder::new(LOG_CONFIG_VOLUME_NAME) + .with_config_map(config_map) + .build(), + ); +} + +fn add_log_volume_and_volume_mounts( + cb_druid: &mut ContainerBuilder, + cb_prepare: &mut ContainerBuilder, + pb: &mut PodBuilder, +) { + cb_druid.add_volume_mount(LOG_VOLUME_NAME, LOG_DIR); + cb_prepare.add_volume_mount(LOG_VOLUME_NAME, LOG_DIR); + pb.add_volume( + VolumeBuilder::new(LOG_VOLUME_NAME) + .with_empty_dir( + Some(""), + Some(Quantity(format!("{LOG_VOLUME_SIZE_IN_MIB}Mi"))), + ) + .build(), + ); +} + fn add_s3_volume_and_volume_mounts( s3_conn: Option<&S3ConnectionSpec>, cb_druid: &mut ContainerBuilder, @@ -1001,6 +1126,7 @@ mod test { None, None, None, + None, &druid_tls_security, &ldap_settings, ) diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index 85f8651a..5f752d4f 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -3,6 +3,7 @@ mod discovery; mod druid_controller; mod extensions; mod internal_secret; +mod product_logging; use std::sync::Arc; diff --git a/rust/operator-binary/src/product_logging.rs b/rust/operator-binary/src/product_logging.rs new file mode 100644 index 00000000..3c869c9a --- /dev/null +++ b/rust/operator-binary/src/product_logging.rs @@ -0,0 +1,123 @@ +use snafu::{OptionExt, ResultExt, Snafu}; +use stackable_druid_crd::{ + Container, DruidCluster, DRUID_LOG_FILE, LOG4J2_CONFIG, LOG_DIR, + MAX_DRUID_LOG_FILES_SIZE_IN_MIB, +}; +use stackable_operator::{ + builder::ConfigMapBuilder, + client::Client, + k8s_openapi::api::core::v1::ConfigMap, + kube::ResourceExt, + product_logging::{ + self, + spec::{ContainerLogConfig, ContainerLogConfigChoice, Logging}, + }, + role_utils::RoleGroupRef, +}; + +#[derive(Snafu, Debug)] +pub enum Error { + #[snafu(display("object has no namespace"))] + ObjectHasNoNamespace, + #[snafu(display("failed to retrieve the ConfigMap {cm_name}"))] + ConfigMapNotFound { + source: stackable_operator::error::Error, + cm_name: String, + }, + #[snafu(display("failed to retrieve the entry {entry} for ConfigMap {cm_name}"))] + MissingConfigMapEntry { + entry: &'static str, + cm_name: String, + }, + #[snafu(display("vectorAggregatorConfigMapName must be set"))] + MissingVectorAggregatorAddress, +} + +type Result = std::result::Result; + +const VECTOR_AGGREGATOR_CM_ENTRY: &str = "ADDRESS"; +const CONSOLE_CONVERSION_PATTERN: &str = "%d{ISO8601} %p [%t] %c - %m%n"; + +/// Return the address of the Vector aggregator if the corresponding ConfigMap name is given in the +/// cluster spec +pub async fn resolve_vector_aggregator_address( + druid: &DruidCluster, + client: &Client, +) -> Result> { + let vector_aggregator_address = if let Some(vector_aggregator_config_map_name) = &druid + .spec + .cluster_config + .vector_aggregator_config_map_name + .as_ref() + { + let vector_aggregator_address = client + .get::( + vector_aggregator_config_map_name, + druid + .namespace() + .as_deref() + .context(ObjectHasNoNamespaceSnafu)?, + ) + .await + .context(ConfigMapNotFoundSnafu { + cm_name: vector_aggregator_config_map_name.to_string(), + })? + .data + .and_then(|mut data| data.remove(VECTOR_AGGREGATOR_CM_ENTRY)) + .context(MissingConfigMapEntrySnafu { + entry: VECTOR_AGGREGATOR_CM_ENTRY, + cm_name: vector_aggregator_config_map_name.to_string(), + })?; + Some(vector_aggregator_address) + } else { + None + }; + + Ok(vector_aggregator_address) +} + +/// Extend the role group ConfigMap with logging and Vector configurations +pub fn extend_role_group_config_map( + rolegroup: &RoleGroupRef, + vector_aggregator_address: Option<&str>, + logging: &Logging, + cm_builder: &mut ConfigMapBuilder, +) -> Result<()> { + if let Some(ContainerLogConfig { + choice: Some(ContainerLogConfigChoice::Automatic(log_config)), + }) = logging.containers.get(&Container::Druid) + { + cm_builder.add_data( + LOG4J2_CONFIG, + product_logging::framework::create_log4j2_config( + &format!("{LOG_DIR}/{container}", container = Container::Druid), + DRUID_LOG_FILE, + MAX_DRUID_LOG_FILES_SIZE_IN_MIB, + CONSOLE_CONVERSION_PATTERN, + log_config, + ), + ); + } + + let vector_log_config = if let Some(ContainerLogConfig { + choice: Some(ContainerLogConfigChoice::Automatic(log_config)), + }) = logging.containers.get(&Container::Vector) + { + Some(log_config) + } else { + None + }; + + if logging.enable_vector_agent { + cm_builder.add_data( + product_logging::framework::VECTOR_CONFIG_FILE, + product_logging::framework::create_vector_config( + rolegroup, + vector_aggregator_address.context(MissingVectorAggregatorAddressSnafu)?, + vector_log_config, + ), + ); + } + + Ok(()) +} diff --git a/rust/operator-binary/test/resources/druid_controller/segment_cache.yaml b/rust/operator-binary/test/resources/druid_controller/segment_cache.yaml index fbe62bb5..c8ca8833 100644 --- a/rust/operator-binary/test/resources/druid_controller/segment_cache.yaml +++ b/rust/operator-binary/test/resources/druid_controller/segment_cache.yaml @@ -8,7 +8,7 @@ metadata: spec: image: productVersion: 24.0.0 - stackableVersion: 0.3.0 + stackableVersion: 23.4.0-rc2 clusterConfig: deepStorage: s3: diff --git a/tests/templates/kuttl/authorizer/00-assert.yaml.j2 b/tests/templates/kuttl/authorizer/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/authorizer/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/authorizer/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/authorizer/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/authorizer/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/authorizer/01-assert.yaml b/tests/templates/kuttl/authorizer/01-assert.yaml index 7a81c130..4998bcdd 100644 --- a/tests/templates/kuttl/authorizer/01-assert.yaml +++ b/tests/templates/kuttl/authorizer/01-assert.yaml @@ -2,5 +2,16 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert timeout: 300 -commands: - - script: kubectl -n $NAMESPACE rollout status daemonset test-opa-server-default --timeout 300s +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-zk-server-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: hdfs-znode diff --git a/tests/templates/kuttl/authorizer/00-install-zk.yaml.j2 b/tests/templates/kuttl/authorizer/01-install-zk.yaml.j2 similarity index 71% rename from tests/templates/kuttl/authorizer/00-install-zk.yaml.j2 rename to tests/templates/kuttl/authorizer/01-install-zk.yaml.j2 index 9958d9fb..a6a17bc5 100644 --- a/tests/templates/kuttl/authorizer/00-install-zk.yaml.j2 +++ b/tests/templates/kuttl/authorizer/01-install-zk.yaml.j2 @@ -7,7 +7,15 @@ spec: image: productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/authorizer/02-assert.yaml b/tests/templates/kuttl/authorizer/02-assert.yaml index 7138c1b0..7a81c130 100644 --- a/tests/templates/kuttl/authorizer/02-assert.yaml +++ b/tests/templates/kuttl/authorizer/02-assert.yaml @@ -1,28 +1,6 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 600 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-hdfs-namenode-default -status: - readyReplicas: 2 - replicas: 2 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-hdfs-journalnode-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-hdfs-datanode-default -status: - readyReplicas: 1 - replicas: 1 +timeout: 300 +commands: + - script: kubectl -n $NAMESPACE rollout status daemonset test-opa-server-default --timeout 300s diff --git a/tests/templates/kuttl/authorizer/01-install-opa.yaml.j2 b/tests/templates/kuttl/authorizer/02-install-opa.yaml.j2 similarity index 100% rename from tests/templates/kuttl/authorizer/01-install-opa.yaml.j2 rename to tests/templates/kuttl/authorizer/02-install-opa.yaml.j2 diff --git a/tests/templates/kuttl/authorizer/03-assert.yaml b/tests/templates/kuttl/authorizer/03-assert.yaml index a3331d5c..7138c1b0 100644 --- a/tests/templates/kuttl/authorizer/03-assert.yaml +++ b/tests/templates/kuttl/authorizer/03-assert.yaml @@ -6,31 +6,15 @@ timeout: 600 apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-broker-default + name: druid-hdfs-namenode-default status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-coordinator-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-historical-default -status: - readyReplicas: 1 - replicas: 1 + readyReplicas: 2 + replicas: 2 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-middlemanager-default + name: druid-hdfs-journalnode-default status: readyReplicas: 1 replicas: 1 @@ -38,7 +22,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-router-default + name: druid-hdfs-datanode-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/01-install-hdfs.yaml.j2 b/tests/templates/kuttl/authorizer/03-install-hdfs.yaml.j2 similarity index 58% rename from tests/templates/kuttl/ingestion-no-s3-ext/01-install-hdfs.yaml.j2 rename to tests/templates/kuttl/authorizer/03-install-hdfs.yaml.j2 index 6f512cc9..851577fe 100644 --- a/tests/templates/kuttl/ingestion-no-s3-ext/01-install-hdfs.yaml.j2 +++ b/tests/templates/kuttl/authorizer/03-install-hdfs.yaml.j2 @@ -13,17 +13,29 @@ spec: image: productVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: hdfs-znode dfsReplication: 1 nameNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 2 dataNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 journalNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/authorizer/04-assert.yaml b/tests/templates/kuttl/authorizer/04-assert.yaml index dc085bb1..a3331d5c 100644 --- a/tests/templates/kuttl/authorizer/04-assert.yaml +++ b/tests/templates/kuttl/authorizer/04-assert.yaml @@ -1,12 +1,44 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 300 +timeout: 600 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: checks + name: derby-druid-broker-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-coordinator-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-historical-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-middlemanager-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-router-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/authorizer/03-install-druid.yaml.j2 b/tests/templates/kuttl/authorizer/04-install-druid.yaml.j2 similarity index 80% rename from tests/templates/kuttl/authorizer/03-install-druid.yaml.j2 rename to tests/templates/kuttl/authorizer/04-install-druid.yaml.j2 index b4fcc71a..51991451 100644 --- a/tests/templates/kuttl/authorizer/03-install-druid.yaml.j2 +++ b/tests/templates/kuttl/authorizer/04-install-druid.yaml.j2 @@ -27,8 +27,14 @@ spec: connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true host: localhost port: 1527 +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} configOverrides: runtime.properties: &runtime-properties druid.auth.authenticatorChain: "[\"MyBasicMetadataAuthenticator\"]" @@ -56,24 +62,36 @@ spec: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} configOverrides: runtime.properties: *runtime-properties roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} configOverrides: runtime.properties: *runtime-properties roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} configOverrides: runtime.properties: *runtime-properties roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} configOverrides: runtime.properties: *runtime-properties roleGroups: diff --git a/tests/templates/kuttl/authorizer/05-assert.yaml b/tests/templates/kuttl/authorizer/05-assert.yaml index 1f6e20c9..dc085bb1 100644 --- a/tests/templates/kuttl/authorizer/05-assert.yaml +++ b/tests/templates/kuttl/authorizer/05-assert.yaml @@ -1,6 +1,12 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -commands: - - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/authcheck.py derby-druid -timeout: 600 +timeout: 300 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: checks +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/authorizer/04-checks-container.yaml b/tests/templates/kuttl/authorizer/05-checks-container.yaml similarity index 100% rename from tests/templates/kuttl/authorizer/04-checks-container.yaml rename to tests/templates/kuttl/authorizer/05-checks-container.yaml diff --git a/tests/templates/kuttl/authorizer/06-assert.yaml b/tests/templates/kuttl/authorizer/06-assert.yaml new file mode 100644 index 00000000..1f6e20c9 --- /dev/null +++ b/tests/templates/kuttl/authorizer/06-assert.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/authcheck.py derby-druid +timeout: 600 diff --git a/tests/templates/kuttl/authorizer/05-authcheck.yaml b/tests/templates/kuttl/authorizer/06-authcheck.yaml similarity index 100% rename from tests/templates/kuttl/authorizer/05-authcheck.yaml rename to tests/templates/kuttl/authorizer/06-authcheck.yaml diff --git a/tests/templates/kuttl/hdfs-deep-storage/00-assert.yaml.j2 b/tests/templates/kuttl/hdfs-deep-storage/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/hdfs-deep-storage/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/hdfs-deep-storage/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/hdfs-deep-storage/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/hdfs-deep-storage/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/hdfs-deep-storage/01-assert.yaml b/tests/templates/kuttl/hdfs-deep-storage/01-assert.yaml index 7138c1b0..01aec7bb 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/01-assert.yaml +++ b/tests/templates/kuttl/hdfs-deep-storage/01-assert.yaml @@ -6,23 +6,12 @@ timeout: 600 apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-hdfs-namenode-default -status: - readyReplicas: 2 - replicas: 2 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-hdfs-journalnode-default + name: druid-zk-server-default status: readyReplicas: 1 replicas: 1 --- -apiVersion: apps/v1 -kind: StatefulSet +apiVersion: v1 +kind: ConfigMap metadata: - name: druid-hdfs-datanode-default -status: - readyReplicas: 1 - replicas: 1 + name: druid-znode diff --git a/tests/templates/kuttl/hdfs-deep-storage/00-install-zk.yaml.j2 b/tests/templates/kuttl/hdfs-deep-storage/01-install-zk.yaml.j2 similarity index 66% rename from tests/templates/kuttl/hdfs-deep-storage/00-install-zk.yaml.j2 rename to tests/templates/kuttl/hdfs-deep-storage/01-install-zk.yaml.j2 index e3f705b9..9b6e4d5b 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/00-install-zk.yaml.j2 +++ b/tests/templates/kuttl/hdfs-deep-storage/01-install-zk.yaml.j2 @@ -7,7 +7,15 @@ spec: image: productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/hdfs-deep-storage/02-assert.yaml b/tests/templates/kuttl/hdfs-deep-storage/02-assert.yaml index a3331d5c..7138c1b0 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/02-assert.yaml +++ b/tests/templates/kuttl/hdfs-deep-storage/02-assert.yaml @@ -6,31 +6,15 @@ timeout: 600 apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-broker-default + name: druid-hdfs-namenode-default status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-coordinator-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-historical-default -status: - readyReplicas: 1 - replicas: 1 + readyReplicas: 2 + replicas: 2 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-middlemanager-default + name: druid-hdfs-journalnode-default status: readyReplicas: 1 replicas: 1 @@ -38,7 +22,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-router-default + name: druid-hdfs-datanode-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/hdfs-deep-storage/01-install-hdfs.yaml.j2 b/tests/templates/kuttl/hdfs-deep-storage/02-install-hdfs.yaml.j2 similarity index 63% rename from tests/templates/kuttl/hdfs-deep-storage/01-install-hdfs.yaml.j2 rename to tests/templates/kuttl/hdfs-deep-storage/02-install-hdfs.yaml.j2 index 6d50b981..025841e7 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/01-install-hdfs.yaml.j2 +++ b/tests/templates/kuttl/hdfs-deep-storage/02-install-hdfs.yaml.j2 @@ -13,17 +13,29 @@ spec: image: productVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-hdfs-znode dfsReplication: 1 nameNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 2 dataNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 journalNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/hdfs-deep-storage/03-assert.yaml b/tests/templates/kuttl/hdfs-deep-storage/03-assert.yaml index dc085bb1..a3331d5c 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/03-assert.yaml +++ b/tests/templates/kuttl/hdfs-deep-storage/03-assert.yaml @@ -1,12 +1,44 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 300 +timeout: 600 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: checks + name: derby-druid-broker-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-coordinator-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-historical-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-middlemanager-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-router-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/hdfs-deep-storage/02-install-druid.yaml.j2 b/tests/templates/kuttl/hdfs-deep-storage/03-install-druid.yaml.j2 similarity index 60% rename from tests/templates/kuttl/hdfs-deep-storage/02-install-druid.yaml.j2 rename to tests/templates/kuttl/hdfs-deep-storage/03-install-druid.yaml.j2 index 1de84747..1c0964ae 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/02-install-druid.yaml.j2 +++ b/tests/templates/kuttl/hdfs-deep-storage/03-install-druid.yaml.j2 @@ -23,24 +23,42 @@ spec: connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true host: localhost port: 1527 +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/hdfs-deep-storage/04-assert.yaml b/tests/templates/kuttl/hdfs-deep-storage/04-assert.yaml index 07a25600..dc085bb1 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/04-assert.yaml +++ b/tests/templates/kuttl/hdfs-deep-storage/04-assert.yaml @@ -1,6 +1,12 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -commands: - - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/healthcheck.py derby-druid timeout: 300 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: checks +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/hdfs-deep-storage/03-checks-container.yaml b/tests/templates/kuttl/hdfs-deep-storage/04-checks-container.yaml similarity index 100% rename from tests/templates/kuttl/hdfs-deep-storage/03-checks-container.yaml rename to tests/templates/kuttl/hdfs-deep-storage/04-checks-container.yaml diff --git a/tests/templates/kuttl/hdfs-deep-storage/05-assert.yaml b/tests/templates/kuttl/hdfs-deep-storage/05-assert.yaml index 1e955ca3..07a25600 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/05-assert.yaml +++ b/tests/templates/kuttl/hdfs-deep-storage/05-assert.yaml @@ -2,5 +2,5 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert commands: - - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid + - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/healthcheck.py derby-druid timeout: 300 diff --git a/tests/templates/kuttl/hdfs-deep-storage/04-healthcheck.yaml b/tests/templates/kuttl/hdfs-deep-storage/05-healthcheck.yaml similarity index 100% rename from tests/templates/kuttl/hdfs-deep-storage/04-healthcheck.yaml rename to tests/templates/kuttl/hdfs-deep-storage/05-healthcheck.yaml diff --git a/tests/templates/kuttl/hdfs-deep-storage/06-assert.yaml b/tests/templates/kuttl/hdfs-deep-storage/06-assert.yaml index c0a4ccb4..1e955ca3 100644 --- a/tests/templates/kuttl/hdfs-deep-storage/06-assert.yaml +++ b/tests/templates/kuttl/hdfs-deep-storage/06-assert.yaml @@ -2,5 +2,5 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert commands: - - script: kubectl exec -n $NAMESPACE druid-hdfs-namenode-default-0 -- ./bin/hdfs dfs -ls /druid | grep -q /druid/wikipedia-2015-09-12 -timeout: 30 + - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid +timeout: 300 diff --git a/tests/templates/kuttl/hdfs-deep-storage/05-ingestioncheck.yaml b/tests/templates/kuttl/hdfs-deep-storage/06-ingestioncheck.yaml similarity index 100% rename from tests/templates/kuttl/hdfs-deep-storage/05-ingestioncheck.yaml rename to tests/templates/kuttl/hdfs-deep-storage/06-ingestioncheck.yaml diff --git a/tests/templates/kuttl/hdfs-deep-storage/07-assert.yaml b/tests/templates/kuttl/hdfs-deep-storage/07-assert.yaml new file mode 100644 index 00000000..c0a4ccb4 --- /dev/null +++ b/tests/templates/kuttl/hdfs-deep-storage/07-assert.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: kubectl exec -n $NAMESPACE druid-hdfs-namenode-default-0 -- ./bin/hdfs dfs -ls /druid | grep -q /druid/wikipedia-2015-09-12 +timeout: 30 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/00-assert.yaml.j2 b/tests/templates/kuttl/ingestion-no-s3-ext/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/ingestion-no-s3-ext/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/ingestion-no-s3-ext/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/ingestion-no-s3-ext/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/01-assert.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/01-assert.yaml index 7138c1b0..4998bcdd 100644 --- a/tests/templates/kuttl/ingestion-no-s3-ext/01-assert.yaml +++ b/tests/templates/kuttl/ingestion-no-s3-ext/01-assert.yaml @@ -1,28 +1,17 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 600 +timeout: 300 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-hdfs-namenode-default -status: - readyReplicas: 2 - replicas: 2 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-hdfs-journalnode-default + name: druid-zk-server-default status: readyReplicas: 1 replicas: 1 --- -apiVersion: apps/v1 -kind: StatefulSet +apiVersion: v1 +kind: ConfigMap metadata: - name: druid-hdfs-datanode-default -status: - readyReplicas: 1 - replicas: 1 + name: hdfs-znode diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/00-install-zk.yaml.j2 b/tests/templates/kuttl/ingestion-no-s3-ext/01-install-zk.yaml.j2 similarity index 71% rename from tests/templates/kuttl/ingestion-no-s3-ext/00-install-zk.yaml.j2 rename to tests/templates/kuttl/ingestion-no-s3-ext/01-install-zk.yaml.j2 index 9958d9fb..a6a17bc5 100644 --- a/tests/templates/kuttl/ingestion-no-s3-ext/00-install-zk.yaml.j2 +++ b/tests/templates/kuttl/ingestion-no-s3-ext/01-install-zk.yaml.j2 @@ -7,7 +7,15 @@ spec: image: productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/02-assert.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/02-assert.yaml index a3331d5c..7138c1b0 100644 --- a/tests/templates/kuttl/ingestion-no-s3-ext/02-assert.yaml +++ b/tests/templates/kuttl/ingestion-no-s3-ext/02-assert.yaml @@ -6,31 +6,15 @@ timeout: 600 apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-broker-default + name: druid-hdfs-namenode-default status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-coordinator-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-historical-default -status: - readyReplicas: 1 - replicas: 1 + readyReplicas: 2 + replicas: 2 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-middlemanager-default + name: druid-hdfs-journalnode-default status: readyReplicas: 1 replicas: 1 @@ -38,7 +22,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-router-default + name: druid-hdfs-datanode-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/smoke/02-install-hdfs.yaml.j2 b/tests/templates/kuttl/ingestion-no-s3-ext/02-install-hdfs.yaml.j2 similarity index 58% rename from tests/templates/kuttl/smoke/02-install-hdfs.yaml.j2 rename to tests/templates/kuttl/ingestion-no-s3-ext/02-install-hdfs.yaml.j2 index 6f512cc9..851577fe 100644 --- a/tests/templates/kuttl/smoke/02-install-hdfs.yaml.j2 +++ b/tests/templates/kuttl/ingestion-no-s3-ext/02-install-hdfs.yaml.j2 @@ -13,17 +13,29 @@ spec: image: productVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: hdfs-znode dfsReplication: 1 nameNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 2 dataNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 journalNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/03-assert.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/03-assert.yaml index dc085bb1..a3331d5c 100644 --- a/tests/templates/kuttl/ingestion-no-s3-ext/03-assert.yaml +++ b/tests/templates/kuttl/ingestion-no-s3-ext/03-assert.yaml @@ -1,12 +1,44 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 300 +timeout: 600 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: checks + name: derby-druid-broker-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-coordinator-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-historical-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-middlemanager-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-router-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/02-install-druid.yaml.j2 b/tests/templates/kuttl/ingestion-no-s3-ext/03-install-druid.yaml.j2 similarity index 60% rename from tests/templates/kuttl/ingestion-no-s3-ext/02-install-druid.yaml.j2 rename to tests/templates/kuttl/ingestion-no-s3-ext/03-install-druid.yaml.j2 index 1de84747..1c0964ae 100644 --- a/tests/templates/kuttl/ingestion-no-s3-ext/02-install-druid.yaml.j2 +++ b/tests/templates/kuttl/ingestion-no-s3-ext/03-install-druid.yaml.j2 @@ -23,24 +23,42 @@ spec: connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true host: localhost port: 1527 +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/04-assert.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/04-assert.yaml index 07a25600..dc085bb1 100644 --- a/tests/templates/kuttl/ingestion-no-s3-ext/04-assert.yaml +++ b/tests/templates/kuttl/ingestion-no-s3-ext/04-assert.yaml @@ -1,6 +1,12 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -commands: - - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/healthcheck.py derby-druid timeout: 300 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: checks +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/03-checks-container.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/04-checks-container.yaml similarity index 100% rename from tests/templates/kuttl/ingestion-no-s3-ext/03-checks-container.yaml rename to tests/templates/kuttl/ingestion-no-s3-ext/04-checks-container.yaml diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/05-assert.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/05-assert.yaml index 1e955ca3..07a25600 100644 --- a/tests/templates/kuttl/ingestion-no-s3-ext/05-assert.yaml +++ b/tests/templates/kuttl/ingestion-no-s3-ext/05-assert.yaml @@ -2,5 +2,5 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert commands: - - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid + - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/healthcheck.py derby-druid timeout: 300 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/04-healthcheck.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/05-healthcheck.yaml similarity index 100% rename from tests/templates/kuttl/ingestion-no-s3-ext/04-healthcheck.yaml rename to tests/templates/kuttl/ingestion-no-s3-ext/05-healthcheck.yaml diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/06-assert.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/06-assert.yaml new file mode 100644 index 00000000..1e955ca3 --- /dev/null +++ b/tests/templates/kuttl/ingestion-no-s3-ext/06-assert.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid +timeout: 300 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/05-ingestioncheck.yaml b/tests/templates/kuttl/ingestion-no-s3-ext/06-ingestioncheck.yaml similarity index 100% rename from tests/templates/kuttl/ingestion-no-s3-ext/05-ingestioncheck.yaml rename to tests/templates/kuttl/ingestion-no-s3-ext/06-ingestioncheck.yaml diff --git a/tests/templates/kuttl/ingestion-s3-ext/00-assert.yaml b/tests/templates/kuttl/ingestion-s3-ext/00-assert.yaml deleted file mode 100644 index 4998bcdd..00000000 --- a/tests/templates/kuttl/ingestion-s3-ext/00-assert.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 300 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-zk-server-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: hdfs-znode diff --git a/tests/templates/kuttl/ingestion-s3-ext/00-assert.yaml.j2 b/tests/templates/kuttl/ingestion-s3-ext/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/ingestion-s3-ext/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/ingestion-s3-ext/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/ingestion-s3-ext/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/ingestion-s3-ext/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/ingestion-s3-ext/01-assert.yaml b/tests/templates/kuttl/ingestion-s3-ext/01-assert.yaml index 7138c1b0..4998bcdd 100644 --- a/tests/templates/kuttl/ingestion-s3-ext/01-assert.yaml +++ b/tests/templates/kuttl/ingestion-s3-ext/01-assert.yaml @@ -1,28 +1,17 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 600 +timeout: 300 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-hdfs-namenode-default -status: - readyReplicas: 2 - replicas: 2 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-hdfs-journalnode-default + name: druid-zk-server-default status: readyReplicas: 1 replicas: 1 --- -apiVersion: apps/v1 -kind: StatefulSet +apiVersion: v1 +kind: ConfigMap metadata: - name: druid-hdfs-datanode-default -status: - readyReplicas: 1 - replicas: 1 + name: hdfs-znode diff --git a/tests/templates/kuttl/ingestion-s3-ext/00-install-zk.yaml.j2 b/tests/templates/kuttl/ingestion-s3-ext/01-install-zk.yaml.j2 similarity index 71% rename from tests/templates/kuttl/ingestion-s3-ext/00-install-zk.yaml.j2 rename to tests/templates/kuttl/ingestion-s3-ext/01-install-zk.yaml.j2 index 9958d9fb..a6a17bc5 100644 --- a/tests/templates/kuttl/ingestion-s3-ext/00-install-zk.yaml.j2 +++ b/tests/templates/kuttl/ingestion-s3-ext/01-install-zk.yaml.j2 @@ -7,7 +7,15 @@ spec: image: productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/ingestion-s3-ext/02-assert.yaml b/tests/templates/kuttl/ingestion-s3-ext/02-assert.yaml index a3331d5c..7138c1b0 100644 --- a/tests/templates/kuttl/ingestion-s3-ext/02-assert.yaml +++ b/tests/templates/kuttl/ingestion-s3-ext/02-assert.yaml @@ -6,31 +6,15 @@ timeout: 600 apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-broker-default + name: druid-hdfs-namenode-default status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-coordinator-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-historical-default -status: - readyReplicas: 1 - replicas: 1 + readyReplicas: 2 + replicas: 2 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-middlemanager-default + name: druid-hdfs-journalnode-default status: readyReplicas: 1 replicas: 1 @@ -38,7 +22,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-router-default + name: druid-hdfs-datanode-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/authorizer/02-install-hdfs.yaml.j2 b/tests/templates/kuttl/ingestion-s3-ext/02-install-hdfs.yaml.j2 similarity index 58% rename from tests/templates/kuttl/authorizer/02-install-hdfs.yaml.j2 rename to tests/templates/kuttl/ingestion-s3-ext/02-install-hdfs.yaml.j2 index 6f512cc9..851577fe 100644 --- a/tests/templates/kuttl/authorizer/02-install-hdfs.yaml.j2 +++ b/tests/templates/kuttl/ingestion-s3-ext/02-install-hdfs.yaml.j2 @@ -13,17 +13,29 @@ spec: image: productVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: hdfs-znode dfsReplication: 1 nameNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 2 dataNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 journalNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/ingestion-s3-ext/03-assert.yaml b/tests/templates/kuttl/ingestion-s3-ext/03-assert.yaml index dc085bb1..a3331d5c 100644 --- a/tests/templates/kuttl/ingestion-s3-ext/03-assert.yaml +++ b/tests/templates/kuttl/ingestion-s3-ext/03-assert.yaml @@ -1,12 +1,44 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 300 +timeout: 600 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: checks + name: derby-druid-broker-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-coordinator-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-historical-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-middlemanager-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-router-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/ingestion-s3-ext/02-install-druid.yaml.j2 b/tests/templates/kuttl/ingestion-s3-ext/03-install-druid.yaml.j2 similarity index 71% rename from tests/templates/kuttl/ingestion-s3-ext/02-install-druid.yaml.j2 rename to tests/templates/kuttl/ingestion-s3-ext/03-install-druid.yaml.j2 index 4e6ba1da..442bc8ce 100644 --- a/tests/templates/kuttl/ingestion-s3-ext/02-install-druid.yaml.j2 +++ b/tests/templates/kuttl/ingestion-s3-ext/03-install-druid.yaml.j2 @@ -29,24 +29,42 @@ spec: connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true host: localhost port: 1527 +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/ingestion-s3-ext/04-assert.yaml b/tests/templates/kuttl/ingestion-s3-ext/04-assert.yaml index 07a25600..dc085bb1 100644 --- a/tests/templates/kuttl/ingestion-s3-ext/04-assert.yaml +++ b/tests/templates/kuttl/ingestion-s3-ext/04-assert.yaml @@ -1,6 +1,12 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -commands: - - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/healthcheck.py derby-druid timeout: 300 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: checks +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/ingestion-s3-ext/03-checks-container.yaml b/tests/templates/kuttl/ingestion-s3-ext/04-checks-container.yaml similarity index 100% rename from tests/templates/kuttl/ingestion-s3-ext/03-checks-container.yaml rename to tests/templates/kuttl/ingestion-s3-ext/04-checks-container.yaml diff --git a/tests/templates/kuttl/ingestion-s3-ext/05-assert.yaml b/tests/templates/kuttl/ingestion-s3-ext/05-assert.yaml index 1e955ca3..07a25600 100644 --- a/tests/templates/kuttl/ingestion-s3-ext/05-assert.yaml +++ b/tests/templates/kuttl/ingestion-s3-ext/05-assert.yaml @@ -2,5 +2,5 @@ apiVersion: kuttl.dev/v1beta1 kind: TestAssert commands: - - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid + - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/healthcheck.py derby-druid timeout: 300 diff --git a/tests/templates/kuttl/ingestion-s3-ext/04-healthcheck.yaml b/tests/templates/kuttl/ingestion-s3-ext/05-healthcheck.yaml similarity index 100% rename from tests/templates/kuttl/ingestion-s3-ext/04-healthcheck.yaml rename to tests/templates/kuttl/ingestion-s3-ext/05-healthcheck.yaml diff --git a/tests/templates/kuttl/ingestion-s3-ext/06-assert.yaml b/tests/templates/kuttl/ingestion-s3-ext/06-assert.yaml new file mode 100644 index 00000000..1e955ca3 --- /dev/null +++ b/tests/templates/kuttl/ingestion-s3-ext/06-assert.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: kubectl exec -n $NAMESPACE checks-0 -- python /tmp/ingestioncheck.py derby-druid +timeout: 300 diff --git a/tests/templates/kuttl/ingestion-s3-ext/05-ingestioncheck.yaml b/tests/templates/kuttl/ingestion-s3-ext/06-ingestioncheck.yaml similarity index 100% rename from tests/templates/kuttl/ingestion-s3-ext/05-ingestioncheck.yaml rename to tests/templates/kuttl/ingestion-s3-ext/06-ingestioncheck.yaml diff --git a/tests/templates/kuttl/ldap-authentication/00-assert.yaml b/tests/templates/kuttl/ldap-authentication/00-assert.yaml deleted file mode 100644 index 4998bcdd..00000000 --- a/tests/templates/kuttl/ldap-authentication/00-assert.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 300 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-zk-server-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: hdfs-znode diff --git a/tests/templates/kuttl/ldap-authentication/00-assert.yaml.j2 b/tests/templates/kuttl/ldap-authentication/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/ldap-authentication/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/ldap-authentication/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/ldap-authentication/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/ldap-authentication/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/authorizer/00-assert.yaml b/tests/templates/kuttl/ldap-authentication/01-assert.yaml similarity index 100% rename from tests/templates/kuttl/authorizer/00-assert.yaml rename to tests/templates/kuttl/ldap-authentication/01-assert.yaml diff --git a/tests/templates/kuttl/ldap-authentication/00-install-zk.yaml.j2 b/tests/templates/kuttl/ldap-authentication/01-install-zk.yaml.j2 similarity index 71% rename from tests/templates/kuttl/ldap-authentication/00-install-zk.yaml.j2 rename to tests/templates/kuttl/ldap-authentication/01-install-zk.yaml.j2 index 9958d9fb..a6a17bc5 100644 --- a/tests/templates/kuttl/ldap-authentication/00-install-zk.yaml.j2 +++ b/tests/templates/kuttl/ldap-authentication/01-install-zk.yaml.j2 @@ -7,7 +7,15 @@ spec: image: productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/ldap-authentication/02-install-hdfs.yaml.j2 b/tests/templates/kuttl/ldap-authentication/02-install-hdfs.yaml.j2 index d3729bca..bba42532 100644 --- a/tests/templates/kuttl/ldap-authentication/02-install-hdfs.yaml.j2 +++ b/tests/templates/kuttl/ldap-authentication/02-install-hdfs.yaml.j2 @@ -10,20 +10,32 @@ kind: HdfsCluster metadata: name: druid-hdfs spec: - image: - productVersion: "{{ test_scenario['values']['hadoop-latest'].split('-stackable')[0] }}" - stackableVersion: "{{ test_scenario['values']['hadoop-latest'].split('-stackable')[1] }}" - zookeeperConfigMapName: hdfs-znode - dfsReplication: 1 - nameNodes: - roleGroups: - default: - replicas: 2 - dataNodes: - roleGroups: - default: - replicas: 1 - journalNodes: - roleGroups: - default: - replicas: 1 + image: + productVersion: "{{ test_scenario['values']['hadoop-latest'].split('-stackable')[0] }}" + stackableVersion: "{{ test_scenario['values']['hadoop-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} + zookeeperConfigMapName: hdfs-znode + dfsReplication: 1 + nameNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 2 + dataNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 1 + journalNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 1 diff --git a/tests/templates/kuttl/ldap-authentication/05-install-druid.yaml.j2 b/tests/templates/kuttl/ldap-authentication/05-install-druid.yaml.j2 index 8d4ce06c..f7d5744e 100644 --- a/tests/templates/kuttl/ldap-authentication/05-install-druid.yaml.j2 +++ b/tests/templates/kuttl/ldap-authentication/05-install-druid.yaml.j2 @@ -72,24 +72,42 @@ spec: port: 1527 tls: serverAndInternalSecretClass: null +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/logging/00-assert.yaml.j2 b/tests/templates/kuttl/logging/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/logging/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/logging/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/logging/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/logging/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/tls/00-assert.yaml b/tests/templates/kuttl/logging/01-assert.yaml similarity index 61% rename from tests/templates/kuttl/tls/00-assert.yaml rename to tests/templates/kuttl/logging/01-assert.yaml index 01aec7bb..291d6e25 100644 --- a/tests/templates/kuttl/tls/00-assert.yaml +++ b/tests/templates/kuttl/logging/01-assert.yaml @@ -6,12 +6,7 @@ timeout: 600 apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-zk-server-default + name: druid-vector-aggregator status: readyReplicas: 1 replicas: 1 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: druid-znode diff --git a/tests/templates/kuttl/logging/01-install-druid-vector-aggregator.yaml b/tests/templates/kuttl/logging/01-install-druid-vector-aggregator.yaml new file mode 100644 index 00000000..ff1d0187 --- /dev/null +++ b/tests/templates/kuttl/logging/01-install-druid-vector-aggregator.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: >- + helm install druid-vector-aggregator vector + --namespace $NAMESPACE + --version 0.19.2 + --repo https://helm.vector.dev + --values druid-vector-aggregator-values.yaml +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: druid-vector-aggregator-discovery +data: + ADDRESS: druid-vector-aggregator:6123 diff --git a/tests/templates/kuttl/ingestion-no-s3-ext/00-assert.yaml b/tests/templates/kuttl/logging/02-assert.yaml similarity index 100% rename from tests/templates/kuttl/ingestion-no-s3-ext/00-assert.yaml rename to tests/templates/kuttl/logging/02-assert.yaml diff --git a/tests/templates/kuttl/logging/02-install-zk.yaml.j2 b/tests/templates/kuttl/logging/02-install-zk.yaml.j2 new file mode 100644 index 00000000..a6a17bc5 --- /dev/null +++ b/tests/templates/kuttl/logging/02-install-zk.yaml.j2 @@ -0,0 +1,37 @@ +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperCluster +metadata: + name: druid-zk +spec: + image: + productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" + stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} + servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 1 +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperZnode +metadata: + name: druid-znode +spec: + clusterRef: + name: druid-zk +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperZnode +metadata: + name: hdfs-znode +spec: + clusterRef: + name: druid-zk diff --git a/tests/templates/kuttl/logging/03-assert.yaml b/tests/templates/kuttl/logging/03-assert.yaml new file mode 100644 index 00000000..f486d011 --- /dev/null +++ b/tests/templates/kuttl/logging/03-assert.yaml @@ -0,0 +1,28 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 300 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-hdfs-namenode-default +status: + readyReplicas: 2 + replicas: 2 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-hdfs-journalnode-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-hdfs-datanode-default +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/orphaned-resources/01-install-hdfs.yaml.j2 b/tests/templates/kuttl/logging/03-install-hdfs.yaml.j2 similarity index 58% rename from tests/templates/kuttl/orphaned-resources/01-install-hdfs.yaml.j2 rename to tests/templates/kuttl/logging/03-install-hdfs.yaml.j2 index 6f512cc9..851577fe 100644 --- a/tests/templates/kuttl/orphaned-resources/01-install-hdfs.yaml.j2 +++ b/tests/templates/kuttl/logging/03-install-hdfs.yaml.j2 @@ -13,17 +13,29 @@ spec: image: productVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: hdfs-znode dfsReplication: 1 nameNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 2 dataNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 journalNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/logging/04-assert.yaml b/tests/templates/kuttl/logging/04-assert.yaml new file mode 100644 index 00000000..24a89f8f --- /dev/null +++ b/tests/templates/kuttl/logging/04-assert.yaml @@ -0,0 +1,84 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 600 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-broker-automatic-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-broker-custom-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-coordinator-automatic-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-coordinator-custom-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-historical-automatic-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-historical-custom-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-middlemanager-automatic-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-middlemanager-custom-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-router-automatic-log-config +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test-druid-router-custom-log-config +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/logging/04-install-druid.yaml.j2 b/tests/templates/kuttl/logging/04-install-druid.yaml.j2 new file mode 100644 index 00000000..d7184d27 --- /dev/null +++ b/tests/templates/kuttl/logging/04-install-druid.yaml.j2 @@ -0,0 +1,249 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +metadata: + name: install-druid +timeout: 600 +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: druid-log-config +data: + log4j2.properties: |- + appenders = FILE + + appender.FILE.type = File + appender.FILE.name = FILE + appender.FILE.fileName = /stackable/log/druid/druid.log4j2.xml + appender.FILE.layout.type = XMLLayout + + rootLogger.level=INFO + rootLogger.appenderRefs = FILE + rootLogger.appenderRef.FILE.ref = FILE +--- +apiVersion: druid.stackable.tech/v1alpha1 +kind: DruidCluster +metadata: + name: test-druid +spec: + image: + productVersion: "{{ test_scenario['values']['druid'].split('-stackable')[0] }}" + stackableVersion: "{{ test_scenario['values']['druid'].split('-stackable')[1] }}" + clusterConfig: + deepStorage: + hdfs: + configMapName: druid-hdfs + directory: /druid + metadataStorageDatabase: + dbType: derby + connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true + host: localhost + port: 1527 + vectorAggregatorConfigMapName: druid-vector-aggregator-discovery + zookeeperConfigMapName: druid-znode + brokers: + roleGroups: + automatic-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + prepare: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + vector: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + custom-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + custom: + configMap: druid-log-config + coordinators: + roleGroups: + automatic-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + prepare: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + vector: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + custom-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + custom: + configMap: druid-log-config + historicals: + roleGroups: + automatic-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + prepare: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + vector: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + custom-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + custom: + configMap: druid-log-config + middleManagers: + roleGroups: + automatic-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + prepare: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + vector: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + custom-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + custom: + configMap: druid-log-config + routers: + roleGroups: + automatic-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + prepare: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + vector: + console: + level: INFO + file: + level: INFO + loggers: + ROOT: + level: INFO + custom-log-config: + replicas: 1 + config: + logging: + enableVectorAgent: true + containers: + druid: + custom: + configMap: druid-log-config diff --git a/tests/templates/kuttl/smoke/00-assert.yaml b/tests/templates/kuttl/logging/05-assert.yaml similarity index 78% rename from tests/templates/kuttl/smoke/00-assert.yaml rename to tests/templates/kuttl/logging/05-assert.yaml index 7702af69..1e03d73b 100644 --- a/tests/templates/kuttl/smoke/00-assert.yaml +++ b/tests/templates/kuttl/logging/05-assert.yaml @@ -1,12 +1,12 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 480 +timeout: 300 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-postgresql + name: druid-test-runner status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/logging/05-install-druid-test-runner.yaml b/tests/templates/kuttl/logging/05-install-druid-test-runner.yaml new file mode 100644 index 00000000..85f3c5f0 --- /dev/null +++ b/tests/templates/kuttl/logging/05-install-druid-test-runner.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-test-runner + labels: + app: druid-test-runner +spec: + replicas: 1 + selector: + matchLabels: + app: druid-test-runner + template: + metadata: + labels: + app: druid-test-runner + spec: + containers: + - name: druid-test-runner + image: docker.stackable.tech/stackable/testing-tools:0.1.0-stackable0.1.0 + stdin: true + tty: true diff --git a/tests/templates/kuttl/logging/06-assert.yaml b/tests/templates/kuttl/logging/06-assert.yaml new file mode 100644 index 00000000..36441c1d --- /dev/null +++ b/tests/templates/kuttl/logging/06-assert.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: >- + kubectl exec --namespace=$NAMESPACE druid-test-runner-0 -- + python /tmp/test_log_aggregation.py -n $NAMESPACE diff --git a/tests/templates/kuttl/logging/06-test-log-aggregation.yaml b/tests/templates/kuttl/logging/06-test-log-aggregation.yaml new file mode 100644 index 00000000..bba950db --- /dev/null +++ b/tests/templates/kuttl/logging/06-test-log-aggregation.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + kubectl cp ./test_log_aggregation.py $NAMESPACE/druid-test-runner-0:/tmp diff --git a/tests/templates/kuttl/logging/druid-vector-aggregator-values.yaml.j2 b/tests/templates/kuttl/logging/druid-vector-aggregator-values.yaml.j2 new file mode 100644 index 00000000..d362970f --- /dev/null +++ b/tests/templates/kuttl/logging/druid-vector-aggregator-values.yaml.j2 @@ -0,0 +1,211 @@ +--- +role: Aggregator +service: + ports: + - name: api + port: 8686 + protocol: TCP + targetPort: 8686 + - name: vector + port: 6123 + protocol: TCP + targetPort: 6000 +customConfig: + api: + address: 0.0.0.0:8686 + enabled: true + sources: + vector: + address: 0.0.0.0:6000 + type: vector + version: "2" + transforms: + automaticLogConfigBrokerDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-broker-automatic-log-config-0" && + .container == "druid" + automaticLogConfigBrokerPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-broker-automatic-log-config-0" && + .container == "prepare" + automaticLogConfigBrokerVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-broker-automatic-log-config-0" && + .container == "vector" + customLogConfigBrokerDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-broker-custom-log-config-0" && + .container == "druid" + customLogConfigBrokerPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-broker-custom-log-config-0" && + .container == "prepare" + customLogConfigBrokerVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-broker-custom-log-config-0" && + .container == "vector" + automaticLogConfigCoordinatorDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-coordinator-automatic-log-config-0" && + .container == "druid" + automaticLogConfigCoordinatorPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-coordinator-automatic-log-config-0" && + .container == "prepare" + automaticLogConfigCoordinatorVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-coordinator-automatic-log-config-0" && + .container == "vector" + customLogConfigCoordinatorDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-coordinator-custom-log-config-0" && + .container == "druid" + customLogConfigCoordinatorPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-coordinator-custom-log-config-0" && + .container == "prepare" + customLogConfigCoordinatorVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-coordinator-custom-log-config-0" && + .container == "vector" + automaticLogConfigHistoricalDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-historical-automatic-log-config-0" && + .container == "druid" + automaticLogConfigHistoricalPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-historical-automatic-log-config-0" && + .container == "prepare" + automaticLogConfigHistoricalVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-historical-automatic-log-config-0" && + .container == "vector" + customLogConfigHistoricalDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-historical-custom-log-config-0" && + .container == "druid" + customLogConfigHistoricalPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-historical-custom-log-config-0" && + .container == "prepare" + customLogConfigHistoricalVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-historical-custom-log-config-0" && + .container == "vector" + automaticLogConfigMiddlemanagerDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-middlemanager-automatic-log-config-0" && + .container == "druid" + automaticLogConfigMiddlemanagerPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-middlemanager-automatic-log-config-0" && + .container == "prepare" + automaticLogConfigMiddlemanagerVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-middlemanager-automatic-log-config-0" && + .container == "vector" + customLogConfigMiddlemanagerDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-middlemanager-custom-log-config-0" && + .container == "druid" + customLogConfigMiddlemanagerPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-middlemanager-custom-log-config-0" && + .container == "prepare" + customLogConfigMiddlemanagerVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-middlemanager-custom-log-config-0" && + .container == "vector" + automaticLogConfigRouterDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-router-automatic-log-config-0" && + .container == "druid" + automaticLogConfigRouterPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-router-automatic-log-config-0" && + .container == "prepare" + automaticLogConfigRouterVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-router-automatic-log-config-0" && + .container == "vector" + customLogConfigRouterDruid: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-router-custom-log-config-0" && + .container == "druid" + customLogConfigRouterPrepare: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-router-custom-log-config-0" && + .container == "prepare" + customLogConfigRouterVector: + type: filter + inputs: [vector] + condition: >- + .pod == "test-druid-router-custom-log-config-0" && + .container == "vector" + sinks: + out: + inputs: [automaticLogConfig*, customLogConfig*] +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + type: vector + address: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% else %} + type: blackhole +{% endif %} diff --git a/tests/templates/kuttl/logging/test_log_aggregation.py b/tests/templates/kuttl/logging/test_log_aggregation.py new file mode 100755 index 00000000..b8ecf18a --- /dev/null +++ b/tests/templates/kuttl/logging/test_log_aggregation.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +import requests + + +def check_processed_events(): + response = requests.post( + 'http://druid-vector-aggregator:8686/graphql', + json={ + 'query': """ + { + transforms(first:100) { + nodes { + componentId + metrics { + processedEventsTotal { + processedEventsTotal + } + } + } + } + } + """ + } + ) + + assert response.status_code == 200, \ + 'Cannot access the API of the vector aggregator.' + + result = response.json() + + transforms = result['data']['transforms']['nodes'] + for transform in transforms: + processedEvents = transform['metrics']['processedEventsTotal']['processedEventsTotal'] + componentId = transform['componentId'] + assert processedEvents > 0, \ + f'No events were processed in "{componentId}".' + + +if __name__ == '__main__': + check_processed_events() + print('Test successful!') diff --git a/tests/templates/kuttl/orphaned-resources/00-assert.yaml b/tests/templates/kuttl/orphaned-resources/00-assert.yaml deleted file mode 100644 index 4998bcdd..00000000 --- a/tests/templates/kuttl/orphaned-resources/00-assert.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 300 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-zk-server-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: hdfs-znode diff --git a/tests/templates/kuttl/orphaned-resources/00-assert.yaml.j2 b/tests/templates/kuttl/orphaned-resources/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/orphaned-resources/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/orphaned-resources/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/orphaned-resources/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/orphaned-resources/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/orphaned-resources/00-install-zk.yaml.j2 b/tests/templates/kuttl/orphaned-resources/00-install-zk.yaml.j2 deleted file mode 100644 index 9958d9fb..00000000 --- a/tests/templates/kuttl/orphaned-resources/00-install-zk.yaml.j2 +++ /dev/null @@ -1,29 +0,0 @@ ---- -apiVersion: zookeeper.stackable.tech/v1alpha1 -kind: ZookeeperCluster -metadata: - name: druid-zk -spec: - image: - productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" - stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" - servers: - roleGroups: - default: - replicas: 1 ---- -apiVersion: zookeeper.stackable.tech/v1alpha1 -kind: ZookeeperZnode -metadata: - name: druid-znode -spec: - clusterRef: - name: druid-zk ---- -apiVersion: zookeeper.stackable.tech/v1alpha1 -kind: ZookeeperZnode -metadata: - name: hdfs-znode -spec: - clusterRef: - name: druid-zk diff --git a/tests/templates/kuttl/orphaned-resources/01-assert.yaml b/tests/templates/kuttl/orphaned-resources/01-assert.yaml index f486d011..4998bcdd 100644 --- a/tests/templates/kuttl/orphaned-resources/01-assert.yaml +++ b/tests/templates/kuttl/orphaned-resources/01-assert.yaml @@ -6,23 +6,12 @@ timeout: 300 apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-hdfs-namenode-default -status: - readyReplicas: 2 - replicas: 2 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-hdfs-journalnode-default + name: druid-zk-server-default status: readyReplicas: 1 replicas: 1 --- -apiVersion: apps/v1 -kind: StatefulSet +apiVersion: v1 +kind: ConfigMap metadata: - name: druid-hdfs-datanode-default -status: - readyReplicas: 1 - replicas: 1 + name: hdfs-znode diff --git a/tests/templates/kuttl/orphaned-resources/01-install-zk.yaml.j2 b/tests/templates/kuttl/orphaned-resources/01-install-zk.yaml.j2 new file mode 100644 index 00000000..a6a17bc5 --- /dev/null +++ b/tests/templates/kuttl/orphaned-resources/01-install-zk.yaml.j2 @@ -0,0 +1,37 @@ +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperCluster +metadata: + name: druid-zk +spec: + image: + productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" + stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} + servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 1 +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperZnode +metadata: + name: druid-znode +spec: + clusterRef: + name: druid-zk +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperZnode +metadata: + name: hdfs-znode +spec: + clusterRef: + name: druid-zk diff --git a/tests/templates/kuttl/orphaned-resources/02-assert.yaml b/tests/templates/kuttl/orphaned-resources/02-assert.yaml index a3331d5c..f486d011 100644 --- a/tests/templates/kuttl/orphaned-resources/02-assert.yaml +++ b/tests/templates/kuttl/orphaned-resources/02-assert.yaml @@ -1,36 +1,20 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 600 +timeout: 300 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-broker-default + name: druid-hdfs-namenode-default status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-coordinator-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: derby-druid-historical-default -status: - readyReplicas: 1 - replicas: 1 + readyReplicas: 2 + replicas: 2 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-middlemanager-default + name: druid-hdfs-journalnode-default status: readyReplicas: 1 replicas: 1 @@ -38,7 +22,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-router-default + name: druid-hdfs-datanode-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/ingestion-s3-ext/01-install-hdfs.yaml.j2 b/tests/templates/kuttl/orphaned-resources/02-install-hdfs.yaml.j2 similarity index 58% rename from tests/templates/kuttl/ingestion-s3-ext/01-install-hdfs.yaml.j2 rename to tests/templates/kuttl/orphaned-resources/02-install-hdfs.yaml.j2 index 6f512cc9..851577fe 100644 --- a/tests/templates/kuttl/ingestion-s3-ext/01-install-hdfs.yaml.j2 +++ b/tests/templates/kuttl/orphaned-resources/02-install-hdfs.yaml.j2 @@ -13,17 +13,29 @@ spec: image: productVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: hdfs-znode dfsReplication: 1 nameNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 2 dataNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 journalNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/orphaned-resources/03-assert.yaml b/tests/templates/kuttl/orphaned-resources/03-assert.yaml index 9dc71495..a3331d5c 100644 --- a/tests/templates/kuttl/orphaned-resources/03-assert.yaml +++ b/tests/templates/kuttl/orphaned-resources/03-assert.yaml @@ -1,12 +1,12 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 180 +timeout: 600 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-broker-newrg + name: derby-druid-broker-default status: readyReplicas: 1 replicas: 1 @@ -14,7 +14,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-coordinator-newrg + name: derby-druid-coordinator-default status: readyReplicas: 1 replicas: 1 @@ -22,7 +22,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-historical-newrg + name: derby-druid-historical-default status: readyReplicas: 1 replicas: 1 @@ -30,7 +30,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-middlemanager-newrg + name: derby-druid-middlemanager-default status: readyReplicas: 1 replicas: 1 @@ -38,7 +38,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: derby-druid-router-newrg + name: derby-druid-router-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/orphaned-resources/02-install-druid.yaml.j2 b/tests/templates/kuttl/orphaned-resources/03-install-druid.yaml.j2 similarity index 60% rename from tests/templates/kuttl/orphaned-resources/02-install-druid.yaml.j2 rename to tests/templates/kuttl/orphaned-resources/03-install-druid.yaml.j2 index 1de84747..1c0964ae 100644 --- a/tests/templates/kuttl/orphaned-resources/02-install-druid.yaml.j2 +++ b/tests/templates/kuttl/orphaned-resources/03-install-druid.yaml.j2 @@ -23,24 +23,42 @@ spec: connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true host: localhost port: 1527 +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/orphaned-resources/04-assert.yaml b/tests/templates/kuttl/orphaned-resources/04-assert.yaml new file mode 100644 index 00000000..9dc71495 --- /dev/null +++ b/tests/templates/kuttl/orphaned-resources/04-assert.yaml @@ -0,0 +1,44 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 180 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-broker-newrg +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-coordinator-newrg +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-historical-newrg +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-middlemanager-newrg +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: derby-druid-router-newrg +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/orphaned-resources/03-errors.yaml b/tests/templates/kuttl/orphaned-resources/04-errors.yaml similarity index 100% rename from tests/templates/kuttl/orphaned-resources/03-errors.yaml rename to tests/templates/kuttl/orphaned-resources/04-errors.yaml diff --git a/tests/templates/kuttl/orphaned-resources/03-update-druid.yaml.j2 b/tests/templates/kuttl/orphaned-resources/04-update-druid.yaml.j2 similarity index 62% rename from tests/templates/kuttl/orphaned-resources/03-update-druid.yaml.j2 rename to tests/templates/kuttl/orphaned-resources/04-update-druid.yaml.j2 index 7fdfd88e..708ed3f1 100644 --- a/tests/templates/kuttl/orphaned-resources/03-update-druid.yaml.j2 +++ b/tests/templates/kuttl/orphaned-resources/04-update-druid.yaml.j2 @@ -23,28 +23,46 @@ spec: connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true host: localhost port: 1527 +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: null newrg: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: null newrg: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: null newrg: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: null newrg: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: null newrg: diff --git a/tests/templates/kuttl/resources/00-assert.yaml.j2 b/tests/templates/kuttl/resources/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/resources/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/resources/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/resources/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/resources/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/resources/00-install-zk.yaml.j2 b/tests/templates/kuttl/resources/00-install-zk.yaml.j2 deleted file mode 100644 index e3f705b9..00000000 --- a/tests/templates/kuttl/resources/00-install-zk.yaml.j2 +++ /dev/null @@ -1,21 +0,0 @@ ---- -apiVersion: zookeeper.stackable.tech/v1alpha1 -kind: ZookeeperCluster -metadata: - name: druid-zk -spec: - image: - productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" - stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" - servers: - roleGroups: - default: - replicas: 1 ---- -apiVersion: zookeeper.stackable.tech/v1alpha1 -kind: ZookeeperZnode -metadata: - name: druid-znode -spec: - clusterRef: - name: druid-zk diff --git a/tests/templates/kuttl/hdfs-deep-storage/00-assert.yaml b/tests/templates/kuttl/resources/10-assert.yaml similarity index 100% rename from tests/templates/kuttl/hdfs-deep-storage/00-assert.yaml rename to tests/templates/kuttl/resources/10-assert.yaml diff --git a/tests/templates/kuttl/resources/10-install-zk.yaml.j2 b/tests/templates/kuttl/resources/10-install-zk.yaml.j2 new file mode 100644 index 00000000..9b6e4d5b --- /dev/null +++ b/tests/templates/kuttl/resources/10-install-zk.yaml.j2 @@ -0,0 +1,29 @@ +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperCluster +metadata: + name: druid-zk +spec: + image: + productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" + stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} + servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 1 +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperZnode +metadata: + name: druid-znode +spec: + clusterRef: + name: druid-zk diff --git a/tests/templates/kuttl/resources/10-install-minio.yaml.j2 b/tests/templates/kuttl/resources/20-install-minio.yaml.j2 similarity index 100% rename from tests/templates/kuttl/resources/10-install-minio.yaml.j2 rename to tests/templates/kuttl/resources/20-install-minio.yaml.j2 diff --git a/tests/templates/kuttl/resources/20-assert.yaml b/tests/templates/kuttl/resources/30-assert.yaml.j2 similarity index 84% rename from tests/templates/kuttl/resources/20-assert.yaml rename to tests/templates/kuttl/resources/30-assert.yaml.j2 index a0ecb6c8..aef92fe6 100644 --- a/tests/templates/kuttl/resources/20-assert.yaml +++ b/tests/templates/kuttl/resources/30-assert.yaml.j2 @@ -19,6 +19,9 @@ spec: limits: cpu: "4" memory: 2Gi +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + - name: vector +{% endif %} status: readyReplicas: 1 replicas: 1 @@ -39,6 +42,9 @@ spec: limits: cpu: "4" memory: 2Gi +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + - name: vector +{% endif %} status: readyReplicas: 1 replicas: 1 @@ -59,6 +65,9 @@ spec: limits: cpu: "4" memory: 4Gi +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + - name: vector +{% endif %} volumes: - name: tls-mount ephemeral: @@ -77,6 +86,8 @@ spec: name: druid-resources-historical-default - name: rwconfig emptyDir: {} + - name: log-config + - name: log - name: segment-cache emptyDir: sizeLimit: 2G @@ -100,6 +111,9 @@ spec: limits: cpu: "1" memory: 1Gi +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + - name: vector +{% endif %} status: readyReplicas: 1 replicas: 1 @@ -120,6 +134,9 @@ spec: limits: cpu: "3" memory: 3Gi +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + - name: vector +{% endif %} --- apiVersion: apps/v1 kind: StatefulSet @@ -137,6 +154,9 @@ spec: limits: cpu: "4" memory: 2Gi +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + - name: vector +{% endif %} status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/resources/20-install-druid.yaml.j2 b/tests/templates/kuttl/resources/30-install-druid.yaml.j2 similarity index 72% rename from tests/templates/kuttl/resources/20-install-druid.yaml.j2 rename to tests/templates/kuttl/resources/30-install-druid.yaml.j2 index dede7824..6e7ec232 100644 --- a/tests/templates/kuttl/resources/20-install-druid.yaml.j2 +++ b/tests/templates/kuttl/resources/30-install-druid.yaml.j2 @@ -27,16 +27,28 @@ spec: connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true host: localhost port: 1527 +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 @@ -52,6 +64,8 @@ spec: middleManagers: config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} resources: cpu: min: 100m @@ -71,6 +85,9 @@ spec: limit: 3Gi replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/resources/30-assert.yaml b/tests/templates/kuttl/resources/40-assert.yaml similarity index 100% rename from tests/templates/kuttl/resources/30-assert.yaml rename to tests/templates/kuttl/resources/40-assert.yaml diff --git a/tests/templates/kuttl/s3-deep-storage/00-assert.yaml.j2 b/tests/templates/kuttl/s3-deep-storage/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/s3-deep-storage/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/s3-deep-storage/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/s3-deep-storage/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/s3-deep-storage/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/resources/00-assert.yaml b/tests/templates/kuttl/s3-deep-storage/01-assert.yaml similarity index 100% rename from tests/templates/kuttl/resources/00-assert.yaml rename to tests/templates/kuttl/s3-deep-storage/01-assert.yaml diff --git a/tests/templates/kuttl/s3-deep-storage/00-install-zk.yaml.j2 b/tests/templates/kuttl/s3-deep-storage/01-install-zk.yaml.j2 similarity index 67% rename from tests/templates/kuttl/s3-deep-storage/00-install-zk.yaml.j2 rename to tests/templates/kuttl/s3-deep-storage/01-install-zk.yaml.j2 index 80aa215e..42c7dd18 100644 --- a/tests/templates/kuttl/s3-deep-storage/00-install-zk.yaml.j2 +++ b/tests/templates/kuttl/s3-deep-storage/01-install-zk.yaml.j2 @@ -7,7 +7,15 @@ spec: image: productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/s3-deep-storage/01-install-minio-certificates.yaml.j2 b/tests/templates/kuttl/s3-deep-storage/02-install-minio-certificates.yaml.j2 similarity index 100% rename from tests/templates/kuttl/s3-deep-storage/01-install-minio-certificates.yaml.j2 rename to tests/templates/kuttl/s3-deep-storage/02-install-minio-certificates.yaml.j2 diff --git a/tests/templates/kuttl/s3-deep-storage/02-install-minio.yaml.j2 b/tests/templates/kuttl/s3-deep-storage/03-install-minio.yaml.j2 similarity index 100% rename from tests/templates/kuttl/s3-deep-storage/02-install-minio.yaml.j2 rename to tests/templates/kuttl/s3-deep-storage/03-install-minio.yaml.j2 diff --git a/tests/templates/kuttl/s3-deep-storage/03-assert.yaml b/tests/templates/kuttl/s3-deep-storage/04-assert.yaml similarity index 100% rename from tests/templates/kuttl/s3-deep-storage/03-assert.yaml rename to tests/templates/kuttl/s3-deep-storage/04-assert.yaml diff --git a/tests/templates/kuttl/s3-deep-storage/03-checks-container.yaml b/tests/templates/kuttl/s3-deep-storage/04-checks-container.yaml similarity index 100% rename from tests/templates/kuttl/s3-deep-storage/03-checks-container.yaml rename to tests/templates/kuttl/s3-deep-storage/04-checks-container.yaml diff --git a/tests/templates/kuttl/s3-deep-storage/10-install-druid.yaml.j2 b/tests/templates/kuttl/s3-deep-storage/10-install-druid.yaml.j2 index a06c63d4..ebf9c0b5 100644 --- a/tests/templates/kuttl/s3-deep-storage/10-install-druid.yaml.j2 +++ b/tests/templates/kuttl/s3-deep-storage/10-install-druid.yaml.j2 @@ -59,24 +59,42 @@ spec: connString: jdbc:derby://localhost:1527/var/druid/metadata.db;create=true host: localhost port: 1527 +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/smoke/00-assert.yaml.j2 b/tests/templates/kuttl/smoke/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/smoke/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/smoke/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/smoke/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/smoke/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/smoke/01-assert.yaml b/tests/templates/kuttl/smoke/01-assert.yaml index 4998bcdd..7702af69 100644 --- a/tests/templates/kuttl/smoke/01-assert.yaml +++ b/tests/templates/kuttl/smoke/01-assert.yaml @@ -1,17 +1,12 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 300 +timeout: 480 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-zk-server-default + name: druid-postgresql status: readyReplicas: 1 replicas: 1 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: hdfs-znode diff --git a/tests/templates/kuttl/smoke/00-install-postgres.yaml b/tests/templates/kuttl/smoke/01-install-postgres.yaml similarity index 100% rename from tests/templates/kuttl/smoke/00-install-postgres.yaml rename to tests/templates/kuttl/smoke/01-install-postgres.yaml diff --git a/tests/templates/kuttl/smoke/02-assert.yaml b/tests/templates/kuttl/smoke/02-assert.yaml index f486d011..4998bcdd 100644 --- a/tests/templates/kuttl/smoke/02-assert.yaml +++ b/tests/templates/kuttl/smoke/02-assert.yaml @@ -6,23 +6,12 @@ timeout: 300 apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-hdfs-namenode-default -status: - readyReplicas: 2 - replicas: 2 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-hdfs-journalnode-default + name: druid-zk-server-default status: readyReplicas: 1 replicas: 1 --- -apiVersion: apps/v1 -kind: StatefulSet +apiVersion: v1 +kind: ConfigMap metadata: - name: druid-hdfs-datanode-default -status: - readyReplicas: 1 - replicas: 1 + name: hdfs-znode diff --git a/tests/templates/kuttl/smoke/01-install-zk.yaml.j2 b/tests/templates/kuttl/smoke/02-install-zk.yaml.j2 similarity index 70% rename from tests/templates/kuttl/smoke/01-install-zk.yaml.j2 rename to tests/templates/kuttl/smoke/02-install-zk.yaml.j2 index a4d5f401..578fcf55 100644 --- a/tests/templates/kuttl/smoke/01-install-zk.yaml.j2 +++ b/tests/templates/kuttl/smoke/02-install-zk.yaml.j2 @@ -7,7 +7,15 @@ spec: image: productVersion: "{{ test_scenario['values']['zookeeper'].split('-stackable')[0] }}" stackableVersion: "{{ test_scenario['values']['zookeeper'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/smoke/03-assert.yaml b/tests/templates/kuttl/smoke/03-assert.yaml index a37d231d..f486d011 100644 --- a/tests/templates/kuttl/smoke/03-assert.yaml +++ b/tests/templates/kuttl/smoke/03-assert.yaml @@ -1,63 +1,20 @@ --- apiVersion: kuttl.dev/v1beta1 kind: TestAssert -timeout: 600 +timeout: 300 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-broker-default + name: druid-hdfs-namenode-default status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-coordinator-default -status: - readyReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: druid-historical-default -status: - readyReplicas: 1 - replicas: 1 -spec: - template: - spec: - volumes: - - name: tls-mount - ephemeral: - volumeClaimTemplate: - metadata: - annotations: - secrets.stackable.tech/class: tls - secrets.stackable.tech/scope: pod,node - creationTimestamp: null - spec: - storageClassName: secrets.stackable.tech - - name: tls - emptyDir: {} - - name: config - configMap: - name: druid-historical-default - - name: rwconfig - emptyDir: {} - - name: hdfs - configMap: - name: druid-hdfs - - name: segment-cache - emptyDir: - sizeLimit: 1G + readyReplicas: 2 + replicas: 2 --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-middlemanager-default + name: druid-hdfs-journalnode-default status: readyReplicas: 1 replicas: 1 @@ -65,7 +22,7 @@ status: apiVersion: apps/v1 kind: StatefulSet metadata: - name: druid-router-default + name: druid-hdfs-datanode-default status: readyReplicas: 1 replicas: 1 diff --git a/tests/templates/kuttl/smoke/03-install-hdfs.yaml.j2 b/tests/templates/kuttl/smoke/03-install-hdfs.yaml.j2 new file mode 100644 index 00000000..851577fe --- /dev/null +++ b/tests/templates/kuttl/smoke/03-install-hdfs.yaml.j2 @@ -0,0 +1,41 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +metadata: + name: druid-hdfs +timeout: 600 +--- +apiVersion: hdfs.stackable.tech/v1alpha1 +kind: HdfsCluster +metadata: + name: druid-hdfs +spec: + image: + productVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[0] }}" + stackableVersion: "{{ test_scenario['values']['hadoop'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} + zookeeperConfigMapName: hdfs-znode + dfsReplication: 1 + nameNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 2 + dataNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 1 + journalNodes: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 1 diff --git a/tests/templates/kuttl/smoke/04-assert.yaml b/tests/templates/kuttl/smoke/04-assert.yaml new file mode 100644 index 00000000..91a06143 --- /dev/null +++ b/tests/templates/kuttl/smoke/04-assert.yaml @@ -0,0 +1,73 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 600 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-broker-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-coordinator-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-historical-default +status: + readyReplicas: 1 + replicas: 1 +spec: + template: + spec: + volumes: + - name: tls-mount + ephemeral: + volumeClaimTemplate: + metadata: + annotations: + secrets.stackable.tech/class: tls + secrets.stackable.tech/scope: pod,node + creationTimestamp: null + spec: + storageClassName: secrets.stackable.tech + - name: tls + emptyDir: {} + - name: config + configMap: + name: druid-historical-default + - name: rwconfig + emptyDir: {} + - name: log-config + - name: log + - name: hdfs + configMap: + name: druid-hdfs + - name: segment-cache + emptyDir: + sizeLimit: 1G +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-middlemanager-default +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: druid-router-default +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/smoke/03-install-druid.yaml.j2 b/tests/templates/kuttl/smoke/04-install-druid.yaml.j2 similarity index 61% rename from tests/templates/kuttl/smoke/03-install-druid.yaml.j2 rename to tests/templates/kuttl/smoke/04-install-druid.yaml.j2 index abf9c8d9..5fd5e800 100644 --- a/tests/templates/kuttl/smoke/03-install-druid.yaml.j2 +++ b/tests/templates/kuttl/smoke/04-install-druid.yaml.j2 @@ -25,24 +25,42 @@ spec: port: 5432 user: druid password: druid +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/tls/00-assert.yaml.j2 b/tests/templates/kuttl/tls/00-assert.yaml.j2 new file mode 100644 index 00000000..50b1d4c3 --- /dev/null +++ b/tests/templates/kuttl/tls/00-assert.yaml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +{% endif %} diff --git a/tests/templates/kuttl/tls/00-install-vector-aggregator-discovery-configmap.yaml.j2 b/tests/templates/kuttl/tls/00-install-vector-aggregator-discovery-configmap.yaml.j2 new file mode 100644 index 00000000..2d6a0df5 --- /dev/null +++ b/tests/templates/kuttl/tls/00-install-vector-aggregator-discovery-configmap.yaml.j2 @@ -0,0 +1,9 @@ +{% if lookup('env', 'VECTOR_AGGREGATOR') %} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vector-aggregator-discovery +data: + ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }} +{% endif %} diff --git a/tests/templates/kuttl/tls/00-install-zk.yaml.j2 b/tests/templates/kuttl/tls/00-install-zk.yaml.j2 deleted file mode 100644 index e3f705b9..00000000 --- a/tests/templates/kuttl/tls/00-install-zk.yaml.j2 +++ /dev/null @@ -1,21 +0,0 @@ ---- -apiVersion: zookeeper.stackable.tech/v1alpha1 -kind: ZookeeperCluster -metadata: - name: druid-zk -spec: - image: - productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" - stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" - servers: - roleGroups: - default: - replicas: 1 ---- -apiVersion: zookeeper.stackable.tech/v1alpha1 -kind: ZookeeperZnode -metadata: - name: druid-znode -spec: - clusterRef: - name: druid-zk diff --git a/tests/templates/kuttl/s3-deep-storage/00-assert.yaml b/tests/templates/kuttl/tls/01-assert.yaml similarity index 100% rename from tests/templates/kuttl/s3-deep-storage/00-assert.yaml rename to tests/templates/kuttl/tls/01-assert.yaml diff --git a/tests/templates/kuttl/tls/01-install-zk.yaml.j2 b/tests/templates/kuttl/tls/01-install-zk.yaml.j2 new file mode 100644 index 00000000..9b6e4d5b --- /dev/null +++ b/tests/templates/kuttl/tls/01-install-zk.yaml.j2 @@ -0,0 +1,29 @@ +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperCluster +metadata: + name: druid-zk +spec: + image: + productVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[0] }}" + stackableVersion: "{{ test_scenario['values']['zookeeper-latest'].split('-stackable')[1] }}" +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + clusterConfig: + logging: + vectorAggregatorConfigMapName: vector-aggregator-discovery +{% endif %} + servers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} + roleGroups: + default: + replicas: 1 +--- +apiVersion: zookeeper.stackable.tech/v1alpha1 +kind: ZookeeperZnode +metadata: + name: druid-znode +spec: + clusterRef: + name: druid-zk diff --git a/tests/templates/kuttl/tls/01-install-minio-certificates.yaml.j2 b/tests/templates/kuttl/tls/02-install-minio-certificates.yaml.j2 similarity index 100% rename from tests/templates/kuttl/tls/01-install-minio-certificates.yaml.j2 rename to tests/templates/kuttl/tls/02-install-minio-certificates.yaml.j2 diff --git a/tests/templates/kuttl/tls/02-install-minio.yaml.j2 b/tests/templates/kuttl/tls/03-install-minio.yaml.j2 similarity index 100% rename from tests/templates/kuttl/tls/02-install-minio.yaml.j2 rename to tests/templates/kuttl/tls/03-install-minio.yaml.j2 diff --git a/tests/templates/kuttl/tls/03-assert.yaml.j2 b/tests/templates/kuttl/tls/04-assert.yaml.j2 similarity index 100% rename from tests/templates/kuttl/tls/03-assert.yaml.j2 rename to tests/templates/kuttl/tls/04-assert.yaml.j2 diff --git a/tests/templates/kuttl/tls/03-install-druid.yaml.j2 b/tests/templates/kuttl/tls/04-install-druid.yaml.j2 similarity index 80% rename from tests/templates/kuttl/tls/03-install-druid.yaml.j2 rename to tests/templates/kuttl/tls/04-install-druid.yaml.j2 index 90ec1491..c8e3bffe 100644 --- a/tests/templates/kuttl/tls/03-install-druid.yaml.j2 +++ b/tests/templates/kuttl/tls/04-install-druid.yaml.j2 @@ -88,25 +88,43 @@ spec: serverAndInternalSecretClass: druid-tls {% else %} tls: null +{% endif %} +{% if lookup('env', 'VECTOR_AGGREGATOR') %} + vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} zookeeperConfigMapName: druid-znode brokers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 coordinators: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 historicals: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 middleManagers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 routers: + config: + logging: + enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} roleGroups: default: replicas: 1 diff --git a/tests/templates/kuttl/tls/04-assert.yaml b/tests/templates/kuttl/tls/05-assert.yaml similarity index 100% rename from tests/templates/kuttl/tls/04-assert.yaml rename to tests/templates/kuttl/tls/05-assert.yaml diff --git a/tests/templates/kuttl/tls/04-install-checks.yaml.j2 b/tests/templates/kuttl/tls/05-install-checks.yaml.j2 similarity index 100% rename from tests/templates/kuttl/tls/04-install-checks.yaml.j2 rename to tests/templates/kuttl/tls/05-install-checks.yaml.j2 diff --git a/tests/test-definition.yaml b/tests/test-definition.yaml index 3032d9b8..24ccc073 100644 --- a/tests/test-definition.yaml +++ b/tests/test-definition.yaml @@ -2,27 +2,27 @@ dimensions: - name: druid values: - - 0.23.0-stackable0.3.0 - - 24.0.0-stackable0.3.0 + - 0.23.0-stackable23.4.0-rc2 + - 24.0.0-stackable23.4.0-rc2 - name: druid-latest values: - - 24.0.0-stackable0.3.0 + - 24.0.0-stackable23.4.0-rc2 - name: zookeeper values: - - 3.7.0-stackable0.9.0 - - 3.8.0-stackable0.9.0 + - 3.7.0-stackable23.4.0-rc2 + - 3.8.0-stackable23.4.0-rc2 - name: zookeeper-latest values: - - 3.8.0-stackable0.8.0 + - 3.8.0-stackable23.4.0-rc2 - name: opa values: - - 0.45.0-stackable0.3.0 + - 0.45.0-stackable23.4.0-rc2 - name: hadoop values: - - 3.3.4-stackable0.3.0 + - 3.3.4-stackable23.4.0-rc2 - name: hadoop-latest values: - - 3.3.4-stackable0.3.0 + - 3.3.4-stackable23.4.0-rc2 - name: s3-use-tls values: - "true" @@ -94,3 +94,8 @@ tests: - hadoop-latest - ldap-use-tls - ldap-no-bind-credentials + - name: logging + dimensions: + - druid + - hadoop + - zookeeper-latest