Skip to content

Commit

Permalink
Merge pull request kubernetes#10958 from cjcullen/racefix
Browse files Browse the repository at this point in the history
Remove race in setting/reading kubelet.podCIDR
  • Loading branch information
rjnagal committed Jul 10, 2015
2 parents ebc11e1 + da0bc5f commit affba42
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,7 @@ func (kl *Kubelet) syncNetworkStatus() {
glog.Errorf("Error on adding ip table rules: %v", err)
}
if len(kl.podCIDR) == 0 {
glog.Warningf("ConfigureCBR0 requested, but PodCIDR not set. Will not configure CBR0 right now")
networkConfigured = false
} else if err := kl.reconcileCBR0(kl.podCIDR); err != nil {
networkConfigured = false
Expand Down Expand Up @@ -2130,7 +2131,9 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
if node == nil {
return fmt.Errorf("no node instance returned for %q", kl.nodeName)
}
kl.networkConfigMutex.Lock()
kl.podCIDR = node.Spec.PodCIDR
kl.networkConfigMutex.Unlock()

if err := kl.setNodeStatus(node); err != nil {
return err
Expand Down

0 comments on commit affba42

Please sign in to comment.