mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-21 22:49:31 +00:00
fix dot import.
This commit is contained in:
@@ -21,17 +21,17 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
. "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
|
||||
)
|
||||
|
||||
type ServiceRegistry interface {
|
||||
ListServices() (ServiceList, error)
|
||||
CreateService(svc Service) error
|
||||
GetService(name string) (*Service, error)
|
||||
ListServices() (api.ServiceList, error)
|
||||
CreateService(svc api.Service) error
|
||||
GetService(name string) (*api.Service, error)
|
||||
DeleteService(name string) error
|
||||
UpdateService(svc Service) error
|
||||
UpdateEndpoints(e Endpoints) error
|
||||
UpdateService(svc api.Service) error
|
||||
UpdateEndpoints(e api.Endpoints) error
|
||||
}
|
||||
|
||||
type ServiceRegistryStorage struct {
|
||||
@@ -44,8 +44,8 @@ func MakeServiceRegistryStorage(registry ServiceRegistry) apiserver.RESTStorage
|
||||
|
||||
// GetServiceEnvironmentVariables populates a list of environment variables that are use
|
||||
// in the container environment to get access to services.
|
||||
func GetServiceEnvironmentVariables(registry ServiceRegistry, machine string) ([]EnvVar, error) {
|
||||
var result []EnvVar
|
||||
func GetServiceEnvironmentVariables(registry ServiceRegistry, machine string) ([]api.EnvVar, error) {
|
||||
var result []api.EnvVar
|
||||
services, err := registry.ListServices()
|
||||
if err != nil {
|
||||
return result, err
|
||||
@@ -53,9 +53,9 @@ func GetServiceEnvironmentVariables(registry ServiceRegistry, machine string) ([
|
||||
for _, service := range services.Items {
|
||||
name := strings.ToUpper(service.ID) + "_SERVICE_PORT"
|
||||
value := strconv.Itoa(service.Port)
|
||||
result = append(result, EnvVar{Name: name, Value: value})
|
||||
result = append(result, api.EnvVar{Name: name, Value: value})
|
||||
}
|
||||
result = append(result, EnvVar{Name: "SERVICE_HOST", Value: machine})
|
||||
result = append(result, api.EnvVar{Name: "SERVICE_HOST", Value: machine})
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -76,16 +76,16 @@ func (sr *ServiceRegistryStorage) Delete(id string) error {
|
||||
}
|
||||
|
||||
func (sr *ServiceRegistryStorage) Extract(body string) (interface{}, error) {
|
||||
var svc Service
|
||||
var svc api.Service
|
||||
err := json.Unmarshal([]byte(body), &svc)
|
||||
svc.Kind = "cluster#service"
|
||||
return svc, err
|
||||
}
|
||||
|
||||
func (sr *ServiceRegistryStorage) Create(obj interface{}) error {
|
||||
return sr.registry.CreateService(obj.(Service))
|
||||
return sr.registry.CreateService(obj.(api.Service))
|
||||
}
|
||||
|
||||
func (sr *ServiceRegistryStorage) Update(obj interface{}) error {
|
||||
return sr.registry.UpdateService(obj.(Service))
|
||||
return sr.registry.UpdateService(obj.(api.Service))
|
||||
}
|
||||
|
Reference in New Issue
Block a user