Граф коммитов

23 Коммитов

Автор SHA1 Сообщение Дата
Evan Baker 4a4370b0be
chore: tidy up nmagent client for context timeouts (#1056)
* chore: tidy up nmagent client for context timeouts

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* address review feedback

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* fix tests

* change integration test timeout to 1h

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* guard against nil in wireserver util

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* read body

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* correct durations

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2021-10-21 13:14:03 -05:00
Evan Baker 17bd9425d0
chore: tidy up the wireserver client and usage (#1065)
* chore: tidy up IMDS client

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* rename from imds to wireserver

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2021-10-20 14:23:05 -05:00
Evan Baker 1bcf6d80b5
fix: prevent ipampoolmonitor from reconciling before it receives a nodenetworkconfig (#1044)
fix ipampoolmonitor starting before receiving a nodenetworkconfig

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2021-10-13 12:14:50 -05:00
Evan Baker c970d07e8f
Create NNC scoped client and isolate ipampoolmonitor and NNC reconciler (#1006)
* create nodenetworkconfig client

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* add envnodename to config

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* rewrite and fully test nnc to nc conversion

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* use nnc clients to separate reconciler and ipampoolmonitor

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* inline reconciler event filters

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* delint

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* test env config

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* wrap errs

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* test reconciler

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* address review comments

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* rebase cleanup

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* fix test

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* address review feedback

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2021-10-07 11:55:09 -05:00
Hunter Gregory fe23878507
Remove test coverage (#1007)
* removed test/ and testutil/ from code coverage

* remove promutil from coverage

* removed tools/ from code coverage

* removed crd/ from code coverage and updated multitenantnetworkcontainer's manifest

* switch to !ignore_NAME syntax for test and cli tags

* add coverage back to crd (besides autogenerated files)

* rename ignore_test and ignore_cli tags to ignore_uncovered

* make cns/fakes/ uncovered

* mark go files in crd api folders as uncovered again

* add main.go back for nnsmock server
2021-09-17 15:29:40 -07:00
Evan Baker 96bec09d41
chore: appease the linter (3/?), the big gofumpt (#987)
* gofumpt -w -s .

* small addtl cleanups after gofumpt

* rerun after rebase
2021-09-02 16:33:18 -05:00
Evan Baker 642028dabc
chore: remove rename from nnc/v1alpha import (#980) 2021-08-25 11:57:14 -05:00
Evan Baker b7a82caa19
Consolidate CRD packages (#975)
* relocate nnc to crd/ package and update all CRDs

* update usages of CRDs to crd package
2021-08-18 17:11:52 -05:00
Evan Baker 059b7b5d5c
chore: cleanups in ipampoolmonitor (#969) 2021-08-16 09:14:51 -07:00
Evan Baker 3bd237cbf1
fix: hysteresis in ipampool during rapid pool scaling (#967)
* Fix CNS Scale Up/down fix to avoid cleanup pending ToBeDeleted ips

* remove pendingRelease bool flag

* Incorporate feedback

* incorporate lint failures

* fix more lint issues

* nit fixes again for lint errors

* fixes for lint

* fix comment spacing

* fix final lints

* fix broken ipampoolmonitor test

Co-authored-by: neaggarw <neaggarw@microsoft.com>
Co-authored-by: Matthew Long <61910737+thatmattlong@users.noreply.github.com>
2021-08-09 19:34:34 -07:00
Evan Baker 212105f260
chore: typed response codes (#954)
* chore: typed error response code
2021-08-06 14:19:21 -07:00
Evan Baker 0bcb0d0da5
chore: migrate from exit/err channels to context (#900)
* chore: migrate from exit/err channels to context

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>

* pass context instead of storing

* rename controller packages

* comment init
2021-06-23 10:01:13 -07:00
Mathew Merrick 1fa243e5f5
CI: Add golint-ci (#888)
* add golint-ci

* add gofmt

* enable linters

* uncap count

* fix linting/fmt issues
2021-06-01 16:58:56 -07:00
Kshitija Murudi 9aa3781a0a Adding UpdatingIpsNotInUse and Cached NNC to Debug API
In-memory data API - adding 2 more fields to IPAMPoolMonitor
2021-04-07 11:25:35 -07:00
Kshitija Murudi 9947dba9c0 [CNS] Debug API to expose In-Memory Data HTTPRestService
This commit has following changes -
1. Removed AllocatedIPCount field from HTTPRestService
struct in restserver.go as it is not used in project.
2. Added debug command getInMemory and API to expose
fields-HTTPRestService and 2 fields from IPAMPoolMonitor.
Please review the naming of the command, handler and end
point.
3. Added Test function to test the new api response.
4. Added changes as per review comments - Get request
for Test endpoint.
2021-04-06 23:59:26 -07:00
neaggarwMS cab6615310
Azure CNS fix reconcile bug (#809)
Handle the race scenario where HTTP Listener gets started before initializing CNS state. During Initialization/Reconciliation, CNS gets the CRD and recreates the NC request with SecondaryIPs, then it gets list of pods and set those ips as Allocated. If HTTP listener is started then CNI will start requesting ips to CNS and CNS will start allocating right after they are set to Available, thus double allocations. Thus reordered the calls and ensured HTTP Listener is started after initializing CNS.

Also fixed

some logging
avoid double release during failure in IPAM pool monitor
2021-03-02 09:01:49 -08:00
shchen 327b0b6415
Ensure pending programming IPs will be released before available IPs when scale down. (#750)
* Ensure pending programming IPs will be released first when scale down.

* Addressed feedbacks for testing and coding style.
2021-01-15 10:05:59 -08:00
shchen 3c48a34df6
Add a go routine to update NC host version from NMAgent periodically. (#714)
* Add a go routine to update NC host version from NMAgent periodically.
If orchestrator type is CRD, update pending programming IPs as well.

* Update NC version in test from 0 to -1, which will allow default IP state as Avaialable instead of pending programming.

* Add secondary IP status updation when reconcile.
Resovle conflicts manually.

Update unit test nc version value.

Update unit test nc version.

Add get nmagent default value back for integ testing purpose.
Unit test can be break by this change.

Update default new IP CNS status to available.

Assign value to host version if none exist in util.go

Addressed feedback and perform cluster integ test with 1 sec frequent nc version update.
Need to clean logNCSnapshots when send out PR.

Update nc version associate with secondary ip. Add new nmagent api test.

Add versionResponseWithoutToken.Containers log

Add containerId from our runner sub.
Add containerId from NMAgent team.

Addressed feedback and add real nmagent logic.

Add timeout when query nmagent for nc version.

* Update comments.

* Add context background with timeout function for syncing node nc version.

* Add 5 second force update CNS pending programming IP to available logic.

* Resovle merge conflict from master.

* Debug and it pass all the test.
This is the final version.

Change the way of http get request to add context. Change channel to no buffer with same goroutine.
Found always fall in ctx.Done() condition.
Add channel close for get nc version list.
Add milisecond unit for timeout.

Testing with different context version.

* Resolve merge conflict.

* Remove force update pending programming IP to available logic. Remain retry if no response from NMAgent.
Release pending programming IP when scale down.

* Remain VMVersion, HostVersion variable name as it is and use the Version inside CreateNetworkContainerRequest.

* Addressed team member feedback.
2020-12-11 13:54:17 -08:00
neaggarwMS 28207fc493
CNS: Fix IPAM scaler down to handle incremental decrease (#731) 2020-11-16 16:47:28 -08:00
shchen ce35cd2095
Add pending program status for IPs in CNS. (#690)
* Add pending program status for IPs in CNS.
Add logic structure of how to update program status.

* Add missing NCVersion CreateNetworkContainerRequest in commit.

* Add missing fake GetPendingProgramIPConfigs to unblock ipam pool unit test.

* Address feedbacks.

* Modify function parameter to meet current unit test requirement.

* Add updating secondary IPs to pending programming status logic.

* Add ip state update when CRD status change.

* Update NC ID.

* Update NC ID.

* Update comments.

* Remove NC version compare and update logic. This logic will be moved to a background thread.

* Update comments accordingly.

* Add unit test.

* Update nmagent version in test.

* Update function name.
2020-10-22 15:43:09 -07:00
Mathew Merrick 51a8884122
CNS Pool Scaling (#668)
* init with test framework

* handle multiple batch size pool request

* test verification

* handle batch size multiples

* address feedback

* fix test

* remove test struct from fakes

* fix nil test

* fix tests

* feedback

* scale down

* init scale down

scale down testing

test work

reconcile fake requestcontroller

test revision

check for cached nonreleased ipconfigs

remove test struct from decrease fakes

initial integration

fix interface signature

test get pending release

futher integration tseting

test fixes

* start feedback

* update request controller

* fixed tests

* test fix

* ipampoolmonitor in cns not request controller

* init fake ipam pool monitor
2020-09-16 11:25:19 -07:00
Mathew Merrick 66e9be120b
CNS Pool Monitor - Init and basic resize logic (#663)
* init CNS IPAM pool monitor

* update tests

* scalar struct, separate package, cns interface

* addressing feedback
2020-08-26 23:20:33 -07:00
neaggarwMS de95ffc399
Pass HostInterface PrimaryIP info to CNI (#662)
* Pass HostPrimaryInterface details to CNS
2020-08-21 14:04:50 -07:00