• Kubernetes Submit Queue's avatar
    Merge pull request #38406 from liggitt/remove-internal-json-annotations · e732ee70
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue
    
    Remove json serialization annotations from internal types
    
    fixes #3933
    
    Internal types should never be serialized, and including json serialization tags on them makes it possible to accidentally do that without realizing it.
    
    fixes in this PR:
    
    * types
      * [x] remove json tags from internal types
      * [x] fix references from serialized types to internal ObjectMeta
    * generation
      * [x] remove generated json codecs for internal types (they should never be used)
    * kubectl
      * [x] fix `apply` to operate on versioned object
      * [x] fix sorting by field to operate on versioned object
      * [x] fix `--record` to build annotation patch using versioned object
    * hpa
      * [x] fix unmarshaling to internal CustomMetricTargetList in validation
    * thirdpartyresources
      * [x] fix encoding API responses using internal ObjectMeta
    * tests
      * [x] fix tests to use versioned objects when checking encoded content
      * [x] fix tests passing internal objects to generic printers
    
    follow ups (will open tracking issues or additional PRs):
    - [ ] remove json tags from internal kubeconfig types (`kubectl config set` pathfinding needs to work against external type)
    - [ ] HPA should version CustomMetricTargetList serialization in annotations
    - [ ] revisit how TPR resthandlers encoding objects
    - [ ] audit and add tests for printer use (human-readable printer requires internal versions, generic printers require external versions)
    - [ ] add static analysis tests preventing new internal types from adding tags
    - [ ] add static analysis tests requiring json tags on external types (and enforcing lower-case first letter)
    - [ ] add more tests for `kubectl get` exercising known and unknown types with all output options
    e732ee70
Name
Last commit
Last update
..
cmd/kube-scheduler Loading commit data...
pkg Loading commit data...
OWNERS Loading commit data...