-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bump k8s libs to v0.32.0 #3486
base: master
Are you sure you want to change the base?
bump k8s libs to v0.32.0 #3486
Conversation
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
3fac3c1
to
d127432
Compare
Signed-off-by: Per Goncalves da Silva <[email protected]>
if err := dec.Decode(unstructuredObject); err != nil { | ||
return nil, fmt.Errorf("error decoding yaml/json object to an unstructured object: %w: %+v", err, string(data)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question for YAML/JSON/Protobuf: is it always a guarantee that the request body contains a single object? Or do we need to handle multiple objects and continuously call Decode
until we see io.EOF
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old code seems to expect a single object. I guess because it's a POST? does that assumption stand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If old code expects a single object, we're probably safe to continue with that assumption.
data, err := io.ReadAll(b) | ||
if err != nil { | ||
panic(fmt.Errorf("failed to read request body: %w", err)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to pass the decoders an io.Reader
rather than reading everything into memory at once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm protobuf decoder seems to ask for data - but I can do it for that yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the UniversalDeserializer wants a []byte
, but the YAMLOrJSON decoder accepts an io.Reader
. So maybe pass readers to both, but then have decodeProtobuf
be the only thing that does io.ReadAll
(and YAMLOrJSON can directly read from the request body)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll pick this up on Monday. I've converted it to a draft for now. There's something else bothering me as well: 2cc85d4
need to find a nicer way to do this =S the problem is here:
opClient, err := operatorclient.NewClientFromRestConfig(validatingConfig)
func NewClientFromRestConfig(config *rest.Config) (client ClientInterface, err error) {
kubernetes, err := kubernetes.NewForConfig(config)
if err != nil {
return
}
apiextensions, err := apiextensions.NewForConfig(config)
if err != nil {
return
}
apiregistration, err := apiregistration.NewForConfig(config)
if err != nil {
return
}
client = &Client{
kubernetes,
apiextensions,
apiregistration,
}
return
}
Signed-off-by: Per Goncalves da Silva <[email protected]>
Description of the change:
Closes #3472
Closes #3470
Closes #3469
Closes #3468
Motivation for the change:
Architectural changes:
Testing remarks:
Reviewer Checklist
/doc
[FLAKE]
are truly flaky and have an issue