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
5 changes: 4 additions & 1 deletion docs/modules/commons-operator/pages/restarter.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ spec:
==== Pod template annotations

To detect changes, the operator adds an annotation for every referenced ConfigMap and Secret to the Pod template of the StatefulSet.
Its key is `configmap.restarter.stackable.tech/\{name\}` or `secret.restarter.stackable.tech/\{name\}`, its value is the UID and resource version of the referenced object (or `changes-ignored` if it is excluded as described above).
Its key is `configmap.restarter.stackable.tech/\{name\}` or `secret.restarter.stackable.tech/\{name\}`, its value is the UID and resource version of the referenced object.
The value is `changes-ignored` instead if the object is excluded, either by the StatefulSet annotations described above or by the `restarter.stackable.tech/ignore` label described below.
The value is also `changes-ignored` if the referenced object does not exist (yet), for example because the StatefulSet was created before a mounted Secret.
This is intended: once the object is created, the value changes to its UID and resource version (unless it is excluded), and the Pods are restarted to pick it up.
Kubernetes rolling-restarts the Pods whenever one of these values changes.
These annotations are managed by the operator, there is no need to set them yourself.

Expand Down
10 changes: 10 additions & 0 deletions rust/operator-binary/src/restart_controller/statefulset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,15 @@ pub async fn get_updated_restarter_annotations(
let cm_name = &cm_ref.name;
let cm = cms.get(&cm_ref);

// It is intended that "changes-ignored" is also used if the ConfigMap is not in the store,
// i.e. it doesn't exist (yet), e.g. because the StatefulSet was created before the
// ConfigMap, or it has the label `restarter.stackable.tech/ignore=true` (filtered out by the
// watcher). Once the ConfigMap shows up, the value changes to its uid/resourceVersion
// (unless ignored via the StatefulSet annotations), which restarts the Pods so that they
// pick it up.
// Leaving out the annotation instead would not avoid any restart, but cause additional
// ones, e.g. when an object ignored via a StatefulSet annotation is created after the
// StatefulSet.
let value = if let Some(cm) = cm
&& let Some(uid) = &cm.metadata.uid
&& let Some(resource_version) = &cm.metadata.resource_version
Expand Down Expand Up @@ -383,6 +392,7 @@ pub async fn get_updated_restarter_annotations(
let secret_name = &secret_ref.name;
let secret = secrets.get(&secret_ref);

// Same as for ConfigMaps above, "changes-ignored" is intended for Secrets not in the store.
let value = if let Some(secret) = secret
&& let Some(uid) = &secret.metadata.uid
&& let Some(resource_version) = &secret.metadata.resource_version
Expand Down
Loading