---
# System prepended metadata

title: CreationTimestamp handling brainstorming

---

# CreationTimestamp handling brainstorming

## Problem

- Issue  - https://github.com/kubernetes/kubernetes/issues/67610 
- `creationTimestamp` was originally added as a struct which means the omitempty tags for it are not respected.
- Due to this, marshalling an API object (with embedded ObjectMeta) gets a `creationTimestamp: null` value.


## Things to keep in mind

- Ensure wire compatibility for existing json and proto objects
- If this is made a pointer, ensure that all places that reference it check for nils to avoid NPEs.


## Possible Approaches

1. One potential hacky fix: https://github.com/projectcontour/ir2proxy/commit/dbef126f82c4e960672ecd2b30dcdecf6ae9039e
2. Brian Grant suggested to handle this in kubectl
    - [nikhita] But this would only help with controlling the pretty printed output and not help in adressing the problem for webhook payloads, etc, right?
3. This approach is not favorable but adding it here for documentation purposes - adding a custom marshaller for `ObjectMeta`. This does not work because `ObjectMeta` is embedded in all API objects and adding a custom marshaller for `ObjectMeta` would mean that it gets promoted to the containing API object. Ref: [PR that tried this approach](https://github.com/kubernetes/kubernetes/pull/104857)

## Current state

- A fix in the language seems increasingly unlikely (even though it is of high demand by the community)
    - Last week issue opened in `golang/go` for `vet` to warn about `time.Time` or in general struct values having `omitempty`: https://github.com/golang/go/issues/51261

## Notes

- [This](https://github.com/kubernetes/apimachinery/blob/4f3ae9f49dfdf9fb3ed05e31b9fb6beb0b9519d8/pkg/apis/meta/v1/time.go#L142-L144) is where the `null` value gets emitted for a zero value of `time.Time`.
