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
I encountered strange issue in the external resources added in /pkg/apis/... while logging resource events. The error message while getting the resources is
// Decode does not do conversion. It removes the gvk during deserialization.func (dDirectDecoder) Decode(data []byte, defaults*schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
obj, gvk, err:=d.Decoder.Decode(data, defaults, into)
ifobj!=nil {
kind:=obj.GetObjectKind()
// clearing the gvk is just a convention of a codeckind.SetGroupVersionKind(schema.GroupVersionKind{})
}
returnobj, gvk, err
}
// if the object referenced is actually persisted, we can just get kind from meta// if we are building an object reference to something not yet persisted, we should fallback to schemekind:=gvk.Kindiflen(kind) ==0 {
// TODO: this is wronggvks, _, err:=scheme.ObjectKinds(obj)
iferr!=nil {
returnnil, err
}
kind=gvks[0].Kind
}
And after commenting out the reset GVK part(func (d DirectDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error)), everything works as expected.
The text was updated successfully, but these errors were encountered:
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale
k8s-ci-robot
added
lifecycle/rotten
Denotes an issue or PR that has aged beyond stale and will be auto-closed.
and removed
lifecycle/stale
Denotes an issue or PR has remained open with no activity and has become stale.
labels
Feb 7, 2018
I encountered strange issue in the external resources added in /pkg/apis/... while logging resource events. The error message while getting the resources is
After debugging the source code, and I found strange code in kubernetes between decode and versioning.
In direct decoder:
The
apiVersion
andKind
is override to null values inversioning.go
: https://github.com/kubernetes/apimachinery/blob/master/pkg/runtime/serializer/versioning/versioning.go#L267-#L271.However, the code is using something which marked
wrong
in ref.go : https://github.com/kubernetes/kubernetes/blob/v1.6.3/staging/src/k8s.io/client-go/pkg/api/v1/ref.go#L55-#L62And after commenting out the reset GVK part(
func (d DirectDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error)
), everything works as expected.The text was updated successfully, but these errors were encountered: