feat(chart): pre-upgrade hook migrates otel_traces schema (ScopeName cols) - #545
Merged
Merged
Conversation
…cols) The otel clickhouse exporter only creates tables when absent — it never ALTERs an existing one. The collector 0.75 -> 0.156 upgrade added ScopeName / ScopeVersion to the traces insert, so existing installs fail every traces batch with "No such column ScopeName in table default.otel_traces" after the upgrade (caught in the 0.1.16-rc-1 dev-gke validation; fixed there manually with the same ALTER, after which traces flowed again — 8.4k rows/3min). Add a pre-upgrade hook Job that runs the additive ALTER idempotently (ADD COLUMN IF NOT EXISTS), preserving existing telemetry (7d TTL) instead of requiring a table drop: - gated on clickhouse.enabled && opentelemetry-collector.enabled - skips cleanly when otel_traces doesn't exist yet (fresh installs: the exporter creates the current schema itself) - uses the chart's clickhouse image (has clickhouse-client) and the bitnami subchart's admin secret/service, respecting fullnameOverride - waits for the still-running pre-upgrade clickhouse before altering Chart 0.1.16 -> 0.1.17.
There was a problem hiding this comment.
Code Review
This pull request introduces a pre-upgrade schema migration job for the OTel ClickHouse exporter tables to add missing columns (ScopeName and ScopeVersion) before upgrading, and bumps the chart version to 0.1.17. The review feedback recommends making the migration job more robust by dynamically resolving ClickHouse configuration values (such as name overrides, existing secrets, and custom database/table names) and using them in the environment variables and migration script. Additionally, the reviewer suggests security and resource management improvements, specifically disabling automatic service account token mounting and defining resource requests and limits for the container.
…curity) Review follow-ups: - resolve the clickhouse fullname like the bitnami subchart (fullnameOverride, else <release>-<nameOverride|clickhouse>) so nameOverride installs work - honor auth.existingSecret/existingSecretKey for the password lookup - read database/traces_table_name from the exporter config values so the hook stays in lockstep with custom table setups instead of silently skipping - automountServiceAccountToken: false (the job never talks to the K8s API) - minimal resources on the container Verified: helm template across default naming, nameOverride, and fullnameOverride+existingSecret+custom-table; helm lint clean.
blue4209211
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #543/#544. The otel clickhouse exporter only creates tables when absent — it never ALTERs existing ones. The 0.75 → 0.156 collector upgrade added
ScopeName/ScopeVersionto the traces insert, so existing installs fail every traces batch post-upgrade:Caught in the
0.1.16-rc-1dev-gke validation; applying the ALTER manually there restored flow immediately (0 export failures, 8.4k trace rows/3min).This adds a pre-upgrade hook Job so customers never see it:
ALTER TABLE … ADD COLUMN IF NOT EXISTS ScopeName/ScopeVersion— additive + idempotent; keeps existing telemetry (7d TTL) instead of requiring a dropotel_tracesdoesn't exist (fresh installs: exporter creates the current schema)clickhouse.enabled && opentelemetry-collector.enabled; uses the chart's clickhouse image + the bitnami subchart's admin secret/service, respectingfullnameOverridehook-delete-policy: hook-succeededkeeps the namespace clean; failed jobs stay for debuggingChart
0.1.16→0.1.17.How Has This Been Tested?
helm templaterenders correctly with default naming (<release>-clickhouse) and withfullnameOverride(dev style);helm lintclean0.1.17-rc-1→ dev-gke: hook runs as a no-op (columns already present) — confirms idempotence end-to-end