Description
The first argument to ctrl.NewManager(...)
is a normal *rest.Config
from client-go.
That type is composed of the rest.ContentConfig
type among others.
rest.ContentConfig
has fields Accept ContentTypes
and ContentType
that are documented as follows:
type ContentConfig struct {
// AcceptContentTypes specifies the types the client will accept and is optional.
// If not set, ContentType will be used to define the Accept header
AcceptContentTypes string
// ContentType specifies the wire format used to communicate with the server.
// This value will be set as the Accept header on requests made to the server, and
// as the default content type on any object sent to the server. If not set,
// "application/json" is used.
ContentType string
//...
}
Controller runtime does not seem to honor these rules. When neither ContentType
nor AcceptContentTypes
are explicitly set, JSON is used for CR types (since that is all that is possible), but protobufs are used for any type that is built-in to k8s.
I cannot find any documentation or even an issue explaining this. The change occurred in #1149, but was made without explanation.
So the only documentation anyone has to go on is what rest.Config
says and Controller Runtime seems to defy those rules.
Would it be possible for this behavior be explicitly documented somewhere along with the rationale for doing so (so that people know what they're getting themselves into if they override it)?
Many apologies in advance if this is documented somewhere and I have failed to find it.