Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #849[Use protobufs for communication with apiserver] in v1.6 #1050

Merged
merged 2 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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