Skip to content

Conversation

@alexzielenski
Copy link
Member

I noticed while fuzzing a type converter to gnostic that the spec.Header type does not include its x- vendor extensions when marshaled to JSON (they were already being properly unmarshaled from JSON). This PR adds that functionality.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 9, 2022
@k8s-ci-robot k8s-ci-robot requested review from liggitt and sttts March 9, 2022 18:38
Discovered while fuzzing a type converter to gnostic. Seems like it was forgotten to include this when originally implemented.
@alexzielenski alexzielenski force-pushed the header_vendorext_marshal branch from cf3229a to 1cd4920 Compare March 9, 2022 20:32
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 9, 2022
Comment on lines +56 to +59
b4, err := json.Marshal(h.VendorExtensible)
if err != nil {
return nil, err
}
Copy link
Member

@liggitt liggitt Mar 9, 2022

Choose a reason for hiding this comment

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

are we using json marshaling of this type anywhere in kubernetes today (in CRD validation, or openapi v2 generation, etc)? just wanting to make sure this isn't an API-facing change in current use.

(if it is, this may still be ok, I just wanted to understand the implications)

Copy link
Member Author

@alexzielenski alexzielenski Mar 9, 2022

Choose a reason for hiding this comment

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

Looking at the instances of Response through https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json none of the default types define headers for their responses.

In the case of CRDs, it may be possible that CRDs populate response headers for their open api spec. I am wholly unfamiliar with that part of the infrastructure, though. @apelisse do you know whether existing CRDs are able to populate response Headers?

Copy link
Member

Choose a reason for hiding this comment

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

CRDs don't have the ability to do anything specific to their response header, if I understand correctly. I don't think it's being used at all.

Also, I'm not sure what this would break, or how this would be an api-facing change.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I swept k8s.io/kubernetes and couldn't find any places we construct this

Also, I'm not sure what this would break, or how this would be an api-facing change.

just wanted to know if this was going to start including directives places we hadn't before, and think if any known clients would be unable to handle those (think kubectl's fragile handling of openapi v2)

@liggitt
Copy link
Member

liggitt commented Mar 10, 2022

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 10, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexzielenski, liggitt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 10, 2022
@k8s-ci-robot k8s-ci-robot merged commit 3f90b8c into kubernetes:master Mar 10, 2022
@alexzielenski alexzielenski deleted the header_vendorext_marshal branch November 3, 2022 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants