diff --git a/CHANGELOG.md b/CHANGELOG.md index 443468da..17e13996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,10 @@ All notable changes to this project will be documented in this file. - Support objectOverrides using `.spec.objectOverrides`. See [objectOverrides concepts page](https://docs.stackable.tech/home/nightly/concepts/overrides/#object-overrides) for details ([#782]). +- Enable the [restart-controller](https://docs.stackable.tech/home/nightly/commons-operator/restarter/), so that the Pods are automatically restarted on config changes ([#785]). [#782]: https://github.com/stackabletech/druid-operator/pull/782 +[#785]: https://github.com/stackabletech/druid-operator/pull/785 ### Changed diff --git a/Cargo.lock b/Cargo.lock index c89d0b2e..227ff20f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1387,7 +1387,7 @@ dependencies = [ [[package]] name = "k8s-version" version = "0.1.3" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#99ceb14e2466a8928b0075ad21c4aafeb54dcfe0" dependencies = [ "darling 0.23.0", "regex", @@ -2564,8 +2564,8 @@ dependencies = [ [[package]] name = "stackable-operator" -version = "0.101.2" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +version = "0.104.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#99ceb14e2466a8928b0075ad21c4aafeb54dcfe0" dependencies = [ "chrono", "clap", @@ -2603,7 +2603,7 @@ dependencies = [ [[package]] name = "stackable-operator-derive" version = "0.3.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#99ceb14e2466a8928b0075ad21c4aafeb54dcfe0" dependencies = [ "darling 0.23.0", "proc-macro2", @@ -2614,7 +2614,7 @@ dependencies = [ [[package]] name = "stackable-shared" version = "0.0.3" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#99ceb14e2466a8928b0075ad21c4aafeb54dcfe0" dependencies = [ "chrono", "k8s-openapi", @@ -2631,7 +2631,7 @@ dependencies = [ [[package]] name = "stackable-telemetry" version = "0.6.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#99ceb14e2466a8928b0075ad21c4aafeb54dcfe0" dependencies = [ "axum", "clap", @@ -2655,7 +2655,7 @@ dependencies = [ [[package]] name = "stackable-versioned" version = "0.8.3" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#99ceb14e2466a8928b0075ad21c4aafeb54dcfe0" dependencies = [ "schemars", "serde", @@ -2668,7 +2668,7 @@ dependencies = [ [[package]] name = "stackable-versioned-macros" version = "0.8.3" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#13cf69454684ccf105d7377ca369d62b7b07250c" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#99ceb14e2466a8928b0075ad21c4aafeb54dcfe0" dependencies = [ "convert_case", "darling 0.23.0", diff --git a/Cargo.nix b/Cargo.nix index aac93ccd..956373bc 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -4303,8 +4303,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "99ceb14e2466a8928b0075ad21c4aafeb54dcfe0"; + sha256 = "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh"; }; libName = "k8s_version"; authors = [ @@ -8343,13 +8343,13 @@ rec { }; "stackable-operator" = rec { crateName = "stackable-operator"; - version = "0.101.2"; + version = "0.104.0"; edition = "2024"; workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "99ceb14e2466a8928b0075ad21c4aafeb54dcfe0"; + sha256 = "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh"; }; libName = "stackable_operator"; authors = [ @@ -8517,8 +8517,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "99ceb14e2466a8928b0075ad21c4aafeb54dcfe0"; + sha256 = "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh"; }; procMacro = true; libName = "stackable_operator_derive"; @@ -8552,8 +8552,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "99ceb14e2466a8928b0075ad21c4aafeb54dcfe0"; + sha256 = "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh"; }; libName = "stackable_shared"; authors = [ @@ -8634,8 +8634,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "99ceb14e2466a8928b0075ad21c4aafeb54dcfe0"; + sha256 = "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh"; }; libName = "stackable_telemetry"; authors = [ @@ -8744,8 +8744,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "99ceb14e2466a8928b0075ad21c4aafeb54dcfe0"; + sha256 = "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh"; }; libName = "stackable_versioned"; authors = [ @@ -8788,8 +8788,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "13cf69454684ccf105d7377ca369d62b7b07250c"; - sha256 = "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j"; + rev = "99ceb14e2466a8928b0075ad21c4aafeb54dcfe0"; + sha256 = "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh"; }; procMacro = true; libName = "stackable_versioned_macros"; diff --git a/Cargo.toml b/Cargo.toml index e6bff6d4..4493f58a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/druid-operator" [workspace.dependencies] product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.8.0" } -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.101.2", features = ["telemetry", "versioned"] } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.104.0", features = ["telemetry", "versioned"] } anyhow = "1.0" built = { version = "0.8", features = ["chrono", "git2"] } diff --git a/crate-hashes.json b/crate-hashes.json index 269d6950..3934aee3 100644 --- a/crate-hashes.json +++ b/crate-hashes.json @@ -4,12 +4,12 @@ "git+https://github.com/stackabletech/kube-rs?branch=2.0.1-fix-schema-hoisting#kube-derive@2.0.1": "1a7bcl0w1jg71jc4iml0vjp8dpzy71mhxl012grxcy2xp5i6xvgf", "git+https://github.com/stackabletech/kube-rs?branch=2.0.1-fix-schema-hoisting#kube-runtime@2.0.1": "1a7bcl0w1jg71jc4iml0vjp8dpzy71mhxl012grxcy2xp5i6xvgf", "git+https://github.com/stackabletech/kube-rs?branch=2.0.1-fix-schema-hoisting#kube@2.0.1": "1a7bcl0w1jg71jc4iml0vjp8dpzy71mhxl012grxcy2xp5i6xvgf", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#k8s-version@0.1.3": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-operator-derive@0.3.1": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-operator@0.101.2": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-shared@0.0.3": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-telemetry@0.6.1": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-versioned-macros@0.8.3": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.101.2#stackable-versioned@0.8.3": "09nmd5pqrmc49dzm7y26qlh1np528d9xq4q8vm4d04sd8z9rd46j", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#k8s-version@0.1.3": "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#stackable-operator-derive@0.3.1": "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#stackable-operator@0.104.0": "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#stackable-shared@0.0.3": "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#stackable-telemetry@0.6.1": "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#stackable-versioned-macros@0.8.3": "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.104.0#stackable-versioned@0.8.3": "07cdivnyvrfrznqqm0hqsbvmbng00scv22p39a3wdgfanamjpjsh", "git+https://github.com/stackabletech/product-config.git?tag=0.8.0#product-config@0.8.0": "1dz70kapm2wdqcr7ndyjji0lhsl98bsq95gnb2lw487wf6yr7987" } \ No newline at end of file diff --git a/deploy/helm/druid-operator/crds/crds.yaml b/deploy/helm/druid-operator/crds/crds.yaml index 644ee599..b78eb9ff 100644 --- a/deploy/helm/druid-operator/crds/crds.yaml +++ b/deploy/helm/druid-operator/crds/crds.yaml @@ -297,7 +297,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -609,7 +609,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -1463,7 +1463,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -1775,7 +1775,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -2106,7 +2106,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -2458,7 +2458,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -2801,7 +2801,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -3109,7 +3109,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -3410,7 +3410,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) @@ -3722,7 +3722,7 @@ spec: default: {} description: |- In the `podOverrides` property you can define a - [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core) + [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core) to override any property that can be set on a Kubernetes Pod. Read the [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides) diff --git a/rust/operator-binary/src/druid_controller.rs b/rust/operator-binary/src/druid_controller.rs index 3f8257f4..6c1c36c6 100644 --- a/rust/operator-binary/src/druid_controller.rs +++ b/rust/operator-binary/src/druid_controller.rs @@ -31,6 +31,7 @@ use stackable_operator::{ rbac::build_rbac_resources, tls_verification::TlsClientDetailsError, }, + constants::RESTART_CONTROLLER_ENABLED_LABEL, crd::s3, k8s_openapi::{ DeepMerge, @@ -614,6 +615,10 @@ pub async fn reconcile_druid( .with_context(|_| ApplyRoleGroupConfigSnafu { rolegroup: rolegroup.clone(), })?; + + // Note: The StatefulSet needs to be applied after all ConfigMaps and Secrets it mounts + // to prevent unnecessary Pod restarts. + // See https://github.com/stackabletech/commons-operator/issues/111 for details. ss_cond_builder.add( cluster_resources .add(client, rg_statefulset) @@ -1203,6 +1208,7 @@ fn build_rolegroup_statefulset( &rolegroup_ref.role_group, )) .context(MetadataBuildSnafu)? + .with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned()) .build(), spec: Some(StatefulSetSpec { pod_management_policy: Some("Parallel".to_string()), diff --git a/tests/templates/kuttl/smoke/50-assert.yaml b/tests/templates/kuttl/smoke/50-assert.yaml index f92d5153..082ae4e5 100644 --- a/tests/templates/kuttl/smoke/50-assert.yaml +++ b/tests/templates/kuttl/smoke/50-assert.yaml @@ -9,6 +9,9 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: druid-broker-default + generation: 1 # There should be no unneeded Pod restarts + labels: + restarter.stackable.tech/enabled: "true" spec: template: spec: @@ -21,6 +24,9 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: druid-coordinator-default + generation: 1 # There should be no unneeded Pod restarts + labels: + restarter.stackable.tech/enabled: "true" spec: template: spec: @@ -33,6 +39,9 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: druid-historical-default + generation: 1 # There should be no unneeded Pod restarts + labels: + restarter.stackable.tech/enabled: "true" spec: template: spec: @@ -69,6 +78,9 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: druid-middlemanager-default + generation: 1 # There should be no unneeded Pod restarts + labels: + restarter.stackable.tech/enabled: "true" spec: template: spec: @@ -81,6 +93,9 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: druid-router-default + generation: 1 # There should be no unneeded Pod restarts + labels: + restarter.stackable.tech/enabled: "true" spec: template: spec: