use interface instead of implementation
This commit is contained in:
parent
116fbe8c33
commit
9f5ed978b9
2 changed files with 4 additions and 4 deletions
|
@ -111,7 +111,7 @@ type GenericController struct {
|
||||||
|
|
||||||
// Configuration contains all the settings required by an Ingress controller
|
// Configuration contains all the settings required by an Ingress controller
|
||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
Client *clientset.Clientset
|
Client clientset.Interface
|
||||||
|
|
||||||
ResyncPeriod time.Duration
|
ResyncPeriod time.Duration
|
||||||
DefaultService string
|
DefaultService string
|
||||||
|
|
|
@ -38,7 +38,7 @@ import (
|
||||||
func (ic *GenericController) checkSvcForUpdate(svc *api.Service) error {
|
func (ic *GenericController) checkSvcForUpdate(svc *api.Service) error {
|
||||||
// get the pods associated with the service
|
// get the pods associated with the service
|
||||||
// TODO: switch this to a watch
|
// TODO: switch this to a watch
|
||||||
pods, err := ic.cfg.Client.Pods(svc.Namespace).List(api.ListOptions{
|
pods, err := ic.cfg.Client.Core().Pods(svc.Namespace).List(api.ListOptions{
|
||||||
LabelSelector: labels.Set(svc.Spec.Selector).AsSelector(),
|
LabelSelector: labels.Set(svc.Spec.Selector).AsSelector(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ func (ic *GenericController) checkSvcForUpdate(svc *api.Service) error {
|
||||||
if len(namedPorts) > 0 && !reflect.DeepEqual(curNamedPort, namedPorts) {
|
if len(namedPorts) > 0 && !reflect.DeepEqual(curNamedPort, namedPorts) {
|
||||||
data, _ := json.Marshal(namedPorts)
|
data, _ := json.Marshal(namedPorts)
|
||||||
|
|
||||||
newSvc, err := ic.cfg.Client.Services(svc.Namespace).Get(svc.Name)
|
newSvc, err := ic.cfg.Client.Core().Services(svc.Namespace).Get(svc.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error getting service %v/%v: %v", svc.Namespace, svc.Name, err)
|
return fmt.Errorf("error getting service %v/%v: %v", svc.Namespace, svc.Name, err)
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ func (ic *GenericController) checkSvcForUpdate(svc *api.Service) error {
|
||||||
|
|
||||||
newSvc.ObjectMeta.Annotations[service.NamedPortAnnotation] = string(data)
|
newSvc.ObjectMeta.Annotations[service.NamedPortAnnotation] = string(data)
|
||||||
glog.Infof("updating service %v with new named port mappings", svc.Name)
|
glog.Infof("updating service %v with new named port mappings", svc.Name)
|
||||||
_, err = ic.cfg.Client.Services(svc.Namespace).Update(newSvc)
|
_, err = ic.cfg.Client.Core().Services(svc.Namespace).Update(newSvc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error syncing service %v/%v: %v", svc.Namespace, svc.Name, err)
|
return fmt.Errorf("error syncing service %v/%v: %v", svc.Namespace, svc.Name, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue