Skip to content
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

invalid value: \"null\": status.creationtimestamp in body must be of type string #197

Open
shenkonghui opened this issue Mar 1, 2024 · 0 comments

Comments

@shenkonghui
Copy link
Owner

https://pkg.go.dev/sigs.k8s.io/cluster-api/api/v1alpha2#Convert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus

During the upgrade to controller-tools@v2 for v1alpha2, we noticed a failure would occur running Cluster API test suite against the new CRDs, specifically spec.metadata.creationTimestamp in body must be of type string: "null". The investigation showed that controller-tools@v2 behaves differently than its previous version when handling types from metav1(k8s.io/apimachinery/pkg/apis/meta/v1) package.

In more details, we found that embedded (non-top level) types that embedded metav1.ObjectMeta had validation properties, including for creationTimestamp (metav1.Time). The metav1.Time type specifies a custom json marshaller that, when IsZero() is true, returns null which breaks validation because the field isn't marked as nullable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant