Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#212 from shawn-hurley/issue/202-1
Browse files Browse the repository at this point in the history
Set GVK when getting the object from the cache.
  • Loading branch information
k8s-ci-robot authored Nov 21, 2018
2 parents 3bdfa82 + 857c2e6 commit fb069ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ var _ = Describe("Informer Cache", func() {
knownPod1 = createPod("test-pod-1", testNamespaceOne, kcorev1.RestartPolicyNever)
knownPod2 = createPod("test-pod-2", testNamespaceTwo, kcorev1.RestartPolicyAlways)
knownPod3 = createPod("test-pod-3", testNamespaceTwo, kcorev1.RestartPolicyOnFailure)
podGVK := schema.GroupVersionKind{
Kind: "Pod",
Version: "v1",
}
knownPod1.GetObjectKind().SetGroupVersionKind(podGVK)
knownPod2.GetObjectKind().SetGroupVersionKind(podGVK)
knownPod3.GetObjectKind().SetGroupVersionKind(podGVK)

By("creating the informer cache")
var err error
Expand Down
1 change: 1 addition & 0 deletions pkg/cache/internal/cache_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func (c *CacheReader) Get(_ context.Context, key client.ObjectKey, out runtime.O
return fmt.Errorf("cache had type %s, but %s was asked for", objVal.Type(), outVal.Type())
}
reflect.Indirect(outVal).Set(reflect.Indirect(objVal))
out.GetObjectKind().SetGroupVersionKind(c.groupVersionKind)

return nil
}
Expand Down

0 comments on commit fb069ac

Please sign in to comment.