Support the subresource of service proxy

This commit is contained in:
feihujiang
2015-11-18 11:42:03 +08:00
parent bcabc096f2
commit ac9f890238
31 changed files with 6434 additions and 4240 deletions

View File

@@ -39,6 +39,12 @@ import (
"k8s.io/kubernetes/pkg/watch"
)
// ServiceRest includes storage for services and all sub resources
type ServiceRest struct {
Service *REST
Proxy *ProxyREST
}
// REST adapts a service registry into apiserver's RESTStorage model.
type REST struct {
registry Registry
@@ -50,14 +56,18 @@ type REST struct {
// NewStorage returns a new REST.
func NewStorage(registry Registry, endpoints endpoint.Registry, serviceIPs ipallocator.Interface,
serviceNodePorts portallocator.Interface, proxyTransport http.RoundTripper) *REST {
return &REST{
serviceNodePorts portallocator.Interface, proxyTransport http.RoundTripper) *ServiceRest {
rest := &REST{
registry: registry,
endpoints: endpoints,
serviceIPs: serviceIPs,
serviceNodePorts: serviceNodePorts,
proxyTransport: proxyTransport,
}
return &ServiceRest{
Service: rest,
Proxy: &ProxyREST{ServiceRest: rest, ProxyTransport: proxyTransport},
}
}
func (rs *REST) Create(ctx api.Context, obj runtime.Object) (runtime.Object, error) {