mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Add some locking to prevent go data race logic from tripping.
This commit is contained in:
parent
7c5625b2dd
commit
783e1de5bb
@ -38,10 +38,14 @@ func (r *ControllerRegistry) SetError(err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *ControllerRegistry) ListControllers(ctx api.Context) (*api.ReplicationControllerList, error) {
|
func (r *ControllerRegistry) ListControllers(ctx api.Context) (*api.ReplicationControllerList, error) {
|
||||||
|
r.Lock()
|
||||||
|
defer r.Unlock()
|
||||||
return r.Controllers, r.Err
|
return r.Controllers, r.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ControllerRegistry) GetController(ctx api.Context, ID string) (*api.ReplicationController, error) {
|
func (r *ControllerRegistry) GetController(ctx api.Context, ID string) (*api.ReplicationController, error) {
|
||||||
|
r.Lock()
|
||||||
|
defer r.Unlock()
|
||||||
return &api.ReplicationController{}, r.Err
|
return &api.ReplicationController{}, r.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,13 +56,19 @@ func (r *ControllerRegistry) CreateController(ctx api.Context, controller *api.R
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *ControllerRegistry) UpdateController(ctx api.Context, controller *api.ReplicationController) error {
|
func (r *ControllerRegistry) UpdateController(ctx api.Context, controller *api.ReplicationController) error {
|
||||||
|
r.Lock()
|
||||||
|
defer r.Unlock()
|
||||||
return r.Err
|
return r.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ControllerRegistry) DeleteController(ctx api.Context, ID string) error {
|
func (r *ControllerRegistry) DeleteController(ctx api.Context, ID string) error {
|
||||||
|
r.Lock()
|
||||||
|
defer r.Unlock()
|
||||||
return r.Err
|
return r.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ControllerRegistry) WatchControllers(ctx api.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
func (r *ControllerRegistry) WatchControllers(ctx api.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
||||||
|
r.Lock()
|
||||||
|
defer r.Unlock()
|
||||||
return nil, r.Err
|
return nil, r.Err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user