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
fix(transformer): recover the GroupVersionKind of an owner whose TypeMeta is incomplete (#6139)
GenerateOwnerReferenceFromObject read the kind and the apiVersion straight from the
object's TypeMeta, which a typed client is allowed to hand back empty. The resulting
reference carries an empty kind and "/" as its apiVersion, which the API server
rejects, and which an owner based watch cannot resolve back to its owner. The unit
tests of the DataLoad value transformers encoded exactly that broken output as their
expectation.
Recover the missing fields from the GroupVersionKind known by the fluid scheme. The
kind and the apiVersion fall back on their own rather than only when the whole
TypeMeta is empty, because a partially populated TypeMeta (only the kind, or only the
apiVersion, as objects decoded from user YAML can carry) produces a reference which is
just as malformed, and because that matches the per-field fallback used for the Dataset
owner in #6138. A type which is missing from the scheme is logged, since the function
has no error return and the incomplete reference would be invisible otherwise.
Objects which do carry a complete TypeMeta are unaffected, so this only changes
references which the API server would have rejected anyway. The expectations of the
affected tests are fixed accordingly.
Two of the chains fed by this helper end up under an owner based watch: DataLoad and
DataMigrate render a batchv1.Job whose ownerReference comes from here, and both
controllers register Owns(&batchv1.Job{}).
Reported by @cheyang while reviewing #6138.
Signed-off-by: cheyang <cheyang@163.com>
0 commit comments