mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
rename client.ClientInterface to client.Interface
This commit is contained in:
parent
e6ee45d38e
commit
a9fdf1f6b5
@ -29,8 +29,9 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClientInterface holds the methods for clients of Kubenetes, an interface to allow mock testing
|
// Interface holds the methods for clients of Kubenetes,
|
||||||
type ClientInterface interface {
|
// an interface to allow mock testing.
|
||||||
|
type Interface interface {
|
||||||
ListPods(selector labels.Selector) (api.PodList, error)
|
ListPods(selector labels.Selector) (api.PodList, error)
|
||||||
GetPod(name string) (api.Pod, error)
|
GetPod(name string) (api.Pod, error)
|
||||||
DeletePod(name string) error
|
DeletePod(name string) error
|
||||||
|
@ -36,7 +36,7 @@ import (
|
|||||||
// TODO: Remove the etcd dependency and re-factor in terms of a generic watch interface
|
// TODO: Remove the etcd dependency and re-factor in terms of a generic watch interface
|
||||||
type ReplicationManager struct {
|
type ReplicationManager struct {
|
||||||
etcdClient tools.EtcdClient
|
etcdClient tools.EtcdClient
|
||||||
kubeClient client.ClientInterface
|
kubeClient client.Interface
|
||||||
podControl PodControlInterface
|
podControl PodControlInterface
|
||||||
syncTime <-chan time.Time
|
syncTime <-chan time.Time
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ type PodControlInterface interface {
|
|||||||
|
|
||||||
// RealPodControl is the default implementation of PodControllerInterface.
|
// RealPodControl is the default implementation of PodControllerInterface.
|
||||||
type RealPodControl struct {
|
type RealPodControl struct {
|
||||||
kubeClient client.ClientInterface
|
kubeClient client.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r RealPodControl) createReplica(controllerSpec api.ReplicationController) {
|
func (r RealPodControl) createReplica(controllerSpec api.ReplicationController) {
|
||||||
@ -81,7 +81,7 @@ func (r RealPodControl) deletePod(podID string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MakeReplicationManager craetes a new ReplicationManager.
|
// MakeReplicationManager craetes a new ReplicationManager.
|
||||||
func MakeReplicationManager(etcdClient tools.EtcdClient, kubeClient client.ClientInterface) *ReplicationManager {
|
func MakeReplicationManager(etcdClient tools.EtcdClient, kubeClient client.Interface) *ReplicationManager {
|
||||||
rm := &ReplicationManager{
|
rm := &ReplicationManager{
|
||||||
kubeClient: kubeClient,
|
kubeClient: kubeClient,
|
||||||
etcdClient: etcdClient,
|
etcdClient: etcdClient,
|
||||||
|
@ -67,7 +67,7 @@ func LoadAuthInfo(path string) (*client.AuthInfo, error) {
|
|||||||
// 'name' points to a replication controller.
|
// 'name' points to a replication controller.
|
||||||
// 'client' is used for updating pods.
|
// 'client' is used for updating pods.
|
||||||
// 'updatePeriod' is the time between pod updates.
|
// 'updatePeriod' is the time between pod updates.
|
||||||
func Update(name string, client client.ClientInterface, updatePeriod time.Duration) error {
|
func Update(name string, client client.Interface, updatePeriod time.Duration) error {
|
||||||
controller, err := client.GetReplicationController(name)
|
controller, err := client.GetReplicationController(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -91,7 +91,7 @@ func Update(name string, client client.ClientInterface, updatePeriod time.Durati
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StopController stops a controller named 'name' by setting replicas to zero
|
// StopController stops a controller named 'name' by setting replicas to zero
|
||||||
func StopController(name string, client client.ClientInterface) error {
|
func StopController(name string, client client.Interface) error {
|
||||||
controller, err := client.GetReplicationController(name)
|
controller, err := client.GetReplicationController(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -110,7 +110,7 @@ func StopController(name string, client client.ClientInterface) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ResizeController resizes a controller named 'name' by setting replicas to 'replicas'
|
// ResizeController resizes a controller named 'name' by setting replicas to 'replicas'
|
||||||
func ResizeController(name string, replicas int, client client.ClientInterface) error {
|
func ResizeController(name string, replicas int, client client.Interface) error {
|
||||||
controller, err := client.GetReplicationController(name)
|
controller, err := client.GetReplicationController(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -153,7 +153,7 @@ func makePorts(spec string) []api.Port {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RunController creates a new replication controller named 'name' which creates 'replicas' pods running 'image'
|
// RunController creates a new replication controller named 'name' which creates 'replicas' pods running 'image'
|
||||||
func RunController(image, name string, replicas int, client client.ClientInterface, portSpec string, servicePort int) error {
|
func RunController(image, name string, replicas int, client client.Interface, portSpec string, servicePort int) error {
|
||||||
controller := api.ReplicationController{
|
controller := api.ReplicationController{
|
||||||
JSONBase: api.JSONBase{
|
JSONBase: api.JSONBase{
|
||||||
ID: name,
|
ID: name,
|
||||||
@ -208,7 +208,7 @@ func RunController(image, name string, replicas int, client client.ClientInterfa
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func createService(name string, port int, client client.ClientInterface) (api.Service, error) {
|
func createService(name string, port int, client client.Interface) (api.Service, error) {
|
||||||
svc := api.Service{
|
svc := api.Service{
|
||||||
JSONBase: api.JSONBase{ID: name},
|
JSONBase: api.JSONBase{ID: name},
|
||||||
Port: port,
|
Port: port,
|
||||||
@ -225,7 +225,7 @@ func createService(name string, port int, client client.ClientInterface) (api.Se
|
|||||||
|
|
||||||
// DeleteController deletes a replication controller named 'name', requires that the controller
|
// DeleteController deletes a replication controller named 'name', requires that the controller
|
||||||
// already be stopped
|
// already be stopped
|
||||||
func DeleteController(name string, client client.ClientInterface) error {
|
func DeleteController(name string, client client.Interface) error {
|
||||||
controller, err := client.GetReplicationController(name)
|
controller, err := client.GetReplicationController(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user