Skip to content

Commit 7f755f0

Browse files
committed
adapt to op-rs 0.79.0
1 parent 2fdc259 commit 7f755f0

File tree

6 files changed

+71
-28
lines changed

6 files changed

+71
-28
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
### Added
66

7-
- Allowing arbitrary python code as EXPERIMENTAL_FILE_HEADER and EXPERIMENTAL_FILE_FOOTER in superset_config.py ([#530])
7+
- Allowing arbitrary python code as EXPERIMENTAL_FILE_HEADER and EXPERIMENTAL_FILE_FOOTER in superset_config.py ([#530]).
8+
- The operator can now run on Kubernetes clusters using a non-default cluster domain. It should automatically detect the
9+
correct domain to use, but you can also use the env var `KUBERNETES_CLUSTER_DOMAIN` to set the domain explicitly
10+
or use the helm-chart property `kubernetesClusterDomain` ([#xxx]).
811

912
### Changed
1013

@@ -14,6 +17,7 @@
1417

1518
[#528]: https://github.com/stackabletech/superset-operator/pull/528
1619
[#530]: https://github.com/stackabletech/superset-operator/pull/530
20+
[#xxx]: https://github.com/stackabletech/superset-operator/pull/xxx
1721

1822
## [24.7.0] - 2024-07-24
1923

Cargo.lock

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ serde = { version = "1.0", features = ["derive"] }
2121
serde_json = "1.0"
2222
serde_yaml = "0.9"
2323
snafu = "0.8"
24-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.76.0" }
24+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.79.0" }
2525
strum = { version = "0.26", features = ["derive"] }
2626
tokio = { version = "1.40", features = ["full"] }
2727
tracing = "0.1"

deploy/helm/superset-operator/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ nodeSelector: {}
4747
tolerations: []
4848

4949
affinity: {}
50+
51+
# When running on a non-default Kubernetes cluster domain and the auto detection is not working correctly,
52+
# you can set your custom cluster domain here.
53+
# See the https://docs.stackable.tech/home/stable/guides/kubernetes-cluster-domain guide for details
54+
# kubernetesClusterDomain: my-cluster.local

rust/operator-binary/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ async fn main() -> anyhow::Result<()> {
7979
])?;
8080

8181
let client =
82-
stackable_operator::client::create_client(Some(OPERATOR_NAME.to_string())).await?;
82+
stackable_operator::client::initialize_operator(Some(OPERATOR_NAME.to_string()))
83+
.await?;
8384

8485
let superset_controller_builder = Controller::new(
8586
watch_namespace.get_api::<SupersetCluster>(&client),

rust/operator-binary/src/superset_controller.rs

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use product_config::{
1515
use snafu::{OptionExt, ResultExt, Snafu};
1616
use stackable_operator::{
1717
builder::{
18+
self,
1819
configmap::ConfigMapBuilder,
1920
meta::ObjectMetaBuilder,
2021
pod::{
@@ -46,7 +47,9 @@ use stackable_operator::{
4647
},
4748
product_logging::{
4849
self,
49-
framework::{create_vector_shutdown_file_command, remove_vector_shutdown_file_command},
50+
framework::{
51+
create_vector_shutdown_file_command, remove_vector_shutdown_file_command, LoggingError,
52+
},
5053
spec::Logging,
5154
},
5255
role_utils::{GenericRoleConfig, RoleGroupRef},
@@ -57,12 +60,13 @@ use stackable_operator::{
5760
time::Duration,
5861
utils::COMMON_BASH_TRAP_FUNCTIONS,
5962
};
60-
use stackable_superset_crd::authentication::SupersetAuthenticationClassResolved;
6163
use stackable_superset_crd::{
62-
authentication::SupersetClientAuthenticationDetailsResolved, Container, SupersetCluster,
63-
SupersetClusterStatus, SupersetConfig, SupersetConfigOptions, SupersetRole, APP_NAME,
64-
PYTHONPATH, STACKABLE_CONFIG_DIR, STACKABLE_LOG_CONFIG_DIR, STACKABLE_LOG_DIR,
65-
SUPERSET_CONFIG_FILENAME,
64+
authentication::{
65+
SupersetAuthenticationClassResolved, SupersetClientAuthenticationDetailsResolved,
66+
},
67+
Container, SupersetCluster, SupersetClusterStatus, SupersetConfig, SupersetConfigOptions,
68+
SupersetRole, APP_NAME, PYTHONPATH, STACKABLE_CONFIG_DIR, STACKABLE_LOG_CONFIG_DIR,
69+
STACKABLE_LOG_DIR, SUPERSET_CONFIG_FILENAME,
6670
};
6771
use strum::{EnumDiscriminants, IntoStaticStr};
6872

@@ -259,6 +263,17 @@ pub enum Error {
259263
"failed to write to String (Vec<u8> to be precise) containing superset config"
260264
))]
261265
WriteToConfigFileString { source: std::io::Error },
266+
267+
#[snafu(display("failed to configure logging"))]
268+
ConfigureLogging { source: LoggingError },
269+
270+
#[snafu(display("failed to add needed volume"))]
271+
AddVolume { source: builder::pod::Error },
272+
273+
#[snafu(display("failed to add needed volumeMount"))]
274+
AddVolumeMount {
275+
source: builder::pod::container::Error,
276+
},
262277
}
263278

264279
type Result<T, E = Error> = std::result::Result<T, E>;
@@ -742,9 +757,9 @@ fn build_server_rolegroup_statefulset(
742757
superset_cb
743758
.image_from_product_image(resolved_product_image)
744759
.add_container_port("http", APP_PORT.into())
745-
.add_volume_mount(CONFIG_VOLUME_NAME, STACKABLE_CONFIG_DIR)
746-
.add_volume_mount(LOG_CONFIG_VOLUME_NAME, STACKABLE_LOG_CONFIG_DIR)
747-
.add_volume_mount(LOG_VOLUME_NAME, STACKABLE_LOG_DIR)
760+
.add_volume_mount(CONFIG_VOLUME_NAME, STACKABLE_CONFIG_DIR).context(AddVolumeMountSnafu)?
761+
.add_volume_mount(LOG_CONFIG_VOLUME_NAME, STACKABLE_LOG_CONFIG_DIR).context(AddVolumeMountSnafu)?
762+
.add_volume_mount(LOG_VOLUME_NAME, STACKABLE_LOG_DIR).context(AddVolumeMountSnafu)?
748763
.add_env_var_from_secret("ADMIN_USERNAME", secret, "adminUser.username")
749764
.add_env_var_from_secret("ADMIN_FIRSTNAME", secret, "adminUser.firstname")
750765
.add_env_var_from_secret("ADMIN_LASTNAME", secret, "adminUser.lastname")
@@ -839,22 +854,26 @@ fn build_server_rolegroup_statefulset(
839854
pb.add_volumes(controller_commons::create_volumes(
840855
&rolegroup_ref.object_name(),
841856
merged_config.logging.containers.get(&Container::Superset),
842-
));
857+
))
858+
.context(AddVolumeSnafu)?;
843859
pb.add_container(metrics_container);
844860

845861
if merged_config.logging.enable_vector_agent {
846-
pb.add_container(product_logging::framework::vector_container(
847-
resolved_product_image,
848-
CONFIG_VOLUME_NAME,
849-
LOG_VOLUME_NAME,
850-
merged_config.logging.containers.get(&Container::Vector),
851-
ResourceRequirementsBuilder::new()
852-
.with_cpu_request("250m")
853-
.with_cpu_limit("500m")
854-
.with_memory_request("128Mi")
855-
.with_memory_limit("128Mi")
856-
.build(),
857-
));
862+
pb.add_container(
863+
product_logging::framework::vector_container(
864+
resolved_product_image,
865+
CONFIG_VOLUME_NAME,
866+
LOG_VOLUME_NAME,
867+
merged_config.logging.containers.get(&Container::Vector),
868+
ResourceRequirementsBuilder::new()
869+
.with_cpu_request("250m")
870+
.with_cpu_limit("500m")
871+
.with_memory_request("128Mi")
872+
.with_memory_limit("128Mi")
873+
.build(),
874+
)
875+
.context(ConfigureLoggingSnafu)?,
876+
);
858877
}
859878

860879
let mut pod_template = pb.build_template();

0 commit comments

Comments
 (0)