Skip to content

Commit

Permalink
Merge pull request #1050 from skmatti/be-logs-1.6
Browse files Browse the repository at this point in the history
Revert #849[Use protobufs for communication with apiserver] in v1.6
  • Loading branch information
k8s-ci-robot authored Mar 11, 2020
2 parents 3667931 + 23d6e20 commit 4d62d61
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
10 changes: 0 additions & 10 deletions cmd/glbc/app/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ const (

// NewKubeConfig returns a Kubernetes client config given the command line settings.
func NewKubeConfig() (*rest.Config, error) {
config, err := newKubeConfig()
if err != nil {
return nil, err
}
// Use protobufs for communication with apiserver
config.ContentType = "application/vnd.kubernetes.protobuf"
return config, nil
}

func newKubeConfig() (*rest.Config, error) {
if flags.F.InCluster {
klog.V(0).Infof("Using in cluster configuration")
return rest.InClusterConfig()
Expand Down
27 changes: 24 additions & 3 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,40 @@ func NewLoadBalancerController(
// BackendConfig event handlers.
ctx.BackendConfigInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
beConfig := obj.(*backendconfigv1beta1.BackendConfig)
beConfig, ok := obj.(*backendconfigv1beta1.BackendConfig)
if !ok {
klog.Errorf("Cannot cast obj to BackendConfig (obj type is %T)", obj)
return
}
ings := operator.Ingresses(ctx.Ingresses().List()).ReferencesBackendConfig(beConfig, operator.Services(ctx.Services().List())).AsList()
lbc.ingQueue.Enqueue(convert(ings)...)
},
UpdateFunc: func(old, cur interface{}) {
if !reflect.DeepEqual(old, cur) {
beConfig := cur.(*backendconfigv1beta1.BackendConfig)
beConfig, ok := cur.(*backendconfigv1beta1.BackendConfig)
if !ok {
klog.Errorf("Cannot cast obj to BackendConfig (obj type is %T)", cur)
return
}
ings := operator.Ingresses(ctx.Ingresses().List()).ReferencesBackendConfig(beConfig, operator.Services(ctx.Services().List())).AsList()
lbc.ingQueue.Enqueue(convert(ings)...)
}
},
DeleteFunc: func(obj interface{}) {
beConfig := obj.(*backendconfigv1beta1.BackendConfig)
beConfig, ok := obj.(*backendconfigv1beta1.BackendConfig)
if !ok {
klog.V(3).Infof("Cannot cast obj to BackendConfig (obj type is %T), casting into DeletedFinalStateUnknown", obj)
var tombstone cache.DeletedFinalStateUnknown
tombstone, ok = obj.(cache.DeletedFinalStateUnknown)
if !ok {
klog.Errorf("Cannot cast obj to DeletedFinalStateUnknown (obj type is %T)", obj)
return
}
if beConfig, ok = tombstone.Obj.(*backendconfigv1beta1.BackendConfig); !ok {
klog.Errorf("Cannot cast DeletedFinalStateUnknown.obj to BackendConfig (obj type is %T)", tombstone.Obj)
return
}
}
ings := operator.Ingresses(ctx.Ingresses().List()).ReferencesBackendConfig(beConfig, operator.Services(ctx.Services().List())).AsList()
lbc.ingQueue.Enqueue(convert(ings)...)
},
Expand Down

0 comments on commit 4d62d61

Please sign in to comment.