-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(storage): allow to use age=0 in OLM conditions #6204
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Frank!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comment verbiage stuff. Also, would you mind adding a case to integration tests as well? Could go here: https://github.com/googleapis/google-cloud-go/blob/main/storage/integration_test.go#L255
Thanks @tritone, I'm blocked at the moment. I'm not sure how I can detect if Age is actually returned by the API as Do you have tips or guidance here? I tried using NullFields but that's only for Requests and not Responses. |
Update: conferred with @frankyn and we see that LifecycleRule.Age is implemented as Really this field should have been special-cased in the Apiary library as a pointer, but we can't make that change now in Apiary as it would be a breaking change for Apiary users. We're looking into workarounds and should have an update soon. |
Current plan to address this issue based on discussion with @tritone and @codyoss:
|
Bump dependency to pull in pointer field update for Lifecycle from googleapis/google-api-go-client#1598 Updates googleapis#6204
Bump dependency to pull in pointer field update for Lifecycle from googleapis/google-api-go-client#1598 Updates #6204
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned before, I'd like to have a case added to the integration tests for this as well, showing that the roundtrip of having allObjects set to/from the server works as expected. Can go here: https://github.com/googleapis/google-cloud-go/blob/main/storage/integration_test.go#L255
storage/bucket.go
Outdated
r.Condition.AgeInDays = getAgeCondition(rr.Condition.Age) | ||
if rr.Condition.Age != nil { | ||
r.Condition.AgeInDays = *rr.Condition.Age | ||
if rr.Condition.Age == googleapi.Int64(0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say if *rr.Condition.Age == 0
, no need to create another pointer. (Actually I don't know if this works as written, since the pointers will not actually be equal.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, just a small nit.
Storage Go doesn't allow setting
AgeInDays=0
after discussing with @tritone. This PR is the agreed upon path to supportAge=0
in OLM conditions. It also notes that other int fields in OLM Conditions do not support0
values.Fixes: #6539, #6240