Skip to content

[v15] Fix parsing Kubernetes Resources without GroupVersionKind#39168

Merged
tigrato merged 2 commits intobranch/v15from
bot/backport-38956-branch/v15
Mar 11, 2024
Merged

[v15] Fix parsing Kubernetes Resources without GroupVersionKind#39168
tigrato merged 2 commits intobranch/v15from
bot/backport-38956-branch/v15

Conversation

@tigrato
Copy link
Copy Markdown
Contributor

@tigrato tigrato commented Mar 10, 2024

Backport #38956 to branch/v15

changelog: Resolved sporadic errors caused by requests fail to comply with Kubernetes API spec by not specifying resource identifiers.

tigrato added 2 commits March 10, 2024 21:32
Kubernetes API has a concept of `GroupVersionKind` where each payload
includes the type identification `(group, version, kind)` that uniquely
identifies the resource withing Kubernetes itself.

Kubernetes API and `kubectl` always honor this information but custom
tools and tools that use equivalents of `json.Marshal` without setting
the `GVK` data fail to be decoded when decoding `CREATE` requests
targeted to support kinds.

This PR aims to fix that by providing an hint to the Kubernetes decoder
that aims to be used as fallback GVK when unmarshaling a payload without
the specification.

The hint is provided by the API request path that Teleport extracts from
the request URI.

Fixes #37972

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
@tigrato tigrato added this pull request to the merge queue Mar 11, 2024
Merged via the queue into branch/v15 with commit 9e6f519 Mar 11, 2024
@tigrato tigrato deleted the bot/backport-38956-branch/v15 branch March 11, 2024 01:22
@fheinecke fheinecke mentioned this pull request Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants