You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on adding a test for some unrelated pull request, I found that my code was panicking at some part.
Since I needed to use any object type for my test, I thought it was good to use to use a simple one from the Kubernetes core types, so I picked corev1.Service.
I turns out that the Conditions field for corev1.ServiceStatus uses metav1.Condition, whose fields include LastTransitionTime. This name is different from LastUpdatedTime, which is what wrangler's pkg/conditionexpects to set.
Beware that there is no call to IsValid() for the result of getFieldValue(value, "LastUpdateTime"), hence causing the panic when unconditionally trying to set its value.
Near as I can tell, we make use of this package in Rancher (note that this is only one location, my quick search showed many more), so we can't remove it.
As far as the wider issue goes, it's possible that you found a bug in wrangler, or that the functionality that you noted wasn't intended to be used for core types (and isn't used for core types).
While working on adding a test for some unrelated pull request, I found that my code was panicking at some part.
Since I needed to use any object type for my test, I thought it was good to use to use a simple one from the Kubernetes core types, so I picked
corev1.Service
.I turns out that the
Conditions
field forcorev1.ServiceStatus
usesmetav1.Condition
, whose fields includeLastTransitionTime
. This name is different fromLastUpdatedTime
, which is what wrangler'spkg/condition
expects to set.Beware that there is no call to
IsValid()
for the result ofgetFieldValue(value, "LastUpdateTime")
, hence causing the panic when unconditionally trying to set its value.On a separate note, this makes me wonder if the https://github.com/rancher/wrangler/tree/master/pkg/generated/controllers package is actually useful or it could be cleaned up.
The text was updated successfully, but these errors were encountered: