Skip to content

Commit

Permalink
Merge pull request #6 from heschlie/KDD-IPIP
Browse files Browse the repository at this point in the history
Adding information for IPIP
  • Loading branch information
heschlie authored Apr 13, 2017
2 parents fd97bcc + 928d953 commit 0cb7103
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backends/k8s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/projectcalico/libcalico-go/lib/backend/model"
"strconv"
"time"
"strings"
)

const (
Expand All @@ -32,6 +33,7 @@ const (

var (
singleNode = regexp.MustCompile("^/calico/bgp/v1/host/([a-zA-Z0-9._-]*)$")
ipBlock = regexp.MustCompile("^/calico/ipam/v2/host/([a-zA-Z0-9._-]*)/ipv4/block")
)

type Client struct {
Expand Down Expand Up @@ -93,6 +95,17 @@ func (c *Client) GetValues(keys []string) (map[string]string, error) {
if err != nil {
return nil, err
}
// Find the podCIDR assigned to individual Nodes
} else if m := ipBlock.FindStringSubmatch(key); m != nil {
host := m[len(m)-1]
kNode, err := c.clientSet.Nodes().Get(host, metav1.GetOptions{})
if err != nil {
return nil, err
}
cidr := kNode.Spec.PodCIDR
parts := strings.Split(cidr, "/")
cidr = strings.Join(parts, "-")
kvps[key + cidr] = "{}"
}
switch key {
case global:
Expand Down

0 comments on commit 0cb7103

Please sign in to comment.