mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 05:30:26 +00:00
Prepare EtcdHelper to extract more data from Node
In order to support graceful deletion, the resource object will need access to the TTL value in etcd. Also, in the future we may want to get the creation index (distinct from modifiedindex) and expose it to clients. Change EtcdResourceVersioner to be more type specific (objects vs lists) and provide a default implementation that relies on the internal API convention. Also, rename etcd_tools.go to etcd_helper.go and split a few things up.
This commit is contained in:
@@ -50,11 +50,6 @@ var Codec = v1beta1.Codec
|
||||
// accessor is the shared static metadata accessor for the API.
|
||||
var accessor = meta.NewAccessor()
|
||||
|
||||
// ResourceVersioner describes a default versioner that can handle all types
|
||||
// of versioning.
|
||||
// TODO: when versioning changes, make this part of each API definition.
|
||||
var ResourceVersioner = runtime.ResourceVersioner(accessor)
|
||||
|
||||
// SelfLinker can set or get the SelfLink field of all API types.
|
||||
// TODO: when versioning changes, make this part of each API definition.
|
||||
// TODO(lavalamp): Combine SelfLinker & ResourceVersioner interfaces, force all uses
|
||||
|
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
func TestResourceVersioner(t *testing.T) {
|
||||
pod := internal.Pod{ObjectMeta: internal.ObjectMeta{ResourceVersion: "10"}}
|
||||
version, err := ResourceVersioner.ResourceVersion(&pod)
|
||||
version, err := accessor.ResourceVersion(&pod)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func TestResourceVersioner(t *testing.T) {
|
||||
}
|
||||
|
||||
podList := internal.PodList{ListMeta: internal.ListMeta{ResourceVersion: "10"}}
|
||||
version, err = ResourceVersioner.ResourceVersion(&podList)
|
||||
version, err = accessor.ResourceVersion(&podList)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user