Skip to content

fix: preserve TelemetryIngest spec in v1beta5 ConvertFrom - #6536

Merged
avorima merged 1 commit into
Dynatrace:mainfrom
knQzx:fix/telemetry-ingest-convert-from
Jun 11, 2026
Merged

avorima merged 1 commit into
Dynatrace:mainfrom
knQzx:fix/telemetry-ingest-convert-from

Conversation

@knQzx

@knQzx knQzx commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

description

Spec.TelemetryIngest is copied by ConvertTo (v1beta5 -> latest) via toTelemetryIngestSpec, but the matching ConvertFrom (latest -> v1beta5) has no fromTelemetryIngestSpec and silently drops it. the field exists on v1beta5, so anyone GETting a DynaKube as v1beta5 sees spec.telemetryIngest = null, and a following PUT clobbers the latest storage version (v1beta6) with null, dropping the field from etcd

root cause

PR #4903 added the converter only in the convert_to direction. the reverse was overlooked and got inherited when v1beta5 came in

fix

  • add fromTelemetryIngestSpec to v1beta5 convert_from.go, mirroring toTelemetryIngestSpec, and wire it into the ConvertFrom dispatcher
  • dropped the v1beta4 part from the original PR as discussed, since that version is no longer served

this was the only asymmetric field, the other to*/from* helpers are all symmetric (checked the full diff of helper invocations)

how can this be tested?

  • existing pkg/api/v1beta5/dynakube/... tests pass
  • new v1beta5 round-trip unit test (ConvertTo then ConvertFrom, asserts every subfield is preserved) plus a migrate telemetryIngest test for the latest -> v1beta5 direction
  • extended the webhook integration test (pkg/api/validation/dynakube) to also exercise the backward path: served versions are now read back in their own version (hub -> spoke / ConvertFrom), unserved versions stay excluded (v1beta4 only asserts a NoMatchError), and telemetryIngest was added to the testdata so the dropped field is actually covered
  • all of the above fail on the old code and pass with the fix

@knQzx
knQzx requested a review from a team as a code owner May 1, 2026 11:36

@avorima avorima left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally agree with the changes, but there's some additional work to be done.

The v1beta4 convert_from code is effectively unreachable since it's no longer served and we have some pending tasks to strip most code from deprecated API versions in general to reduce the maintenance burden. So to keep it focused, please remove that part.

Given that we missed the v1beta5 I think we need to add an integration test to catch these things earlier next time. In the validation webhook tests we only exercise the path forward. Please adapt it to also do the path backwards. Of course excluding unserved versions.

ICP-5447

ConvertTo (v1beta5 -> latest) copies Spec.TelemetryIngest via toTelemetryIngestSpec, but the matching ConvertFrom never had a fromTelemetryIngestSpec - so reading a DynaKube back as v1beta5 returned spec.telemetryIngest=nil. A subsequent PUT then clobbered the latest storage version with nil, silently dropping the field from etcd.

Added fromTelemetryIngestSpec mirroring the to-side helper, wired it into the ConvertFrom dispatcher and added round-trip unit tests.

The webhook integration test only exercised the forward conversion path, which is how the missing ConvertFrom went unnoticed. Extended it to also read served versions back in their own version (the Hub -> spoke path) and added telemetryIngest to the testdata so this class of regression is caught.
@knQzx
knQzx force-pushed the fix/telemetry-ingest-convert-from branch from 8f97ced to 28002fe Compare May 29, 2026 12:48
@knQzx knQzx changed the title fix: preserve TelemetryIngest spec in v1beta4 and v1beta5 ConvertFrom fix: preserve TelemetryIngest spec in v1beta5 ConvertFrom May 29, 2026
@knQzx

knQzx commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

done - removed the v1beta4 part, so it's v1beta5 only now

extended the webhook integration test to also exercise the backward path (reading a served version back, i.e. hub -> spoke / ConvertFrom) for served versions only, and added telemetryIngest to the testdata so the dropped field is actually covered - fails on the old code, passes with the fix

@avorima avorima left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@avorima
avorima added this pull request to the merge queue Jun 11, 2026
Merged via the queue into Dynatrace:main with commit 5784c22 Jun 11, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants