You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched existing issues and didn't find a duplicate
Component(s)
Rust OTAP dataflow (rust/otap-dataflow/)
Bug Description
NodeUserConfig gained two new optional fields in #2539 (header_capture: Option<HeaderCapturePolicy> and header_propagation: Option<HeaderPropagationPolicy>). Both fields transitively contain PropagationSelector:
pubenumPropagationSelector{AllCaptured,// unit variant → "all_captured"None,// unit variantNamed(Vec<String>),// tuple variant}
This enum derives JsonSchema. kube-core's schema generator panics when it encounters a mixed unit/tuple enum because it resolves all_captured as both a plain string and as part of an object subschema in the same oneOf expansion.
Any downstream project that embeds NodeUserConfig in a Kubernetes CustomResource type and calls .crd() to generate a CRD manifest will hit this panic.
Define a CustomResource struct with a field of type NodeUserConfig and #[derive(JsonSchema)]
Call YourCrd::crd() to generate the CRD manifest
use kube::CustomResource;use schemars::JsonSchema;use serde::{Deserialize,Serialize};use std::collections::HashMap;use otap_df_config::{NodeId, node::NodeUserConfig};#[derive(CustomResource,Deserialize,Serialize,Clone,Debug,JsonSchema)]#[kube(group = "example.com", version = "v1", kind = "MyResource", namespaced)]pubstructMyResourceSpec{pubnodes:HashMap<NodeId,NodeUserConfig>,}fnmain(){let _crd = MyResource::crd();// panics}
Expected Behavior
MyResource::crd() generates a valid CRD schema without panicking. PropagationSelector should produce a valid schemars JSON schema compatible with kube-core's schema generator.
Actual Behavior
thread 'main' panicked at kube-core-3.1.0/src/schema.rs:482:29:
Enum variant set [String("all_captured")] has type Single(String)
but was already defined as Some(Single(Object)).
The instance type must be equal for all subschema variants.
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
OTel-Arrow Version
b4867bfc — all subsequent commits on main are affected. Last known working: 8e8dfcf2 (immediately before #2539).
thread 'main' panicked at .cargo/registry/src/index.crates.io/kube-core-3.1.0/src/schema.rs:482:29:
Enum variant set [String("all_captured")] has type Single(String)
but was already defined as Some(Single(Object)).
The instance type must be equal for all subschema variants.
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Additional Context
The root cause is that PropagationSelector mixes unit and tuple variants, which produces a schemars schema that kube-core's structural schema validator cannot reconcile. A fix would be to add a #[schemars] attribute to PropagationSelector that produces a structurally valid schema — for example #[schemars(untagged)] or a custom JsonSchema impl that emits x-kubernetes-preserve-unknown-fields: true for this field.
Related: the same pattern is already handled for config: Value in NodeUserConfig via #[schemars(extend("x-kubernetes-preserve-unknown-fields" = true))].
Pre-filing checklist
Component(s)
Rust OTAP dataflow (
rust/otap-dataflow/)Bug Description
NodeUserConfiggained two new optional fields in #2539 (header_capture: Option<HeaderCapturePolicy>andheader_propagation: Option<HeaderPropagationPolicy>). Both fields transitively containPropagationSelector:This enum derives
JsonSchema.kube-core's schema generator panics when it encounters a mixed unit/tuple enum because it resolvesall_capturedas both a plain string and as part of an object subschema in the sameoneOfexpansion.Any downstream project that embeds
NodeUserConfigin a KubernetesCustomResourcetype and calls.crd()to generate a CRD manifest will hit this panic.Steps to Reproduce
otap-df-configas a git dependency pointing to any commit from [otap-dataflow] add transport header infrastructure #2539 onwardsCustomResourcestruct with a field of typeNodeUserConfigand#[derive(JsonSchema)]YourCrd::crd()to generate the CRD manifestExpected Behavior
MyResource::crd()generates a valid CRD schema without panicking.PropagationSelectorshould produce a validschemarsJSON schema compatible withkube-core's schema generator.Actual Behavior
OTel-Arrow Version
b4867bfc— all subsequent commits onmainare affected. Last known working:8e8dfcf2(immediately before #2539).Environment
rust:1.90.0Docker image)1.90.0 (1159e78c4 2025-09-14)1.90.0 (840b83a10 2025-07-30)3.1.01.xConfiguration
Log Output
Additional Context
The root cause is that
PropagationSelectormixes unit and tuple variants, which produces aschemarsschema thatkube-core's structural schema validator cannot reconcile. A fix would be to add a#[schemars]attribute toPropagationSelectorthat produces a structurally valid schema — for example#[schemars(untagged)]or a customJsonSchemaimpl that emitsx-kubernetes-preserve-unknown-fields: truefor this field.Related: the same pattern is already handled for
config: ValueinNodeUserConfigvia#[schemars(extend("x-kubernetes-preserve-unknown-fields" = true))].