Skip to content

Have separate types with all-Option fields to use as patch bodies, since regular types may have some Default-able non-Option fields that break the patch #112

@nightkr

Description

@nightkr

Repro

use k8s_openapi::api::apps::v1::StatefulSetSpec;
println!("{}", serde_yaml::to_string(&StatefulSetSpec::default()).unwrap());

Expected

---
template: {}

Produced

---
selector: {}
serviceName: ""
template: {}

Why is this a problem?

LabelSelector and string are both atomic (see in curl $K8S_API/openapi/v2 | jq '.definitions."io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"' that "x-kubernetes-map-type": "atomic"), which means that server-side apply will replace them outright rather than trying to merge them. This prevents server-side apply from updating StatefulSet objects safely.

Versions

[[package]]
name = "k8s-openapi"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f8de9873b904e74b3533f77493731ee26742418077503683db44e1b3c54aa5c"
dependencies = [
 "base64",
 "bytes",
 "chrono",
 "serde",
 "serde-value",
 "serde_json",
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions