From 934f48d4ad995e0693b029bb482c647afebfd7e0 Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Fri, 16 Sep 2022 10:32:11 +0200 Subject: [PATCH 1/6] implemented resources --- Cargo.lock | 1 + rust/crd/Cargo.toml | 1 + rust/crd/src/lib.rs | 78 ++++++++++++++++--- .../src/superset_controller.rs | 14 +++- 4 files changed, 81 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5b60f18..915a40e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1741,6 +1741,7 @@ dependencies = [ "snafu", "stackable-operator", "strum", + "tracing", ] [[package]] diff --git a/rust/crd/Cargo.toml b/rust/crd/Cargo.toml index 9d6c95af..836874d7 100644 --- a/rust/crd/Cargo.toml +++ b/rust/crd/Cargo.toml @@ -13,3 +13,4 @@ serde_json = "1.0" stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.25.0" } strum = { version = "0.24", features = ["derive"] } snafu = "0.7" +tracing = "0.1" diff --git a/rust/crd/src/lib.rs b/rust/crd/src/lib.rs index a748d727..08e11dd9 100644 --- a/rust/crd/src/lib.rs +++ b/rust/crd/src/lib.rs @@ -1,19 +1,19 @@ pub mod druidconnection; pub mod supersetdb; -use std::collections::BTreeMap; -use std::num::ParseIntError; - use serde::{Deserialize, Serialize}; use snafu::Snafu; -use stackable_operator::kube::runtime::reflector::ObjectRef; -use stackable_operator::kube::CustomResource; -use stackable_operator::product_config::flask_app_config_writer::{ - FlaskAppConfigOptions, PythonType, +use stackable_operator::{ + commons::resources::{CpuLimits, MemoryLimits, NoRuntimeLimits, Resources}, + config::merge::Merge, + k8s_openapi::apimachinery::pkg::api::resource::Quantity, + kube::{runtime::reflector::ObjectRef, CustomResource}, + product_config::flask_app_config_writer::{FlaskAppConfigOptions, PythonType}, + product_config_utils::{ConfigError, Configuration}, + role_utils::{Role, RoleGroupRef}, + schemars::{self, JsonSchema}, }; -use stackable_operator::product_config_utils::{ConfigError, Configuration}; -use stackable_operator::role_utils::{Role, RoleGroupRef}; -use stackable_operator::schemars::{self, JsonSchema}; +use std::{collections::BTreeMap, num::ParseIntError}; use strum::{Display, EnumIter, EnumString, IntoEnumIterator}; pub const APP_NAME: &str = "superset"; @@ -236,7 +236,11 @@ pub enum SupersetRole { Node, } -#[derive(Clone, Debug, Default, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Eq, Merge, JsonSchema, PartialEq, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SupersetStorageConfig {} + +#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SupersetConfig { /// Row limit when requesting chart data. @@ -247,11 +251,27 @@ pub struct SupersetConfig { /// If you get timeout errors before your query returns the result you may need to increase this timeout. /// Corresponds to SUPERSET_WEBSERVER_TIMEOUT pub webserver_timeout: Option, + /// CPU and memory limits for Superset pods + pub resources: Option>, } impl SupersetConfig { pub const CREDENTIALS_SECRET_PROPERTY: &'static str = "credentialsSecret"; pub const MAPBOX_SECRET_PROPERTY: &'static str = "mapboxSecret"; + + fn default_resources() -> Resources { + Resources { + cpu: CpuLimits { + min: Some(Quantity("200m".to_owned())), + max: Some(Quantity("4".to_owned())), + }, + memory: MemoryLimits { + limit: Some(Quantity("2Gi".to_owned())), + runtime_limits: NoRuntimeLimits {}, + }, + storage: SupersetStorageConfig {}, + } + } } impl Configuration for SupersetConfig { @@ -323,6 +343,42 @@ impl SupersetCluster { role_group: group_name.into(), } } + + /// Retrieve and merge resource configs for role and role groups + pub fn resolve_resource_config_for_role_and_rolegroup( + &self, + role: &SupersetRole, + rolegroup_ref: &RoleGroupRef, + ) -> Option> { + // Initialize the result with all default values as baseline + let conf_defaults = SupersetConfig::default_resources(); + + let role = match role { + SupersetRole::Node => self.spec.nodes.as_ref()?, + }; + + // Retrieve role resource config + let mut conf_role: Resources = + role.config.config.resources.clone().unwrap_or_default(); + + // Retrieve rolegroup specific resource config + let mut conf_rolegroup: Resources = role + .role_groups + .get(&rolegroup_ref.role_group) + .and_then(|rg| rg.config.config.resources.clone()) + .unwrap_or_default(); + + // Merge more specific configs into default config + // Hierarchy is: + // 1. RoleGroup + // 2. Role + // 3. Default + conf_role.merge(&conf_defaults); + conf_rolegroup.merge(&conf_role); + + tracing::debug!("Merged resource config: {:?}", conf_rolegroup); + Some(conf_rolegroup) + } } /// A reference to a [`SupersetCluster`] diff --git a/rust/operator-binary/src/superset_controller.rs b/rust/operator-binary/src/superset_controller.rs index 7a3f7a70..54a498eb 100644 --- a/rust/operator-binary/src/superset_controller.rs +++ b/rust/operator-binary/src/superset_controller.rs @@ -15,6 +15,7 @@ use stackable_operator::{ cluster_resources::ClusterResources, commons::{ authentication::{AuthenticationClass, AuthenticationClassProvider}, + resources::{NoRuntimeLimits, Resources}, secret_class::SecretClassVolumeScope, tls::{CaCert, TlsServerVerification, TlsVerification}, }, @@ -43,8 +44,8 @@ use stackable_operator::{ }; use stackable_superset_crd::{ supersetdb::{SupersetDB, SupersetDBStatusCondition}, - SupersetCluster, SupersetConfig, SupersetConfigOptions, SupersetRole, PYTHONPATH, - SUPERSET_CONFIG_FILENAME, + SupersetCluster, SupersetConfig, SupersetConfigOptions, SupersetRole, SupersetStorageConfig, + PYTHONPATH, SUPERSET_CONFIG_FILENAME, }; use std::{ borrow::Cow, @@ -160,6 +161,8 @@ pub enum Error { MissingSupersetConfigInNodeConfig, #[snafu(display("failed to get {timeout} from {SUPERSET_CONFIG_FILENAME} file. It should be set in the product config or by user input", timeout = SupersetConfigOptions::SupersetWebserverTimeout))] MissingWebServerTimeoutInSupersetConfig, + #[snafu(display("failed to resolve and merge resource config for role and role group"))] + FailedToResolveResourceConfig, } type Result = std::result::Result; @@ -269,6 +272,10 @@ pub async fn reconcile_superset(superset: Arc, ctx: Arc) - for (rolegroup_name, rolegroup_config) in role_node_config.iter() { let rolegroup = superset.node_rolegroup_ref(rolegroup_name); + let resources = superset + .resolve_resource_config_for_role_and_rolegroup(&SupersetRole::Node, &rolegroup) + .context(FailedToResolveResourceConfigSnafu)?; + let rg_service = build_node_rolegroup_service(&rolegroup, &superset)?; let rg_configmap = build_rolegroup_config_map( &superset, @@ -281,6 +288,7 @@ pub async fn reconcile_superset(superset: Arc, ctx: Arc) - &superset, rolegroup_config, authentication_class.as_ref(), + &resources, )?; cluster_resources .add(client, &rg_service) @@ -479,6 +487,7 @@ fn build_server_rolegroup_statefulset( superset: &SupersetCluster, node_config: &HashMap>, authentication_class: Option<&AuthenticationClass>, + resources: &Resources, ) -> Result { let rolegroup = superset .spec @@ -551,6 +560,7 @@ fn build_server_rolegroup_statefulset( 'superset.app:create_app()' "}, ]) + .resources(resources.clone().into()) .build(); let metrics_container = ContainerBuilder::new("metrics") .expect("ContainerBuilder not created") From 72318c2665cb540e3bf82b74e45f5c2cb811cf09 Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Fri, 16 Sep 2022 10:32:21 +0200 Subject: [PATCH 2/6] regenerated charts --- deploy/crd/supersetcluster.crd.yaml | 246 +++++++++++++++++++ deploy/helm/superset-operator/crds/crds.yaml | 246 +++++++++++++++++++ deploy/manifests/crds.yaml | 246 +++++++++++++++++++ 3 files changed, 738 insertions(+) diff --git a/deploy/crd/supersetcluster.crd.yaml b/deploy/crd/supersetcluster.crd.yaml index 3c52721e..80814a75 100644 --- a/deploy/crd/supersetcluster.crd.yaml +++ b/deploy/crd/supersetcluster.crd.yaml @@ -64,6 +64,129 @@ spec: config: default: {} properties: + resources: + description: CPU and memory limits for Superset pods + nullable: true + properties: + cpu: + default: + min: null + max: null + properties: + max: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + min: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + type: object + memory: + properties: + limit: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + runtimeLimits: + type: object + type: object + storage: + type: object + type: object rowLimit: description: Row limit when requesting chart data. Corresponds to ROW_LIMIT format: int32 @@ -99,6 +222,129 @@ spec: config: default: {} properties: + resources: + description: CPU and memory limits for Superset pods + nullable: true + properties: + cpu: + default: + min: null + max: null + properties: + max: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + min: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + type: object + memory: + properties: + limit: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + runtimeLimits: + type: object + type: object + storage: + type: object + type: object rowLimit: description: Row limit when requesting chart data. Corresponds to ROW_LIMIT format: int32 diff --git a/deploy/helm/superset-operator/crds/crds.yaml b/deploy/helm/superset-operator/crds/crds.yaml index 2aa7b3dd..2531e0ca 100644 --- a/deploy/helm/superset-operator/crds/crds.yaml +++ b/deploy/helm/superset-operator/crds/crds.yaml @@ -66,6 +66,129 @@ spec: config: default: {} properties: + resources: + description: CPU and memory limits for Superset pods + nullable: true + properties: + cpu: + default: + min: null + max: null + properties: + max: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + min: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + type: object + memory: + properties: + limit: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + runtimeLimits: + type: object + type: object + storage: + type: object + type: object rowLimit: description: Row limit when requesting chart data. Corresponds to ROW_LIMIT format: int32 @@ -101,6 +224,129 @@ spec: config: default: {} properties: + resources: + description: CPU and memory limits for Superset pods + nullable: true + properties: + cpu: + default: + min: null + max: null + properties: + max: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + min: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + type: object + memory: + properties: + limit: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + runtimeLimits: + type: object + type: object + storage: + type: object + type: object rowLimit: description: Row limit when requesting chart data. Corresponds to ROW_LIMIT format: int32 diff --git a/deploy/manifests/crds.yaml b/deploy/manifests/crds.yaml index 276827e7..ef707ec3 100644 --- a/deploy/manifests/crds.yaml +++ b/deploy/manifests/crds.yaml @@ -67,6 +67,129 @@ spec: config: default: {} properties: + resources: + description: CPU and memory limits for Superset pods + nullable: true + properties: + cpu: + default: + min: null + max: null + properties: + max: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + min: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + type: object + memory: + properties: + limit: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + runtimeLimits: + type: object + type: object + storage: + type: object + type: object rowLimit: description: Row limit when requesting chart data. Corresponds to ROW_LIMIT format: int32 @@ -102,6 +225,129 @@ spec: config: default: {} properties: + resources: + description: CPU and memory limits for Superset pods + nullable: true + properties: + cpu: + default: + min: null + max: null + properties: + max: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + min: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + type: object + memory: + properties: + limit: + description: |- + Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. + + The serialization format is: + + ::= + (Note that may be empty, from the "" case in .) + ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= "+" | "-" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei + (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + ::= m | "" | k | M | G | T | P | E + (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + ::= "e" | "E" + + No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. + + When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. + + Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: + a. No precision is lost + b. No fractional digits will be emitted + c. The exponent (or suffix) is as large as possible. + The sign will be omitted unless the number is negative. + + Examples: + 1.5 will be serialized as "1500m" + 1.5Gi will be serialized as "1536Mi" + + Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. + + Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) + + This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. + nullable: true + type: string + runtimeLimits: + type: object + type: object + storage: + type: object + type: object rowLimit: description: Row limit when requesting chart data. Corresponds to ROW_LIMIT format: int32 From 50c9251018b9fbcc8f72dbff5776683513228b3d Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Fri, 16 Sep 2022 10:34:36 +0200 Subject: [PATCH 3/6] docs --- docs/modules/ROOT/pages/usage.adoc | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index 8472950f..5f874d9b 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -166,3 +166,64 @@ nodes: ---- // cliOverrides don't make sense for this operator, so the feature is omitted for now + +=== Storage for data volumes + +The Superset Operator currently does not support using https://kubernetes.io/docs/concepts/storage/persistent-volumes[PersistentVolumeClaims] for internal storage. + +=== Memory requests + +You can request a certain amount of memory for each individual role group as shown below: + +[source,yaml] +---- +nodes: + roleGroups: + default: + config: + resources: + memory: + limit: '2Gi' +---- + +In this example, each Superset container in the `default` role group will have a maximum of 2 gigabytes of memory. To be more precise, these memory limits apply to the container running Superset but not to any sidecar containers (e.g. the metrics container) that are part of the pod. + +For more details regarding Kubernetes memory requests and limits see: https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/[Assign Memory Resources to Containers and Pods]. + +=== CPU requests + +Similarly to memory resources, you can also configure CPU limits, as shown below: + +[source,yaml] +---- +nodes: + roleGroups: + default: + config: + resources: + cpu: + max: '500m' + min: '250m' +---- + +=== Defaults + +If nothing is specified, the operator will automatically set the following default values for resources: + +[source,yaml] +---- +nodes: + roleGroups: + default: + config: + resources: + cpu: + min: '200m' + max: "4" + memory: + limit: '2Gi' +---- + +WARNING: The default values are _most likely_ not sufficient to run a proper cluster in production. Please adapt according to your requirements. + +For more details regarding Kubernetes CPU limits see: https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/[Assign CPU Resources to Containers and Pods]. From d63b9fe404de3b261fe402ab6d627497d67571f6 Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Fri, 16 Sep 2022 11:26:02 +0200 Subject: [PATCH 4/6] added tests --- .../templates/kuttl/resources/00-assert.yaml | 14 ++++++ .../resources/00-install-postgresql.yaml | 12 +++++ .../templates/kuttl/resources/01-assert.yaml | 48 +++++++++++++++++++ .../resources/01-install-superset.yaml.j2 | 48 +++++++++++++++++++ tests/test-definition.yaml | 6 +++ 5 files changed, 128 insertions(+) create mode 100644 tests/templates/kuttl/resources/00-assert.yaml create mode 100644 tests/templates/kuttl/resources/00-install-postgresql.yaml create mode 100644 tests/templates/kuttl/resources/01-assert.yaml create mode 100644 tests/templates/kuttl/resources/01-install-superset.yaml.j2 diff --git a/tests/templates/kuttl/resources/00-assert.yaml b/tests/templates/kuttl/resources/00-assert.yaml new file mode 100644 index 00000000..e9c60b15 --- /dev/null +++ b/tests/templates/kuttl/resources/00-assert.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +metadata: + name: test-superset-postgresql +timeout: 480 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: superset-postgresql +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/resources/00-install-postgresql.yaml b/tests/templates/kuttl/resources/00-install-postgresql.yaml new file mode 100644 index 00000000..f6d9b258 --- /dev/null +++ b/tests/templates/kuttl/resources/00-install-postgresql.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: >- + helm install superset-postgresql + --namespace $NAMESPACE + --version 11.0.0 + --set auth.username=superset + --set auth.password=superset + --set auth.database=superset + --repo https://charts.bitnami.com/bitnami postgresql diff --git a/tests/templates/kuttl/resources/01-assert.yaml b/tests/templates/kuttl/resources/01-assert.yaml new file mode 100644 index 00000000..d433bd47 --- /dev/null +++ b/tests/templates/kuttl/resources/01-assert.yaml @@ -0,0 +1,48 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +metadata: + name: install-superset +timeout: 300 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: superset-node-resources-from-role +spec: + template: + spec: + containers: + - name: superset + resources: + requests: + cpu: 100m + memory: 1Gi + limits: + cpu: "1" + memory: 1Gi + - name: metrics +status: + readyReplicas: 1 + replicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: superset-node-resources-from-role-group +spec: + template: + spec: + containers: + - name: superset + resources: + requests: + cpu: 300m + memory: 3Gi + limits: + cpu: "3" + memory: 3Gi + - name: metrics +status: + readyReplicas: 1 + replicas: 1 diff --git a/tests/templates/kuttl/resources/01-install-superset.yaml.j2 b/tests/templates/kuttl/resources/01-install-superset.yaml.j2 new file mode 100644 index 00000000..dde7cbd6 --- /dev/null +++ b/tests/templates/kuttl/resources/01-install-superset.yaml.j2 @@ -0,0 +1,48 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +timeout: 300 +--- +apiVersion: v1 +kind: Secret +metadata: + name: superset-credentials +type: Opaque +stringData: + adminUser.username: admin + adminUser.firstname: Superset + adminUser.lastname: Admin + adminUser.email: admin@superset.com + adminUser.password: admin + connections.secretKey: thisISaSECRET_1234 + connections.sqlalchemyDatabaseUri: postgresql://superset:superset@superset-postgresql/superset +--- +apiVersion: superset.stackable.tech/v1alpha1 +kind: SupersetCluster +metadata: + name: superset +spec: + version: {{ test_scenario['values']['superset-latest'] }} + statsdExporterVersion: v0.22.4 + credentialsSecret: superset-credentials + loadExamplesOnInit: false + nodes: + config: + resources: + cpu: + min: 100m + max: "1" + memory: + limit: 1Gi + roleGroups: + resources-from-role: + replicas: 1 + resources-from-role-group: + replicas: 1 + config: + resources: + cpu: + min: 300m + max: "3" + memory: + limit: 3Gi diff --git a/tests/test-definition.yaml b/tests/test-definition.yaml index 4084d5c9..c4902c29 100644 --- a/tests/test-definition.yaml +++ b/tests/test-definition.yaml @@ -5,6 +5,9 @@ dimensions: - 1.3.2-stackable2.1.0 - 1.4.1-stackable2.1.0 - 1.5.1-stackable0.1.0 + - name: superset-latest + values: + - 1.5.1-stackable0.1.0 - name: ldap-authentication values: - no-tls @@ -21,3 +24,6 @@ tests: dimensions: - superset - ldap-authentication + - name: resources + dimensions: + - superset-latest From 42e68610e6ec104f8616e1397dffae38a86b5c7c Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Fri, 16 Sep 2022 11:29:38 +0200 Subject: [PATCH 5/6] adapted changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7883c254..59abe814 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased] +### Added + +- CPU and memory limits are now configurable ([#273]). + +[#273]: https://github.com/stackabletech/superset-operator/pull/273 + ## [0.6.0] - 2022-09-07 ### Added From 9ff8a90333cc524039782d1f4cfb656ea41fbbbc Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Fri, 16 Sep 2022 16:02:18 +0200 Subject: [PATCH 6/6] Update docs/modules/ROOT/pages/usage.adoc Co-authored-by: Sebastian Bernauer --- docs/modules/ROOT/pages/usage.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index 5f874d9b..a3202d15 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -169,7 +169,7 @@ nodes: === Storage for data volumes -The Superset Operator currently does not support using https://kubernetes.io/docs/concepts/storage/persistent-volumes[PersistentVolumeClaims] for internal storage. +The Superset operator currently does not support using https://kubernetes.io/docs/concepts/storage/persistent-volumes[PersistentVolumeClaims] for internal storage. === Memory requests