* move bufio reader creation out of for loop
if the bufio reader is created in the for loop we get unmarshaling errors
* fix linter issue
* add fixed ut
* fix existing unit test flake due to closing pipe on error
a previous fix ensured the socket closed on error, but this caused an existing ut to nondeterministically fail
without the previous fix, the socket wouldn't have been closed on error
* make read inline
* move error handling code to defer
* invert conditional
* address linter issues
* add close connection on telemetry unmarshal error unit test
* Revert "add close connection on telemetry unmarshal error unit test"
This reverts commit e8447f9d0d.
* feat: 🌈 StatelessCNI: Adding getEndpoint and UpdateEndpoint API to CNS (#2102)
* Adding getEndpoint and UpdateEndpoint API to CNS with the respective clients in support of stateless CNI.
* Updating the unit tests and address the comments.
* Addressing the comments.
* Addressing the coments regarding CNS support for Stateless CNI
* Adddressing the PR comments
* 🌈 feat: adding flags for stateless cni (#2103)
feat: stateless cni
* 🌈 feat: StatelessCNI: Applying stateless CNI mode changes in network package. (#2197)
* Apllying stateless CNI mode in network package.
* Addresing the commetns.
* feat: create stateless cni binary for swift (#2275)
* enabling CNS telemetry
* Master rebase changes
* CNI Telemetry enabled on CNS
* Stateless CNI changes.
* making change to CNSendpointStorePath
* Updating makefile to avoid creating statless CNI release.
---------
Co-authored-by: Vipul Singh <vipul21sept@gmail.com>
* Adding a defer func to connecttoTelemetryservice() to prevent CNI from stucking in case of telemetry service failure.
* fix: addressing the comments for telemetry defer function.
* fix: addressing the comments for telemetry defer func.
* Moving the lock from InitializeKeyValueStore() function to restore/save functions to improve cni performance on windows.
* fix: use defer function to unlock statefile.
* fix: fixing the IPAM lock and defer func
* fix: Optimizing cni file lock by moving SetSdnRemoteArpMacAddress() on startup for CRD and MultitenantCRD mode.
* adding store lock on telemetry service start to avoid race condition on windows.
* Remove azure-vne-telemetry for windows multitenancy and telemetry service for windows multitenancy will be started from cns.
* start telemetry service from cns
* lint and log fix
* minor change
* addressed comment
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* added lockedfileapi support for CNI
* fixed interface changes
* addressed comments
fixed ut
* addressed comments
* fixed copy to buffer part in writer api
* fixed copy to buffer part in writer api
* keeping old code not changing it.
* Refactor UTs to cleanup UTs and increase UT coverages
* User assert for consistency
* Applied comments and resolve lint error
* Delete unnecessary license header
Co-authored-by: JungukCho <jungukcho@microsoft.com>
* write to temp file and move to state file
* fixed memleak and other issues
* call windows replace function with MOVEFILE_WRITE_THROUGH flag
* moved few functions to platform package
* moved test files to correct dir
* addressed comments
* Added else if to catch empty messages
* Stopped sending empty messages to AI telemetry for CNI
* Removing cni prefix from log messages
* Reverting go.sum change back to what it was before
* Adding check for empty messages before sending metric
* Moving empty message check before cnimetric initialization
* Added AITelemetry support for CNI
* added new files
* added other configs in config file
* fixed ut
* updated disableall similar to cns
* added container name to report
* addressed review comments
* addressed review comments
* added check for azure environment
* added log
* close log handle in unit test
* addressed review comments
* addressed review comments
* fixed a condition
* keep the netagent channel for logs
* fixed error
* addressed review comments
* added application insights telemetry package to send metrics and logs to appinsights
* moved a function common to both packages
acquired a lock before writing to file
* added read write lock as per chandan comment. Addressed jaeryn comments
* fixed telemetry unit test
* defined interface and added appinsights package as vendor to acn
* added vendor package.go(appinsights)
* dependencies of appinsights
* added AI dependencies
* updated unit tests
* addressed review comments
* change telemetry to message queue and add npm
* remove [Azure-NPM] prefix
* remove npmreport url
* fair scheduling
* holds up to 1k reports for each type
* fix cap on reports
* configure dns server on azure bridge for ubuntu versions > 18. Moved hns related apis from platform package to hsnclient package
* read dns server from interface instead of file and fixed few issues
* renturn error on fail to configure dns
* added unitest and fixed an issue in ReadFileByLines method
* added a UT
* addressed comments and added few tests to get code coverage
* confiure dns for ubuntu17 also
* corrected typo error of filename
* Spawn telemetry buffer in a separate process instead of goroutine.
* Adding an option to disable telemetry.
* Addressing some of Tamilmani's comments.
* 1. Start telemetry service as separate process for all components cns/networkmonitor
2. Added telemetry config through which we can configure reportTohost interval
3. Added unit tests for changes
* added new files for telemetry testing
* added tests for invalid cases
* updated with dummy subid
* fixed logging part of telemetry
* fixed an issue
* added more test coverage
* fixed an issue
* fixed invalid condition and added UT
* initialize telemetry logger as part of telemetry server
* changed checkifsockexists to sockexists
* changed interval time to push telemetry data to host
* added UT to fix code coverage
* added check before closing client connection
* replaced fmt.Printf with t.Errorf
* Calling cancel to exit server thread and close connection
* updated comments
* fixed an issue in telemtry server code if server closes client connection before
* fixed removing tb connection from array
* removed dead code
* removed duplicate logs
* added a check for removing element from tb.connections
* added mutex lock as multiple threads accessing tb.connections slice
* moved the condition before client close
* added one more UT to fix code coverage
* fixed the ut. shud not write after close
* 1. fix for closing telemetry socket in cni
2. fix for closing connection socket if server receives error on read
* added uts and addressed comments
* removed from slice after closing connection