Skip to content

Commit

Permalink
Upgrade to latest IPAM machinery API which has Fix for Resource Updat…
Browse files Browse the repository at this point in the history
…e issues (F5Networks#1791)

Signed-off-by: Subba Reddy Veeramreddy <[email protected]>
  • Loading branch information
subbuv26 authored Apr 16, 2021
1 parent 4b3798d commit bb5d1e3
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 37 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/F5Networks/k8s-bigip-ctlr
go 1.15

require (
github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210408104926-329c86830f37
github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210416093847-f0eeef5171d9
github.com/miekg/dns v1.0.14
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.10.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210408052559-865e93e27002 h1
github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210408052559-865e93e27002/go.mod h1:CmFEoeFEf4TfRWFpF8nhd9+HbkLm4vjhltH/XmullFg=
github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210408104926-329c86830f37 h1:DVRSlf3/NGy4bwZFaSQjUp/4fNFH2G/2IsWMUCT1NKk=
github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210408104926-329c86830f37/go.mod h1:CmFEoeFEf4TfRWFpF8nhd9+HbkLm4vjhltH/XmullFg=
github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210416093847-f0eeef5171d9 h1:3w2mkTPX6r0eP3mBTY+jRM8pzpIrWNjoWih4rI7HBlU=
github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210416093847-f0eeef5171d9/go.mod h1:CmFEoeFEf4TfRWFpF8nhd9+HbkLm4vjhltH/XmullFg=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
Expand Down
5 changes: 3 additions & 2 deletions pkg/crmanager/crManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ func (crMgr *CRManager) createIPAMResource() error {
crName := frameIPAMResourceName(crMgr.Agent.BIGIPURL)
f5ipam := &ficV1.F5IPAM{
ObjectMeta: metaV1.ObjectMeta{
Name: crName,
Name: crName,
Namespace: IPAMNamespace,
},
Spec: ficV1.F5IPAMSpec{
HostSpecs: make([]*ficV1.HostSpec, 0),
Expand All @@ -217,7 +218,7 @@ func (crMgr *CRManager) createIPAMResource() error {
}

// f5ipam.SetResourceVersion(obj.ResourceVersion)
ipamCR, err := crMgr.ipamCli.Create(IPAMNamespace, f5ipam)
ipamCR, err := crMgr.ipamCli.Create(f5ipam)
crMgr.ipamCR = IPAMNamespace + "/" + crName
if err != nil {
log.Debugf("[ipam] error while creating IPAM custom resource. %v", err)
Expand Down
11 changes: 4 additions & 7 deletions pkg/crmanager/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,6 @@ func (crMgr *CRManager) requestIP(ipamLabel string, host string, key string) str
} else {
//Check this for key and host both
crMgr.releaseIP(hst.IPAMLabel, hst.Host, "")
ipamCR = crMgr.getIPAMCR()
break
}
}
Expand All @@ -835,7 +834,6 @@ func (crMgr *CRManager) requestIP(ipamLabel string, host string, key string) str
} else {
//Check this for key and host both
crMgr.releaseIP(hst.IPAMLabel, "", hst.Key)
ipamCR = crMgr.getIPAMCR()
break
}
}
Expand All @@ -852,7 +850,7 @@ func (crMgr *CRManager) requestIP(ipamLabel string, host string, key string) str
return ""
}

_, err := crMgr.ipamCli.Update(IPAMNamespace, ipamCR)
_, err := crMgr.ipamCli.Update(ipamCR)
if err != nil {
log.Errorf("[ipam] Error updating IPAM CR : %v", err)
} else {
Expand Down Expand Up @@ -886,7 +884,7 @@ func (crMgr *CRManager) releaseIP(ipamLabel string, host string, key string) str
if index != -1 {
ipamCR.Spec.HostSpecs = append(ipamCR.Spec.HostSpecs[:index], ipamCR.Spec.HostSpecs[index+1:]...)
ipamCR.SetResourceVersion(ipamCR.ResourceVersion)
_, err := crMgr.ipamCli.Update(IPAMNamespace, ipamCR)
_, err := crMgr.ipamCli.Update(ipamCR)
if err != nil {
log.Errorf("[ipam] ipam hostspec update error: %v", err)
return ""
Expand All @@ -910,7 +908,7 @@ func (crMgr *CRManager) releaseIP(ipamLabel string, host string, key string) str
if index != -1 {
ipamCR.Spec.HostSpecs = append(ipamCR.Spec.HostSpecs[:index], ipamCR.Spec.HostSpecs[index+1:]...)
ipamCR.SetResourceVersion(ipamCR.ResourceVersion)
_, err := crMgr.ipamCli.Update(IPAMNamespace, ipamCR)
_, err := crMgr.ipamCli.Update(ipamCR)
if err != nil {
log.Errorf("[ipam] ipam hostspec update error: %v", err)
return ""
Expand All @@ -921,8 +919,7 @@ func (crMgr *CRManager) releaseIP(ipamLabel string, host string, key string) str
} else {
log.Debugf("[IPAM] Invalid host and key.")
}
//Workaround: To sync with FIC
time.Sleep(3 * time.Second)

return ip
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210408104926-329c86830f37
# github.com/F5Networks/f5-ipam-controller v0.1.2-0.20210416093847-f0eeef5171d9
## explicit
github.com/F5Networks/f5-ipam-controller/pkg/ipamapis/apis/fic/v1
github.com/F5Networks/f5-ipam-controller/pkg/ipamapis/client/clientset/versioned
Expand Down

0 comments on commit bb5d1e3

Please sign in to comment.