docs(clickhouse): name the clickhouse-backup handlers that reload the config

clickhouse-backup reloads its config file in each handler that reaches
S3, among them the create_remote, restore_remote and list calls the
strategy makes. The status and action-log endpoints the strategy polls
read in-memory state and do not reload it, so the mounted file reaches
the sidecar on the calls that need credentials rather than on every
request.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
This commit is contained in:
Alexey Artamonov committed 2026-11-11 14:56:11 +03:00
1 parent c26d2773a5
commit 8ba0380043
4 files changed
+16 -13

No files matched your search

@@ -450,9 +450,10 @@ const credentialsUpdatedAtAnnotation = "backups.cozystack.io/credentials-updated
// clickHouseBackupConfigKey holds the s3 section of a clickhouse-backup
// config. The ClickHouse chart mounts it as the sidecar's config file
// instead of passing the values as environment: clickhouse-backup reloads
// the file on every API call and kubelet rewrites a mounted Secret in
// place, so credentials projected after the pod started, or rotated since,
// reach a running sidecar.
// the file in each API handler that reaches S3, among them the
// create_remote, restore_remote and list calls the strategy makes, and
// kubelet rewrites a mounted Secret in place, so credentials projected
// after the pod started, or rotated since, reach a running sidecar.
const clickHouseBackupConfigKey = "clickhouse-backup.yml"
// buildClickHouseBackupConfig renders that file. The projected endpoint is
@@ -673,7 +673,8 @@ func TestProject_HappyPath_HTTPEndpoint(t *testing.T) {
// The ClickHouse sidecar reads its S3 settings from this key as a mounted
// file, which kubelet refreshes in place: clickhouse-backup reloads its
// config file on every API call, while its environment is fixed at start.
// config file in each API handler that reaches S3, while its environment
// is fixed at start.
func TestProject_WritesClickHouseBackupConfig(t *testing.T) {
cases := []struct {
name string
@@ -230,12 +230,12 @@ spec:
backupStorage.forcePathStyle included, comes
from the clickhouse-backup.yml key the platform projects
into cozy-backups-creds, mounted below as the config file.
clickhouse-backup reloads that file on every API call and
kubelet rewrites a mounted Secret in place, so credentials
projected after the Pod started, or rotated since, reach
the running sidecar; environment would be read only at
start and would override the file, so none of those is
set here.
clickhouse-backup reloads that file in each API handler
that reaches S3 and kubelet rewrites a mounted Secret in
place, so credentials projected after the Pod started, or
rotated since, reach the running sidecar; environment
would be read only at start and would override the file,
so none of those is set here.
S3_FORCE_PATH_STYLE selects path-style vs vhost-style S3
addressing. On the legacy paths (own Secret via
@@ -47,9 +47,10 @@ tests:
- equal:
path: spec.templates.podTemplates[0].spec.containers[?(@.name=="clickhouse-backup")].env[?(@.name=="S3_PATH")].value
value: tenant-test/ch-test
# clickhouse-backup reloads this file on every API call and kubelet
# rewrites the mounted Secret in place, so credentials projected after
# the Pod started, or rotated since, reach the running sidecar.
# clickhouse-backup reloads this file in each API handler that reaches
# S3 and kubelet rewrites the mounted Secret in place, so credentials
# projected after the Pod started, or rotated since, reach the running
# sidecar.
- equal:
path: spec.templates.podTemplates[0].spec.containers[?(@.name=="clickhouse-backup")].env[?(@.name=="CLICKHOUSE_BACKUP_CONFIG")].value
value: /etc/clickhouse-backup-s3/config.yml