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

fix(crank/render): conditions' lastTransitionTime can not be null #5346

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

phisco
Copy link
Contributor

@phisco phisco commented Feb 6, 2024

Description of your changes

Follow up for #5305, testing out https://github.com/phisco/function-environment-configs I noticed that lastTransitionTime can not be set to null 🤦‍♂️:

$ /Users/phisco/github.com/crossplane/crossplane/_output/bin/darwin_arm64/crank beta render  \
  --extra-resources example/environmentConfigs.yaml \
  --include-full-xr \
  example/xr.yaml example/composition.yaml example/functions.yaml | /Users/phisco/github.com/crossplane/crossplane/_output/bin/darwin_arm64/crank beta validate example -
[x] schema validation error example.crossplane.io/v1, Kind=XR, example-xr : status.conditions[0].lastTransitionTime: Invalid value: "null": status.conditions[0].lastTransitionTime in body must be of type string: "null"
Total 1 resources: 0 missing schemas, 0 success cases, 1 failure cases
crossplane: error: cannot validate resources: could not validate all resources

With this we set it to a random fixed date, so that it's still consistent for downstream consumers:

/Users/phisco/github.com/crossplane/crossplane/_output/bin/darwin_arm64/crank beta render  \
  --extra-resources example/environmentConfigs.yaml \
  --include-full-xr \
  example/xr.yaml example/composition.yaml example/functions.yaml | /Users/phisco/github.com/crossplane/crossplane/_output/bin/darwin_arm64/crank beta validate example -
[✓] example.crossplane.io/v1, Kind=XR, example-xr validated successfully
Total 1 resources: 0 missing schemas, 1 success cases, 0 failure cases

I have:

Need help with this checklist? See the cheat sheet.

Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
@phisco phisco requested a review from a team as a code owner February 6, 2024 12:58
@phisco phisco requested review from bobh66 and negz February 6, 2024 12:58
@phisco phisco merged commit 0ce4b9e into crossplane:master Feb 6, 2024
16 checks passed
Copy link

github-actions bot commented Feb 6, 2024

Successfully created backport PR for release-1.15:

xrCond.LastTransitionTime = metav1.Time{}
// lastTransitionTime would just be noise, but we can't drop it as it's a
// required field and null is not allowed, so we set a random time.
xrCond.LastTransitionTime = metav1.NewTime(time.Date(2024, time.January, 1, 0, 0, 0, 0, time.UTC))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not the current time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make it stable, I imagined someone comparing the output to some static file and the random timestamp would have made it needlessly harder to do.

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

Successfully merging this pull request may close these issues.

None yet

3 participants