Remove unused members

This commit is contained in:
Wojciech Tyczynski
2015-08-06 08:57:29 +02:00
parent cb49b195a6
commit 20e84d2eb1
6 changed files with 8 additions and 36 deletions

View File

@@ -25,7 +25,6 @@ import (
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/endpoint"
"k8s.io/kubernetes/pkg/registry/pod"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/watch"
)
@@ -45,15 +44,13 @@ const (
// MinionRegistry, PodRegistry and ServiceRegistry, backed by etcd.
type Registry struct {
storage.Interface
pods pod.Registry
endpoints endpoint.Registry
}
// NewRegistry creates an etcd registry.
func NewRegistry(storage storage.Interface, pods pod.Registry, endpoints endpoint.Registry) *Registry {
func NewRegistry(storage storage.Interface, endpoints endpoint.Registry) *Registry {
registry := &Registry{
Interface: storage,
pods: pods,
endpoints: endpoints,
}
return registry

View File

@@ -28,8 +28,6 @@ import (
"k8s.io/kubernetes/pkg/registry/endpoint"
endpointetcd "k8s.io/kubernetes/pkg/registry/endpoint/etcd"
etcdgeneric "k8s.io/kubernetes/pkg/registry/generic/etcd"
"k8s.io/kubernetes/pkg/registry/pod"
podetcd "k8s.io/kubernetes/pkg/registry/pod/etcd"
"k8s.io/kubernetes/pkg/runtime"
etcdstorage "k8s.io/kubernetes/pkg/storage/etcd"
"k8s.io/kubernetes/pkg/tools"
@@ -40,15 +38,14 @@ import (
func NewTestEtcdRegistry(client tools.EtcdClient) *Registry {
storage := etcdstorage.NewEtcdStorage(client, latest.Codec, etcdtest.PathPrefix())
registry := NewRegistry(storage, nil, nil)
registry := NewRegistry(storage, nil)
return registry
}
func NewTestEtcdRegistryWithPods(client tools.EtcdClient) *Registry {
etcdStorage := etcdstorage.NewEtcdStorage(client, latest.Codec, etcdtest.PathPrefix())
podStorage := podetcd.NewStorage(etcdStorage, nil)
endpointStorage := endpointetcd.NewStorage(etcdStorage)
registry := NewRegistry(etcdStorage, pod.NewRegistry(podStorage.Pod), endpoint.NewRegistry(endpointStorage))
registry := NewRegistry(etcdStorage, endpoint.NewRegistry(endpointStorage))
return registry
}

View File

@@ -80,13 +80,10 @@ func NewStorage(s storage.Interface, k client.ConnectionInfoGetter) PodStorage {
}
statusStore := *store
bindings := &podLifecycle{}
store.CreateStrategy = pod.Strategy
store.UpdateStrategy = pod.Strategy
store.AfterUpdate = bindings.AfterUpdate
store.DeleteStrategy = pod.Strategy
store.ReturnDeletedObject = true
store.AfterDelete = bindings.AfterDelete
statusStore.UpdateStrategy = pod.StatusStrategy
@@ -181,16 +178,6 @@ func (r *BindingREST) assignPod(ctx api.Context, podID string, machine string, a
return
}
type podLifecycle struct{}
func (h *podLifecycle) AfterUpdate(obj runtime.Object) error {
return nil
}
func (h *podLifecycle) AfterDelete(obj runtime.Object) error {
return nil
}
// StatusREST implements the REST endpoint for changing the status of a pod.
type StatusREST struct {
store *etcdgeneric.Etcd

View File

@@ -32,7 +32,6 @@ import (
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/endpoint"
"k8s.io/kubernetes/pkg/registry/minion"
"k8s.io/kubernetes/pkg/registry/service/ipallocator"
"k8s.io/kubernetes/pkg/registry/service/portallocator"
"k8s.io/kubernetes/pkg/runtime"
@@ -44,23 +43,19 @@ import (
// REST adapts a service registry into apiserver's RESTStorage model.
type REST struct {
registry Registry
machines minion.Registry
endpoints endpoint.Registry
serviceIPs ipallocator.Interface
serviceNodePorts portallocator.Interface
clusterName string
}
// NewStorage returns a new REST.
func NewStorage(registry Registry, machines minion.Registry, endpoints endpoint.Registry, serviceIPs ipallocator.Interface,
serviceNodePorts portallocator.Interface, clusterName string) *REST {
func NewStorage(registry Registry, endpoints endpoint.Registry, serviceIPs ipallocator.Interface,
serviceNodePorts portallocator.Interface) *REST {
return &REST{
registry: registry,
machines: machines,
endpoints: endpoints,
serviceIPs: serviceIPs,
serviceNodePorts: serviceNodePorts,
clusterName: clusterName,
}
}

View File

@@ -35,17 +35,15 @@ import (
func NewTestREST(t *testing.T, endpoints *api.EndpointsList) (*REST, *registrytest.ServiceRegistry) {
registry := registrytest.NewServiceRegistry()
machines := []string{"foo", "bar", "baz"}
endpointRegistry := &registrytest.EndpointRegistry{
Endpoints: endpoints,
}
nodeRegistry := registrytest.NewMinionRegistry(machines, api.NodeResources{})
r := ipallocator.NewCIDRRange(makeIPNet(t))
portRange := util.PortRange{Base: 30000, Size: 1000}
portAllocator := portallocator.NewPortAllocator(portRange)
storage := NewStorage(registry, nodeRegistry, endpointRegistry, r, portAllocator, "kubernetes")
storage := NewStorage(registry, endpointRegistry, r, portAllocator)
return storage, registry
}