Skip to content

Commit

Permalink
Prefer node PodCIDR from an annotation (#720)
Browse files Browse the repository at this point in the history
Current implementation never considers the "kube-router.io/pod-cidr"
annotation when creating an ipset for the node pod network CIDR.
The Node.Spec.PodCIDR is always used instead.

This patch prefers the annotation PodCIDR over the Node.Spec.PodCIDR
  • Loading branch information
dparalen authored and murali-reddy committed Apr 25, 2019
1 parent 54eedcd commit 7181d6f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/controllers/routing/network_routes_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,15 @@ func (nrc *NetworkRoutingController) syncNodeIPSets() error {
currentPodCidrs := make([]string, 0)
currentNodeIPs := make([]string, 0)
for _, node := range nodes.Items {
currentPodCidrs = append(currentPodCidrs, node.Spec.PodCIDR)
podCIDR := node.GetAnnotations()["kube-router.io/pod-cidr"]
if podCIDR == "" {
podCIDR = node.Spec.PodCIDR
}
if podCIDR == "" {
glog.Warningf("Couldn't determine PodCIDR of the %v node", node.Name)
continue
}
currentPodCidrs = append(currentPodCidrs, podCIDR)
nodeIP, err := utils.GetNodeIP(&node)
if err != nil {
return fmt.Errorf("Failed to find a node IP: %s", err)
Expand Down

0 comments on commit 7181d6f

Please sign in to comment.