From c71d3e3923100365aa6a47cfb8cca70b9db02744 Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Fri, 22 Nov 2024 16:25:43 +0100 Subject: [PATCH 1/4] Patch op-rs version to use one that fixes SUP-148. --- Cargo.lock | 8 ++++---- Cargo.toml | 3 +++ rust/operator-binary/src/zk_controller.rs | 17 ++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 883a16f3..fcee991c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2112,8 +2112,8 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "stackable-operator" -version = "0.80.0" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.80.0#6fbe32300b60f95e0baa2ab0ff2daf961b06531c" +version = "0.81.0" +source = "git+https://github.com/stackabletech//operator-rs.git?branch=fix/SUP-148#c219c2a0fd63ffac17738f9c869239f5772681cf" dependencies = [ "chrono", "clap", @@ -2151,7 +2151,7 @@ dependencies = [ [[package]] name = "stackable-operator-derive" version = "0.3.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.80.0#6fbe32300b60f95e0baa2ab0ff2daf961b06531c" +source = "git+https://github.com/stackabletech//operator-rs.git?branch=fix/SUP-148#c219c2a0fd63ffac17738f9c869239f5772681cf" dependencies = [ "darling", "proc-macro2", @@ -2162,7 +2162,7 @@ dependencies = [ [[package]] name = "stackable-shared" version = "0.0.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.80.0#6fbe32300b60f95e0baa2ab0ff2daf961b06531c" +source = "git+https://github.com/stackabletech//operator-rs.git?branch=fix/SUP-148#c219c2a0fd63ffac17738f9c869239f5772681cf" dependencies = [ "kube", "semver", diff --git a/Cargo.toml b/Cargo.toml index b3d7c737..4e8be9bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,9 @@ tokio = { version = "1.40", features = ["full"] } tokio-zookeeper = "0.4" tracing = "0.1" +[patch."https://github.com/stackabletech/operator-rs.git"] +stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "fix/SUP-148" } + # [patch."https://github.com/stackabletech/operator-rs.git"] # stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" } diff --git a/rust/operator-binary/src/zk_controller.rs b/rust/operator-binary/src/zk_controller.rs index c09c7c80..896a299b 100644 --- a/rust/operator-binary/src/zk_controller.rs +++ b/rust/operator-binary/src/zk_controller.rs @@ -23,17 +23,14 @@ use stackable_operator::{ pod::{container::ContainerBuilder, resources::ResourceRequirementsBuilder, PodBuilder}, }, cluster_resources::{ClusterResourceApplyStrategy, ClusterResources}, - commons::{ - product_image_selection::ResolvedProductImage, - rbac::{build_rbac_resources, service_account_name}, - }, + commons::{product_image_selection::ResolvedProductImage, rbac::build_rbac_resources}, k8s_openapi::{ api::{ apps::v1::{StatefulSet, StatefulSetSpec}, core::v1::{ ConfigMap, ConfigMapVolumeSource, EmptyDirVolumeSource, EnvVar, EnvVarSource, - ExecAction, ObjectFieldSelector, PodSecurityContext, Probe, Service, ServicePort, - ServiceSpec, Volume, + ExecAction, ObjectFieldSelector, PodSecurityContext, Probe, Service, + ServiceAccount, ServicePort, ServiceSpec, Volume, }, }, apimachinery::pkg::apis::meta::v1::LabelSelector, @@ -43,7 +40,7 @@ use stackable_operator::{ api::DynamicObject, core::{error_boundary, DeserializeGuard}, runtime::controller, - Resource, + Resource, ResourceExt, }, kvp::{Label, LabelError, Labels}, logging::controller::ReconcilerError, @@ -395,7 +392,7 @@ pub async fn reconcile_zk( .context(BuildRbacResourcesSnafu)?; cluster_resources - .add(client, rbac_sa) + .add(client, rbac_sa.clone()) .await .context(ApplyServiceAccountSnafu)?; @@ -444,6 +441,7 @@ pub async fn reconcile_zk( &zookeeper_security, &resolved_product_image, &merged_config, + &rbac_sa, )?; cluster_resources .add(client, rg_service) @@ -757,6 +755,7 @@ fn build_server_rolegroup_statefulset( zookeeper_security: &ZookeeperSecurity, resolved_product_image: &ResolvedProductImage, config: &ZookeeperConfig, + service_account: &ServiceAccount, ) -> Result { let role = zk.role(zk_role).context(InternalOperatorFailureSnafu)?; let rolegroup = zk @@ -964,7 +963,7 @@ fn build_server_rolegroup_statefulset( fs_group: Some(1000), ..PodSecurityContext::default() }) - .service_account_name(service_account_name(APP_NAME)); + .service_account_name(service_account.name_any()); if let Some(ContainerLogConfig { choice: From c6732b929e187d25014bcb40cf01f814e9d00b28 Mon Sep 17 00:00:00 2001 From: Malte Sander Date: Fri, 22 Nov 2024 16:42:33 +0100 Subject: [PATCH 2/4] clippy --- rust/operator-binary/src/zk_controller.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/operator-binary/src/zk_controller.rs b/rust/operator-binary/src/zk_controller.rs index 896a299b..eb14a2f3 100644 --- a/rust/operator-binary/src/zk_controller.rs +++ b/rust/operator-binary/src/zk_controller.rs @@ -747,6 +747,7 @@ fn build_server_rolegroup_service( /// The rolegroup [`StatefulSet`] runs the rolegroup, as configured by the administrator. /// /// The [`Pod`](`stackable_operator::k8s_openapi::api::core::v1::Pod`)s are accessible through the corresponding [`Service`] (from [`build_server_rolegroup_service`]). +#[allow(clippy::too_many_arguments)] fn build_server_rolegroup_statefulset( zk: &ZookeeperCluster, zk_role: &ZookeeperRole, From 8bdfaf577e97be0415ccb6513697f1c6dd385867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Sun, 24 Nov 2024 17:48:10 +0100 Subject: [PATCH 3/4] Updated changelog Use 0.82 op-rs instead of pr version. --- CHANGELOG.md | 2 ++ Cargo.lock | 8 ++++---- Cargo.toml | 5 +---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc63a10c..60573a86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,11 +24,13 @@ All notable changes to this project will be documented in this file. ### Fixed - Failing to parse one `ZookeeperCluster`/`ZookeeperZnode` should no longer cause the whole operator to stop functioning ([#872]). +- BREAKING: Use distinct ServiceAccounts for the Stacklets, so that multiple Stacklets can be deployed in one namespace. Existing Stacklets will use the newly created ServiceAccounts after restart ([#889]). [#853]: https://github.com/stackabletech/zookeeper-operator/pull/853 [#857]: https://github.com/stackabletech/zookeeper-operator/pull/857 [#870]: https://github.com/stackabletech/zookeeper-operator/pull/870 [#872]: https://github.com/stackabletech/zookeeper-operator/pull/872 +[#889]: https://github.com/stackabletech/zookeeper-operator/pull/889 ## [24.7.0] - 2024-07-24 diff --git a/Cargo.lock b/Cargo.lock index fcee991c..d2045584 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2112,8 +2112,8 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "stackable-operator" -version = "0.81.0" -source = "git+https://github.com/stackabletech//operator-rs.git?branch=fix/SUP-148#c219c2a0fd63ffac17738f9c869239f5772681cf" +version = "0.82.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.82.0#415bbd031bd52e9c0c5392060235030e9930b46b" dependencies = [ "chrono", "clap", @@ -2151,7 +2151,7 @@ dependencies = [ [[package]] name = "stackable-operator-derive" version = "0.3.1" -source = "git+https://github.com/stackabletech//operator-rs.git?branch=fix/SUP-148#c219c2a0fd63ffac17738f9c869239f5772681cf" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.82.0#415bbd031bd52e9c0c5392060235030e9930b46b" dependencies = [ "darling", "proc-macro2", @@ -2162,7 +2162,7 @@ dependencies = [ [[package]] name = "stackable-shared" version = "0.0.1" -source = "git+https://github.com/stackabletech//operator-rs.git?branch=fix/SUP-148#c219c2a0fd63ffac17738f9c869239f5772681cf" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.82.0#415bbd031bd52e9c0c5392060235030e9930b46b" dependencies = [ "kube", "semver", diff --git a/Cargo.toml b/Cargo.toml index 4e8be9bc..4921851e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,16 +22,13 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_yaml = "0.9" snafu = "0.8" -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.80.0" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.82.0" } product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" } strum = { version = "0.26", features = ["derive"] } tokio = { version = "1.40", features = ["full"] } tokio-zookeeper = "0.4" tracing = "0.1" -[patch."https://github.com/stackabletech/operator-rs.git"] -stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "fix/SUP-148" } - # [patch."https://github.com/stackabletech/operator-rs.git"] # stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" } From 635192eebfab2532c59cfb8a698606fd672c71a7 Mon Sep 17 00:00:00 2001 From: Siegfried Weber Date: Mon, 25 Nov 2024 12:55:44 +0100 Subject: [PATCH 4/4] Regenerate Nix files --- Cargo.nix | 14 +++++++------- crate-hashes.json | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.nix b/Cargo.nix index 64384414..2b50bcdd 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -6520,13 +6520,13 @@ rec { }; "stackable-operator" = rec { crateName = "stackable-operator"; - version = "0.80.0"; + version = "0.82.0"; edition = "2021"; workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "6fbe32300b60f95e0baa2ab0ff2daf961b06531c"; - sha256 = "16jrq3wdwz63210jgmqbx3snrr15wxw6l1smqhzv7b7jpq8qvya3"; + rev = "415bbd031bd52e9c0c5392060235030e9930b46b"; + sha256 = "0phasjwb64rxgn5hs8vks92icmx9255bd5v9dms280clrfpcg4hy"; }; libName = "stackable_operator"; authors = [ @@ -6683,8 +6683,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "6fbe32300b60f95e0baa2ab0ff2daf961b06531c"; - sha256 = "16jrq3wdwz63210jgmqbx3snrr15wxw6l1smqhzv7b7jpq8qvya3"; + rev = "415bbd031bd52e9c0c5392060235030e9930b46b"; + sha256 = "0phasjwb64rxgn5hs8vks92icmx9255bd5v9dms280clrfpcg4hy"; }; procMacro = true; libName = "stackable_operator_derive"; @@ -6718,8 +6718,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "6fbe32300b60f95e0baa2ab0ff2daf961b06531c"; - sha256 = "16jrq3wdwz63210jgmqbx3snrr15wxw6l1smqhzv7b7jpq8qvya3"; + rev = "415bbd031bd52e9c0c5392060235030e9930b46b"; + sha256 = "0phasjwb64rxgn5hs8vks92icmx9255bd5v9dms280clrfpcg4hy"; }; libName = "stackable_shared"; authors = [ diff --git a/crate-hashes.json b/crate-hashes.json index 562fb18b..0ca37e6e 100644 --- a/crate-hashes.json +++ b/crate-hashes.json @@ -1,6 +1,6 @@ { - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.80.0#stackable-operator-derive@0.3.1": "16jrq3wdwz63210jgmqbx3snrr15wxw6l1smqhzv7b7jpq8qvya3", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.80.0#stackable-operator@0.80.0": "16jrq3wdwz63210jgmqbx3snrr15wxw6l1smqhzv7b7jpq8qvya3", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.80.0#stackable-shared@0.0.1": "16jrq3wdwz63210jgmqbx3snrr15wxw6l1smqhzv7b7jpq8qvya3", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.82.0#stackable-operator-derive@0.3.1": "0phasjwb64rxgn5hs8vks92icmx9255bd5v9dms280clrfpcg4hy", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.82.0#stackable-operator@0.82.0": "0phasjwb64rxgn5hs8vks92icmx9255bd5v9dms280clrfpcg4hy", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.82.0#stackable-shared@0.0.1": "0phasjwb64rxgn5hs8vks92icmx9255bd5v9dms280clrfpcg4hy", "git+https://github.com/stackabletech/product-config.git?tag=0.7.0#product-config@0.7.0": "0gjsm80g6r75pm3824dcyiz4ysq1ka4c1if6k1mjm9cnd5ym0gny" } \ No newline at end of file