Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- Support the annotation `restarter.stackable.tech/ignore` on ConfigMaps and Secrets and the
annotations `restarter.stackable.tech/ignore-configmap.x` and
`restarter.stackable.tech/ignore-secret.x` on StatefulSets to exclude ConfigMaps and Secrets from
the restarter controller ([#410]).

[#410]: https://github.com/stackabletech/commons-operator/pull/410

## [26.3.0] - 2026-03-16

## [26.3.0-rc1] - 2026-03-16
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions Cargo.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resolver = "2"
version = "0.0.0-dev"
authors = ["Stackable GmbH <info@stackable.tech>"]
license = "OSL-3.0"
edition = "2021"
edition = "2024"
repository = "https://github.com/stackabletech/commons-operator"

[workspace.dependencies]
Expand Down
18 changes: 9 additions & 9 deletions crate-hashes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions docs/modules/commons-operator/pages/restarter.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,61 @@ Label:: `restarter.stackable.tech/enabled`

The operator can restart StatefulSets when any referenced configuration object (ConfigMap or Secret) changes.
To enable this, set the `restarter.stackable.tech/enabled` label on the StatefulSet to `true`.

Annotation:: `restarter.stackable.tech/ignore-configmap.*`
Annotation:: `restarter.stackable.tech/ignore-secret.*`

These annotations can be added if the restarter is enabled on a StatefulSet, but some ConfigMaps or Secrets should be excluded from triggering a restart. `*` can be replaced with any value and is only used to make the annotation key unique.

[source,yaml]
----
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: statefulset-with-enabled-restarter
labels:
restarter.stackable.tech/enabled: "true"
annotations:
restarter.stackable.tech/ignore-configmap.0: hot-reloaded-configmap
restarter.stackable.tech/ignore-secret.0: hot-reloaded-secret
spec:
template:
spec:
volumes:
- name: configuration
configMap:
name: hot-reloaded-configmap
- name: credentials
secret:
secretName: hot-reloaded-secret
...
----

== ConfigMap/Secret

Label:: `restarter.stackable.tech/ignore`

If a ConfigMap or Secret is only used for initializing a StatefulSet or contains data which can be hot-reloaded, add the label `restarter.stackable.tech/ignore: "true"` to avoid unnecessary restarts of the StatefulSet pods:

[source,yaml]
----
---
apiVersion: v1
kind: ConfigMap
metadata:
name: hot-reloaded-configmap
labels:
restarter.stackable.tech/ignore: "true"
...
---
apiVersion: v1
kind: Secret
metadata:
name: hot-reloaded-secret
labels:
restarter.stackable.tech/ignore: "true"
...
----

Unlike the StatefulSet annotations `restarter.stackable.tech/ignore-configmap.\*` and `restarter.stackable.tech/ignore-secret.*`, this label affects every StatefulSet that references the labeled ConfigMaps or Secrets.
23 changes: 10 additions & 13 deletions rust/operator-binary/src/restart_controller/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,23 +220,20 @@ async fn report_result(
const EVICT_ERROR_MESSAGE: &str =
"Cannot evict pod as it would violate the pod's disruption budget.";

// TODO: We need Rust 1.88 and 2024 edition for if-let-chains
if let kube::Error::Api(s) = evict_pod_error {
if let Status {
if let kube::Error::Api(s) = evict_pod_error
&& let Status {
code: TOO_MANY_REQUESTS_HTTP_CODE,
message: error_message,
..
} = s.deref()
{
if error_message == EVICT_ERROR_MESSAGE {
tracing::info!(
k8s.object.ref = %pod_ref,
error = %evict_pod_error,
"Tried to evict Pod, but wasn't allowed to do so, as it would violate the Pod's disruption budget. Retrying later"
);
return;
}
}
&& error_message == EVICT_ERROR_MESSAGE
{
tracing::info!(
k8s.object.ref = %pod_ref,
error = %evict_pod_error,
"Tried to evict Pod, but wasn't allowed to do so, as it would violate the Pod's disruption budget. Retrying later"
);
return;
}
}

Expand Down
Loading
Loading