-
Notifications
You must be signed in to change notification settings - Fork 116
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
creationTimestamp: null is invalid since it isn't a string #105
Comments
Hi @wilmardo and thanks for all the digging! I have limited amount of time to investigate this, but I would be really grateful if someone figured out a way to validate the Custom Resource Definitions / figured a way to get this to work :) |
controller-gen generated CRDs generate creationTimestamp fields with incompatible type (in terms of openapi spec). Lazy fix is to just drop the fiel from the CRDs for now. See: * kubernetes/kubernetes#109427 * yannh/kubeconform#105 * fluxcd/flux2#2623 Bug: T306165 Change-Id: I65827e3b396d1d52ee3f8c0e90814528dfb8bfcb
Hi, |
The Kubernetes openapi has been updated and these faulty defaults have been removed: These changes should find their way to the controller-gen and packages that use these, so hopefully this issue will be resolved completely somewhere in the future :) |
Hi, this is an interesting report thread. I bumped into this issue trying to validate manifests in CI. EDIT
TYx2 I did dig a little more, in my case the route of fail is:
That link refers to:
Which takes to:
Which takes to:
|
This is an interesting one so bear with me :)
First, this is the error I stumbled when validation FluxCD CRDs. The
creationTimestamp
can't benull
and must be astring
according to the spec:So I raised an issue at fluxcd/flux2#2623 since they seemed to be the culprit.
But received a response that they use
controller-gen
to generate the CRDs. So I looked into controller-gen and they also do not set thecreationTimestamp
they importk8s.io/apimachinery/pkg/apis/meta/v1
for the generation of the metadata (where the creationTimestamp is part of)(source).So now the issue, in the package documentation (link) of
k8s.io/apimachinery/pkg/apis/meta/v1
it says the following about thecreationTimestamp
So there is something in the docblock about Null for lists(?) but in the openapi spec of Kubernetes is this
Time
resource marked as string:https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json
So now, what is wrong here? Is it indeed allowed to be a string or null and should the openapi spec be an enum? Or is there something in
k8s.io/apimachinery/pkg/apis/meta/v1
wrong? Or shouldcontroller-gen
explictly set the creationTimestamp to an string?The last one seems kinda wrong to me since it seems to me that the
k8s.io/apimachinery/pkg/apis/meta/v1
should return data valid to the api spec.I am sorry for all the text and if I did not understand something correctly :)
I don't develop in golang (or at all really) and the relation between the package and the openapi spec is quite vague for me.
The text was updated successfully, but these errors were encountered: