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

300 Коммитов

Автор SHA1 Сообщение Дата
Paul Johnston 6d208e9762
Cns windows aks (#1059)
* chore: add in some functionality for CNS on windows host process pods
2021-11-22 09:23:01 -08:00
Eng Zer Jun e812bc82b8
refactor: move from io/ioutil to io and os packages (#1096)
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>
2021-11-17 16:31:42 -06:00
tamilmani1989 cdab7d0241
Use Lockedfile api to acquire lock (#1070)
* 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.
2021-11-09 08:19:44 -08:00
Jaeryn 01085728bb
fix: Add NAT Policies for Windows AKS-Swift Scenario (#1036)
* Add DNS NAT policy for windows AKS-Swift scenario

* Addressing comments

Co-authored-by: Jaeryn <tsun.chu@microsoft.com>
2021-10-20 13:58:10 -07:00
tamilmani1989 519aeca381
fix: Fail network creation if handleCommonOptions return error (#1063)
* handle errors in setting up routes and iptables for AKS-Swift

* added netio interface in networkmanager
2021-10-19 10:54:49 -07:00
tamilmani1989 279911c94a
Support for Dualstack transparent (#1046)
* ipv6 dualstack support transparent mode

* golint fixes

* fixed linter errors

* enable ipv6 setting

* dualstack transparent changes

* abstracted platform execute command

* lint fixes
fix compilation issues

* addressed comments

* fixed a bug
2021-10-15 14:28:37 -07:00
tamilmani1989 3510ac4977
no need to remove lock files on reboot (#1041) 2021-10-01 11:22:53 -07:00
tamilmani1989 58827523c7
Reduce lock timeout and check pid same before cleaning up (#1035)
* lock fix changes

* added test files

* removing unused file

* lint fixes

* Update cni/plugin.go

Co-authored-by: Evan Baker <rbtr@users.noreply.github.com>

* addressed comments

* nit fix

Co-authored-by: Evan Baker <rbtr@users.noreply.github.com>
2021-09-30 15:48:51 -07:00
tamilmani1989 7fc87686a3
fix cni issue (#1039) 2021-09-30 15:47:06 -07:00
tamilmani1989 2b53e0a4dd
address comments of utcoverage PR (#1028) 2021-09-22 10:26:47 -07:00
Mathew Merrick f9b65e95d2
test: add multitenancy ut's (#1018)
* multitenancy minor refactor, and add ut's
2021-09-21 09:11:58 -07:00
Mathew Merrick a0dae62f01
test: Add tests for CNS IPAM invoker methods (#997)
* add happy path for add

* happy path delete and host options
2021-09-20 17:53:49 -07:00
tamilmani1989 99a856982c
cni/network unit test coverage (#1020)
* adding uts

* feat: update cns client (#992)

* fix debug commands

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

* fix: update cns client

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

* add ctx to debug calls

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

* repackage cns client

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

* add ctx to all methods and preinit all route urls

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

* down-scope cns client interface and move to consumer packages

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

* no unkeyed struct literals

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

* trace updated client method signatures out through windows paths

* delint

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

* fix windows build

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

* delint

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

* Remove dead codes from telemetry package (#1004)

* Netlink package interfacing and adding a fake (#996)

* Initial pass at Netlink interface

* changing some netlink and epc

* Resolcing all dependencies on netlink package

* first pass at adding a netlinkinterface

* windows working now

* feat: update cns client (#992)

* fix debug commands

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

* fix: update cns client

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

* add ctx to debug calls

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

* repackage cns client

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

* add ctx to all methods and preinit all route urls

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

* down-scope cns client interface and move to consumer packages

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

* no unkeyed struct literals

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

* trace updated client method signatures out through windows paths

* delint

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

* fix windows build

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

* delint

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

* windows working now

* Some golints checks

* commenting a flaky NPM UT and adding some golint checks

* renaming fakenetlink to mocknetlink

* removing a mock netlink usage

* fixing more golints and a test fix

* fixing more go lints

* Adding in netlink from higher level as input

* adding netlinkinterface to windows endpoint impl

* removing netlink name confusion

Co-authored-by: Evan Baker <rbtr@users.noreply.github.com>

* test: add tests for CNI Azure invoker (#1010)

* include add tests

* test delete

* gci

* chore: Refactor UTs in telemetry packages (#1011)

* Refactor UTs to cleanup UTs and increase UT coverages

* User assert for consistency

* Applied comments and resolve lint error

* Delete unnecessary license header

* Add UT coverage ovs_network_client (#1008)

* Added ovsctl mock
* Changed iptables and ovsctl to use interface instead of concrete
  classes
* Added tests for ovs_networkclient_linux.go
* Fix linter issues

Co-authored-by: Shriroop <shrjo@microsoft.com>

* unitest for add, delete, get
added test for handling second add call in windows
added linux and windows specific tests
added multitenancy, baremetal tests
fixed linter errors

* fix linter issue

* fix nns test
added comment
linter fixes and dependency injection from top

* adding back removed file
fixed merge issues

* linter fixes

Co-authored-by: Evan Baker <rbtr@users.noreply.github.com>
Co-authored-by: JungukCho <jungukcho@microsoft.com>
Co-authored-by: Vamsi Kalapala <vakr@microsoft.com>
Co-authored-by: Mathew Merrick <matmerr@users.noreply.github.com>
Co-authored-by: Shriroop Joshi <shriroopjoshi@users.noreply.github.com>
Co-authored-by: Shriroop <shrjo@microsoft.com>
2021-09-20 16:58:18 -07:00
tamilmani1989 2bd3c74811
Netlink package interfacing and adding a fake (#996) (#1025)
* Initial pass at Netlink interface

* changing some netlink and epc

* Resolcing all dependencies on netlink package

* first pass at adding a netlinkinterface

* windows working now

* feat: update cns client (#992)

* fix debug commands

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

* fix: update cns client

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

* add ctx to debug calls

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

* repackage cns client

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

* add ctx to all methods and preinit all route urls

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

* down-scope cns client interface and move to consumer packages

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

* no unkeyed struct literals

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

* trace updated client method signatures out through windows paths

* delint

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

* fix windows build

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

* delint

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

* windows working now

* Some golints checks

* commenting a flaky NPM UT and adding some golint checks

* renaming fakenetlink to mocknetlink

* removing a mock netlink usage

* fixing more golints and a test fix

* fixing more go lints

* Adding in netlink from higher level as input

* adding netlinkinterface to windows endpoint impl

* removing netlink name confusion

Co-authored-by: Evan Baker <rbtr@users.noreply.github.com>

Co-authored-by: Vamsi Kalapala <vakr@microsoft.com>
Co-authored-by: Evan Baker <rbtr@users.noreply.github.com>
2021-09-20 13:57:12 -05:00
tamilmani1989 94d895ccc5
test: add tests for CNI Azure invoker (#1010) (#1023)
* include add tests

* test delete

* gci

Co-authored-by: Mathew Merrick <matmerr@users.noreply.github.com>
2021-09-20 13:52:30 -05:00
Evan Baker 69abf11d4c
feat: update cns client (#992)
* fix debug commands

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

* fix: update cns client

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

* add ctx to debug calls

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

* repackage cns client

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

* add ctx to all methods and preinit all route urls

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

* down-scope cns client interface and move to consumer packages

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

* no unkeyed struct literals

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

* trace updated client method signatures out through windows paths

* delint

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

* fix windows build

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

* delint

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2021-09-14 12:56:32 -05:00
Matthew Long 2e6a5f662d
[Swift] Add snat rule to host IP for IMDS for CNS IPAM (#988)
* add snat rule to host IP for IMDS

* add comment for rules
2021-09-03 12:37:44 -05: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 1087201b28
chore: appease the linter, pt 2 of ? (#925) 2021-09-01 18:28:17 -05:00
tamilmani1989 ed52a64c09
Remove lock for version command (#970)
* remove lock for version command.

* linter error fix

* sort imports

* addressed issues

* linter fix
2021-08-11 11:21:14 -07:00
Evan Baker 212105f260
chore: typed response codes (#954)
* chore: typed error response code
2021-08-06 14:19:21 -07:00
tamilmani1989 b63e52328c
disable cleaning up hns network and state files from windows cni (#879)
* disable cleaning up hns network and state files from windows cni

* fixed uts

* fixed ut

* remove the ut which is not needed anymore

* addressed comments

* updated same pattern for cnm

* added comments

* addressed comments
2021-07-21 09:37:48 -07:00
Evan Baker e4949a67ab
fix: return nil instead of earlier err when we complete exec (#942) 2021-07-17 15:20:36 -05:00
Mathew Merrick 9b24dbd95a
test: [NPM] Use fakeexec for ipsm and iptm tests (#868)
* iptmgr

* more iptm testing

* grep call

* progress

* progress

* ipsm

* ioshim

* update tests

* package restructure

* fix broken test and delint

* reduce scope of ioshim

* reduce scope of ioshim

* ioshim scope

* require no error, retrigger ci

* ut return multiple results

* fix tests from master changes

* unexport ioshim

* update ut

* fix tests

* vendor

* test fix

* go version

* go version

* pipeline fixes

* fix tests
2021-07-14 12:53:45 -07:00
tamilmani1989 a53c2f85bc
Revert "removed lock for version command (#929)" (#932)
This reverts commit 6079bf3868.
2021-07-14 12:16:01 -07:00
tamilmani1989 6079bf3868
removed lock for version command (#929)
* removed lock for version command

* updated variable name

* catch and return error on lock

* added log for release lock file

* separated out lock and store initialization

* addressed comments
2021-07-12 16:02:40 -07:00
Evan Baker 45f3668401
chore: appease the linter, pt 1 of ? (#922) 2021-07-08 13:30:59 -05:00
Mathew Merrick f2e763050d
fix: [CNI] handle getting endpoints when state file is empty (#916)
* handle empty state file

* update tests

* restore

* fix: add custom unmarshaller for struct with embedded custom interface type

* mkdir images

Co-authored-by: Evan Baker <rbtr@users.noreply.github.com>
2021-06-30 17:54:43 -07:00
Evan Baker 7d224bf3a6
feat: add flow to initialize CNS from CNI (#890)
* feat: add flow to initialize cns state from cni

* address review comments

* Rename the PodIp map

* fix test

* fix version check

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
Co-authored-by: neaggarw <neaggarw@microsoft.com>
2021-06-29 17:14:11 -05:00
Jaeryn 8acc37d6eb
Removing telemetry processed on HostNetAgent (#903)
Co-authored-by: Jaeryn <tsun.chu@microsoft.com>
2021-06-21 13:22:44 -07:00
Mathew Merrick ae9aedcfdf
[CNI] Parse CNI version in CNI client (#899)
* get CNI version

* update makefile to produce cni-manager image

* return proper type
2021-06-18 10:20:03 -07:00
Mathew Merrick b09ca83ef7
[CNI] Add GET_ENDPOINT_STATE command to dump CNI state to stdout (#891)
* inital dump state and ipam interface update

* add reconcile command to CNI

* add integration test

* pass endpoint id on add

* address some feedback

* fix test path and linting

* address feedback and logging

* remove return and rename to PodEndpointID
2021-06-11 14:01:42 -07:00
Mathew Merrick fda89d091a
[CNI] Update CNI to pass IP address on delete (#875)
* release with ip address

* CNI contract update

* update contract

* pass endpoint info to invoker delete

* update test

* fix merge artifacts
2021-06-02 00:20:19 -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
Mathew Merrick 8c424b245a
[CNI] Specify CNSClient HTTPClient timeout (#862)
* cnsclient timeout

* update request timeout
2021-05-05 17:01:23 -07:00
Mathew Merrick d929d1acb0
chore: Specify CI build pool name (#841)
* Specify pool name
2021-04-13 11:00:49 -07:00
msvik 28cf37bc9d
CNI changes to support baremetal scenario (#835)
* Modify CNI for windows baremetal scenario in Azure

* Fix the CNI result for baremetal case

* Addressed PR comments from Tamilmani and Ramiro

* Remove azure-telemetry.exe from cni-baremetal package

* Fix formatting in logging

* Addressed Ramiro's PR review comments

* Formatting fix in printf

Co-authored-by: VK <abc@gmail.com>
2021-03-26 10:28:42 -07:00
aegal 79fd586dda
pass adapter name to hns create network call (#813)
* pass adapter name to hns create network call

* add comments and log
2021-03-08 11:28:20 -08:00
Vamsi Kalapala 3775827917
[CNI] Bypassing POSTROUTING table for Swift POD traffic (#807)
* Bypassing POSTINGROUTING for Swift POD traffic

* Adding the comment to remove this rule after cleaning AGentBaker
2021-03-01 19:37:32 -08:00
tamilmani1989 98f838ef1b
Write to intermediate file before moving to state file (#755)
* 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
2021-01-07 17:43:33 -08:00
Mathew Merrick f0907b4e82
refactor: Move CNI bridge/transparent routes to common (#694)
* fix: pass host gateway to CNI with Swift to enable Swift+Transparent
2020-11-16 14:24:00 -08:00
vivekagg-MSFT 030992273f
Remove default ACLs (#724)
Remove default ACLs in CNI config
2020-11-09 10:35:19 -08:00
Adelina Tuvenie 01bbbe6fad
Use PortMappingPolicySetting (#689)
In order to support VIPs for container Port Mappings, we should
use PortMappingPolicySetting type from HNSv2 instead of the old
NatPolicy from HNSv1.
2020-11-09 10:33:27 -08:00
vivekagg-MSFT cc2aab5dea
Support for ACL (Hnsv2) (#705)
* initial changes

* remove extraneous code

* Add ACL and wireserver ACL

* add ACLs

* default acls

* address comments

* addressed comment
2020-11-04 16:35:45 -08:00
Vamsi Kalapala e0a532d983
Merge pull request #709 from Azure/vakr/tempbranch
Azure CNI transparent mode as default
2020-10-30 14:40:02 -07:00
Mathew Merrick a9c7d6e684
fix: Add missing CNI invoker delete calls (#696)
* fix missing invoker delete calls

* pipeline debug

* fix nil on delete

* another nil check
2020-10-29 18:03:44 -07:00
vakr cb2ff9c86c typo fix 2020-10-29 10:36:52 -07:00
Mathew Merrick 3eb5f3cb1f
feat: produce Azure CNI Swift tarball (#711) 2020-10-29 10:32:21 -07:00
vakr 2c1a141021 typo fix 2020-10-29 08:54:32 -07:00
vakr ac1e600b5e adding transparent mode default 2020-10-27 13:49:36 -07:00
Mathew Merrick 223b5ba0bf
fix: Pass host gateway to CNI in swift mode (#695)
* fix: pass host gateway to cni in swift mode

* hostgwkey

* update comments
2020-10-21 10:56:54 -07:00
Mathew Merrick 7bd8a2644d
Add "acn" cli tool to install and manage Azure CNI (#688)
* tail azure-vnet.logs

* dockerfile update

* installer fixes

* remove external deps

* move to cli design

* manager cmd

* update vendor

* minor fixes

* logs

* update makefile

* Update manager-master.yaml

* Update manager-agent.yaml
2020-10-20 14:00:40 -07:00
vivekagg-MSFT eba4207c0a
Throw CNI error - On CNI DEL call, if communication with CNS cannot be established. (#683)
CNI is some cases is unable to talk to CNS. This can happen, CNS crashing or race between start/CNI getting invoked.

Currently if this communication errrs out on DEL calls, CNI will silently ignore the error. Container runtime assumes everything went fine and deletes the container. But the HNS endpoints are still there on the host result into them being orphaned. If a container with similar configuration is placed on the host , then ADD call will fail with object already exists error.

Please note, CNI DEL are supposed to be idempotent, and should generally handle the resource not found/exist error elegantely without any error.
2020-10-15 07:56:29 -07:00
vivekagg-MSFT fa9bc99433
disable vnet ipam for multitenancy (#684) 2020-10-01 15:50:31 -07:00
vivekagg-MSFT 8bc07daad2
Keep the behavior on Windows same as before' (#681) 2020-10-01 12:35:20 -07:00
Mathew Merrick 41232c134d
CNI using CNS IPAM (#597)
* Configure CNI to use CNS IPAM
2020-09-29 14:43:19 -07:00
vivekagg-MSFT 67124b86bd
Add logging to record CNI_COMMAND value (#676)
* Add logging to record CNI_COMMAND value

* Addressed commands
2020-09-21 14:37:02 -07:00
aegal d8e57328c1
Merge pull request #640 from Azure/ipamLeakFix
ipam pool leak fix
2020-09-01 16:10:08 -07:00
Ali Egal 90401b7a4d addressing a couple other comments 2020-08-31 13:18:27 -07:00
Ali Egal 9049eaa10b back from vacation, addressing some comments 2020-08-31 10:18:25 -07:00
Ali Egal 0b8fd29154 clean up test file 2020-08-20 12:07:52 -07:00
Ali Egal 72b6f4edbb adding couple more changes 2020-08-15 14:54:41 -07:00
Ali Egal 7448bac52d revert IPAM.go file 2020-08-10 17:10:42 -07:00
tamilmani1989 75fae82f9d
CNI not to rehydrate based on reboot time (#643)
* cni to not consider reboot time and rehydrate

* added missing files

* fixed ut
2020-08-10 16:59:18 -07:00
Ali Egal fc0a15f033 capture error on rerequesting address 2020-08-04 22:32:18 -07:00
Ali Egal faa0f584b3 ipam leak fix 2020-08-04 21:58:45 -07:00
Jaeryn 9d6b6c9194
Fix NATing on *COW (HnsV2) Scenarios (#596)
* For HnsV2 we will only add outbound nat policy for single tenant scenario or if enableSnatForDns is true.

* adding comments to detail results of determineSnat func

Co-authored-by: Jaeryn <tsun.chu@microsoft.com>
2020-07-15 16:14:34 -07:00
Mathew Merrick 644642b100
CNS IPAM for CNI (#584)
* Add IPAM to CNS for CNI
2020-07-13 17:37:49 -07:00
PrIce Qian 7b5e817bd8
Improving and adding CNI unit tests (#543)
* Add ipam/pool_test.go & add network/*test.go

* add testing ./network/ in Makefile

* fix context
2020-06-26 14:16:45 -07:00
tamilmani1989 ecc23697ad
enable hairpin by default (#568) 2020-05-26 16:45:54 -07:00
Paul Johnston 11f2d74a7c
Removing execution time metric (#566) 2020-05-20 17:10:49 -07:00
tamilmani1989 aed0d716b9
Azure CNI Windows dualstack support (#557)
* windows ipv6 changes

* addressed compilation issues

* return fix

* type error

* updated pipeline.yaml

* removed -mod=vendor

* updated pipeline yaml

* fixed pipeline.yaml

* fixed pipeline.yaml

* updated function name as per comment
2020-05-07 11:40:46 -07:00
Paul Johnston 6e1827d83d
Fix cni logs (#548)
* 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
2020-04-30 11:21:45 -07:00
tamilmani1989 6ac5e8c9f0
CNI Ipv6 Dualstack Support (#538)
* added cniv6 plugin

* cni ipv6 base framework

* removed unwanted changes

* added ipv6 change

* added cni ipv6 changes

* drop neighbor discovery messages to other VMs

* fixed issues

* fixed unit tests

* fix nil dereference

* addressed comments

* ipv6 fixes and changes

* addressed comments
2020-04-15 22:30:48 -07:00
PrIce Qian 512ffed5ef
Add IPAM unit tests && Using ginkgo replace the origin go test (#508)
* 1. Add IPAM unit tests
2. Using ginkgo instead of the origin go test

* fix go mod
2020-04-09 01:10:24 -07:00
Paul Johnston 1d737cf564
Added DisableHairpinOnHostInterface:true to conflist to fix duplicate packets issue (#530) 2020-03-18 13:58:09 -07:00
shchen 2ecca215be
Fix unnecessary consecutiveAdd for windows (#509)
* Fix unnecessary consecutiveAdd for windows(#367).

* Fix unnecessary consecutiveAdd for windows(#367).

* Fix unnecessary consecutiveAdd for windows(#367).

* Fix unnecessary consecutiveAdd for windows(#367).
2020-02-26 11:03:12 -08:00
Paul Johnston a01afb7a93
Added EB rule for ip addresses in conflist for linux (#505)
* Added EB rule for ip addresses in conflist for linux

* Made methods more generic and removed line from endpoint struct

* Adding log statement

* Fixed syntax error

* Made review2 changes

* Made review3 changes

* Made method lowercase
2020-02-21 14:35:37 -08:00
Sathya Singh 2d5708c4a0
Fix ACN issue 436 for surfacing CNI errors to kubelet. (#501) 2020-02-12 17:17:30 -08:00
Ashvin Deodhar ca00635a6b
Fix CNS regression (#489)
log.SetTarget creates the log file under log directory using golang os package. Whenever code sets the log directory, it needed to call SetTarget to create the actual log file under that directory. In the recent logger changes, InitLogger by default set the log directory to the current folder. This created the log file in the current folder. The code then set the log directory to a different location without a subsequent call to log.SetTarget. This resulted into the logger to not find the actual log file in the set log directory.

This fix updates the logger InitLogger function to accept the log directory to create the file in correct log directory. To avoid having such issue, this fix also combines the function calls to set log directory and set target into a single function. This prevents any out of order calls resulting into such issue.
2020-01-30 09:33:35 -08:00
Vipul Hattiwale 19ac791afc Option to not enable hairpin on the host interface. (#472) 2020-01-16 14:27:25 -08:00
tamilmani1989 2d619b78fe
AppInsightTelemetry support for CNI (#458)
* 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
2020-01-14 14:53:24 -08:00
tamilmani1989 5fb1d7f713
Added config option for disabling iptable lock (#470)
* added config option for disabling iptable lock

* added log for iptable and ebtable version

* moved logging dependency package details to platform specific file
2020-01-03 17:08:14 -08:00
Ashvin Deodhar 71e71d5119
Add enableExactMatchForPodName flag in windows multitenancy config (#459)
enableExactMatchForPodName flag is missing in the multitenancy config
for windows. This changes adds this missing flag in the config.
Default set to true
2019-12-17 17:00:56 -08:00
tamilmani1989 6730d265b5
fixed compilation issue (#453) 2019-12-05 12:46:09 -08:00
tamilmani1989 6ca873ce05
Remove Orphan lock file (#445)
* added removeorphanlockfile function

* remove lock file if process holding that exited

* addressed comments

* addressed comments and added a condition to check get process cmd is supported

* Addressed comments
fixed trim line ending

* updated log
2019-12-03 17:15:45 -08:00
tamilmani1989 534e646fd9
Fix for http client call to wireserver (#431)
* modified wireserver call to non-blocking. Fixed logging issue in ipam

* fixed ut

* addressing review comments

* used inithttpclient function
2019-11-25 17:07:50 -08:00
jaer-tsun 43d2c684d1
Setup SNAT Configuration Based on Azure Host Support (#401)
* Save enable snat on host settings after querying NMagent version

* Adding changes to exclude outbound snat for win cni if new NMAgent is running

* try to acquire lock file when writing to disableSnatOnHost.json

* addressed some of Tamilmani's comments

* Adding snat for DNS if current NMAgent does not support it yet

* Adding DNS NAT changes for Windows CNI

* vendoring HCSShim changes that support destination based SNATing

* Reverting k8s.io/api dependencies from master branch to last working version

* Addressing Tamilmani's comments

* syncing with an older version of k8s.io dependencies

* verify valid windows version before Dns NAT.

* only remove snat on windows when host has full support

* addressing Tamilmani's comments

* addressing Tamilmani's comments

* rebased and re-depped
2019-11-14 12:01:04 -08:00
Mathew Merrick 2c0ae6d723 Allow egress all and ingress all without target set (#435)
* allow all egress and ingress without drop

* remove comment breaks

* update test

* remove sleep and socket cleanup

* address feedback

* all namespaces

* fix tests

* update npm test

* aks-engine

* aks-engine

* pipeline

* pipeline

* pipeline

* pipeline

* remove comment breaks

* remove comment breaks

* remove comment breaks

* remove comment breaks

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline

* pipeline
2019-11-14 11:11:11 -08:00
Ashvin Deodhar 84fb35b545
Add Host NC communication support in Windows with HnsV2 (#424)
This PR adds support for host NC bidirectional communication with windows HnsV2. This is supported in multitenant scenario only. AllowHostToNCCommunication and AllowNCToHostCommunication flags are used to enable Host to NC and NC to host communication respectively.
2019-10-18 13:12:03 -07:00
Ashvin Deodhar edd2ae7c8b
Support hyper-v and process based containers with cricontainerd (*COW) (#417)
Support hyper-v and process based containers with cricontainerd (*COW)
2019-10-18 06:58:27 -07:00
tamilmani1989 b027258240
Enable IP forwarding for Linux mulititenancy (#386)
* Enable ipforwarding, prevent ip spoofing and other security concern

* added ovssnat test to circleci

* fixed compiler error

* updated circleci image

* fixed circleci yaml

* updated circleci image

* fixed UT

* fixed UTs

* addressed review comments

* added comments

* addressed review comments

* fixed UT

* separating PRs - removing ip spoofing check changes

* added document for describing multitenancy fields

* fixed docs/cnimultitenancy.md

* removed a condition as it seems to be not working
2019-08-20 14:06:36 -07:00
tamilmani1989 59969fec20
Fix for CNI lock timedout issue. (#382)
* Fix for CNI lock timedout issue.

* removed duplicate log

* addressed review comments
2019-07-31 11:40:51 -07:00
Ashvin Deodhar 22f945d82e
Fix bug for returned error from CNI (#377)
* Return correct error for ADD and DEL

* Update code for GET and UPDATE

* Fix compilation error

* Declare all vars in one place
2019-07-22 10:42:36 -07:00
Yongli Chen d1d8d95ace
update base image to ubuntu:19.10 (#378) 2019-07-19 15:41:07 -07:00
tamilmani1989 edabc6dd39
Added Host NC communication support in Linux (#374)
* allow inbound connection to container from host if the feature is enabled

* Allowinbound from host to NC if flag is enabled

* fixed old changes

* minor fixes

* added NC to host commn support

* added NCToHostCommunication field in cns contract

* addressed review comments

* addressed review comments

* addressed review comments

* address comments

* fixed space damage
2019-07-16 17:09:34 -07:00
Yongli Chen f6bff8e3af
change telemetry to message queue and add npm (#366)
* 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
2019-06-19 14:08:35 -07:00
Ashvin Deodhar 4df8d64a34
Delete container even if NetNs is not specified (#357) 2019-06-13 17:19:49 -07:00
jaer-tsun 78bf592cd7 Updating ACN vendor. (#353)
* Updating ACN vendor.

* Adding Gopkg.lock

* Also required to update CNI API to include context
2019-05-07 13:19:11 -07:00
jaer-tsun 9a48bc73c2
Divide hns network (#347)
* Renaming HnsNetwork based on subnet and prefix.

* Addressing Ashvin's comments.
2019-04-29 14:42:33 -07:00
Ashvin Deodhar e28f5836d0
Skip HotAttachEp from CNM createEndpoint (#332)
* Skip HotAttachEp from CNM create endpoint

* Address review comments
2019-04-12 16:17:45 -07:00
jaer-tsun 4a595724e1
Fix Attach/Detach NC from Network Calls (#309)
* Pass CNS server url when invoking CNI during add/del call in windows and update call in linux.

* Addressing Tamilmani's comments.

* Forgot to fix linux side of networkcontainers_linux.go

* Enabling exact match for pod name in attach/detach containertonetwork APIs.

* Returning the correct error when invoking Cni.

* Checking if orchestrator is Batch for attach/detach network calls.

* Moving similar lines for NewNetPluginConfiguration into a single function.

* Removing CNI configuration manipulation in CNS.

* Addressing Tamilmani's comments.

* Addressing Vivek's comments.

* Addressing Tamilmani's comments.

* Addressing Vivek's comment.

* Addressing Tamilmani's comments.
2019-04-08 16:41:33 -07:00
jaer-tsun 12acd3d177
Cutting out Routes and DNS from EventMessage because it is cause HostNetAgent crash. (#325) 2019-04-08 16:40:14 -07:00
jaer-tsun 3043dc9736
CNS to start telemetry process and connect to it (#324)
* Spawn telemetry buffer in a separate process instead of goroutine.

* Adding an option to disable telemetry.

* Addressing some of Tamilmani's comments.
2019-04-08 16:20:05 -07:00
tamilmani1989 a11d5104a0
Config support for Telemetry service (#317)
* 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
2019-03-25 14:12:32 -07:00
tamilmani1989 83945fd6bf
fixed logging part of telemetry (#312)
* 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
2019-03-13 14:01:30 -07:00
Michelle Cone 3ddb72cdbe Add dns capabilities to allow for custom dns in Windows (#305)
* Add dns capabilities to allow for custom dns in Windows

Co-authored-by: James Sturtevant <jstur@microsoft.com>

* Move customDNS logic for Windows into network_windows.go and update link for RuntimeDNSConfig

Co-authored-by: James Sturtevant <jstur@microsoft.com>

* Concatenate the elements of DNS.Searches
2019-03-04 13:01:56 -08:00
tamilmani1989 4be2f9288a
Close telemetry socket when its done (#302)
* 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
2019-02-28 11:32:40 -08:00
jaer-tsun 67debca901
Add ability in CNS to setup networking for a docker container (#298)
* Limiting the size of our buffered payload to ~2MB

* CNI Update operation support

* Adding APIs for attach/detach network container to/from network.

* Updating new apis.

* Addressing Tamilmani's review/comments.

* Renaming Batch APIs and Request members for better clarity.

* Adding check for pluginsSection length before accessing element.

* Renaming ConfigureNetworkContainerNetworkingRequest to ConfigureContainerNetworkRequest.

* Adding default k8s cni paths for windows.

* Adding AzureFirstParty orchestrator type and Basic container type.

* Addressing Sushant's comments.
2019-02-26 16:04:27 -08:00
jaer-tsun e5f6b0d03c
Update host machine ip (#300)
* Limiting the size of our buffered payload to ~2MB

* Changing IPs for calls to host machines from 169.254.169.254 to 168.63.129.16.
2019-02-26 16:03:29 -08:00
Tamilmani Manoharan f7033499bc modified uptime format 2019-02-14 12:41:31 -08:00
Tamilmani Manoharan 13ebac4f83 added vlanid as part of report log 2019-02-06 17:25:17 -08:00
Tamilmani Manoharan 7eb2391ff2 addressed review comments and added separate logger for telemetry service 2019-02-06 17:05:01 -08:00
Tamilmani Manoharan 5408d262a8 moved optype down if statement 2019-02-05 16:40:10 -08:00
Tamilmani Manoharan bff9bed007 addressed review comments and modified unit tests 2019-02-05 15:14:44 -08:00
Tamilmani Manoharan 4055fa9f51 Added support for CNI telmetry report to mds 2019-02-01 16:24:45 -08:00
Tamilmani Manoharan fdf044195d time format change 2019-01-24 16:40:12 -08:00
Tamilmani Manoharan d04d6bd9ed added new fields for telemetry 2019-01-23 17:10:29 -08:00
Tamilmani Manoharan 63a4d0f469 temp changes 2019-01-22 17:07:32 -08:00
Tamilmani Manoharan 0ac1ea6f92 telemetry changes 2019-01-14 15:04:17 -08:00
tamilmani1989 69fde1c342 changed vethnaming logic for transparent mode (#286) 2019-01-09 18:29:22 -08:00
Ashvin Deodhar e98936c622 Cleanup old networks and lock files after detecting reboot (#285) 2019-01-07 17:04:39 -08:00
tamilmani1989 b7f6742b7f CNI to support transparent mode (#279)
* added changes in azure cni to support transparent mode

* cni for calico policy controller

* removed unused parameter

* minor fix

* addressed review comments

* addressed review comments

* modified vethname generation and the hostbveth prefix

* removed setting arp for default gw

* minor fix
2019-01-04 16:19:36 -08:00
Ashvin Deodhar 3f1216ef26 Fix Endpoint policy regression (#268)
Fix endpoint policy regression
2018-11-20 10:51:18 -08:00
Ashvin Deodhar bfb3eaafa7 Implement multitenancy for windows (#259)
* Implement multitenancy for windows
2018-10-31 14:34:04 -07:00
Sushant Sharma 6e6260afe5 Implement CNI update for Azure CNI (#265)
* Implement CNI Update for Azure CNI (#21)
2018-10-29 11:10:27 -07:00
erfrimod ceac7912ac Adding PortMapping support to Azure cni for Windows (#256) 2018-10-15 11:30:17 -07:00
Yongli Chen 530d13adf2 Remove HNSNetwork's DNS suffix in Windows (#254)
* remove network dns suffix and preserve endpoint dns suffix
2018-10-10 15:30:05 -07:00
John Howard a386846345 Store fixes; Windows compile
Signed-off-by: John Howard <jhoward@microsoft.com>

- First, the store timeout is woefully low. Bumped to 20 seconds from 2 seconds.
  This may fix https://github.com/Azure/azure-container-networking/issues/242#issuecomment-422701838
  IMO, as only test code calls it non-blocked, why even have a block parameter to Lock()?
  IMO also, why a timeout at all? They're always fraught with error and machine timing.

- Presence of a key should be checked using `raw, ok := hvs.data[key]`, not the current nil checked

- ErrKeyNotFound should be returned if the store file does not exist. It shouldn't ignore that error.

- Actually now reports if a timeout occurred correctly, along with non-block lock attempt when already locked.

- Serial pattern abuse in not always closing the lock file.

- Some golang correctness (errors should be lower case)

- go build ./... actually passes on Windows now - various compile errors previously.

- golang pattern conformance `if err:=<test>; err!=nil {....`

- Simplified timeout duration (no need for time.Duration(...))
2018-09-19 15:30:36 -07:00
tamilmani1989 f656f44ea2 Block apipa address (#238)
* block apipa address and remove reading dns from dnc. Added config for passing dns

* modified iptable rule to allow dns server to top of chain
2018-08-20 15:53:37 -07:00
tamilmani1989 9a9c2cd8d4 Added support for InfraVnet connectivity in multitenancy CNI (#234)
* Added infravnet connectivity support for multitenancy CNI
2018-08-18 14:50:49 -07:00
jaer-tsun d28b594619
Moving dnc specific material out. (#233) 2018-08-16 16:28:46 -07:00
jaer-tsun 45914be23d
Adding telemetry report functions for DNC. (#216)
* Adding telemetry report functions for DNC.

* Addressing Yongli's suggestions.

* commit to switch branches

* Adding some changes to npm due to telemetry change.

* Modifying tests for interface reports...
2018-08-16 14:12:58 -07:00
Sushant Sharma 6c826a7d19 Use CNI spec to create interface name for container interfaces 2018-08-13 16:15:06 -07:00
tamilmani1989 3ea96edae3 Update Windows CNI implementation to free resources in case of HNS failures (#223)
Update Windows CNI implementation to free resources in case of HNS failures
2018-08-09 16:54:10 -07:00
tamilmani1989 d0d9a4f934 Fix for unparseable error returned by Azure CNI (#212)
* Write result to stdout only in successful case
2018-08-08 12:40:39 -07:00
Yongli Chen 1c14dd0ad3
make archive for npm (#200) 2018-07-19 16:06:11 -07:00
Yongli Chen 6a0f9ff207
Add Azure-npm to provide k8s network policy support (#173)
* address comments

* make azure-npm versiona consistent with main version

* Npm telemetry (#12)

* azure-npm

* set logging file

* parameterize telemetry API

* avoid null ptr derefence

* add telemetry to npm

* address comments

* add descriptive comments

* add copyright info

* returns on err
2018-07-19 14:23:11 -07:00
tamilmani1989 9f93ec63f3 added windows multitenancy conflist (#192) 2018-07-06 17:12:30 -07:00
tamilmani1989 147c4388c8 Multitenancy Support for Linux (#156)
This PR adds the following capabilities
1. Support to create and connect containers to different Azure Vnets. Every VlanId corresponds to a different Azure Vnet.
2. SNAT support for containers to reach Internet using the container's host IP as the SNAT address.

Both the above options are controlled by the config parameters in Azure CNI.
2018-07-06 11:45:47 -07:00
tamilmani1989 ec415fd08b Fixed initializing store in ipam (#188)
* fixed initializing store in ipam
2018-07-05 15:27:24 -07:00
Madhan Raj Mookkandy d590c97e12 Fix to use latest cni for building (#182) 2018-07-05 15:22:24 -07:00
Madhan Raj Mookkandy 1f436d3af9 Fix error message to include endpoint, container id (#183) 2018-07-02 14:20:56 -07:00
tamilmani1989 f09a7132a1 Fixed the github acsengine issue #176 (#177) 2018-06-26 12:01:44 -07:00
ashvindeodhar 187609860a Fill in the plugin version in -about- string (#165) 2018-06-05 12:25:41 -07:00
ashvindeodhar 54be5fed60 azure-vnet: Implement GET command as per CNI 0.4.0 spec (#161)
* azure-vnet: Implement GET command
2018-06-01 17:48:19 -07:00
Yongli Chen 8e4cd96ecb make kube-dns main dns server (#153) 2018-05-29 16:24:11 -07:00
Yongli Chen 7f41e3dca5 add k8s pod namespace to dns suffix (#152) 2018-05-25 15:53:53 -07:00
tamilmani1989 41ecaedb0d Generate VethName based on podname and namespace in CNI (#143)
* Generate vethname based on podname and namespace
2018-05-16 17:02:09 -07:00
Yongli Chen f0f090e525
This PR moves cni related code from network package to cni. (#131)
* configure dnssuffix & dnsServerList

* add dns info to conflist

* change case for dns info

* remove hardcoding

* remove hardcoding

* parse k8s pod info

* add AdditionalArgs and Dns info to conflist

* serialize policies

* program route info

* start addressign ipam ip leak

* fix 1) ip inconsistency in k8s & pod. 2) IP leak in IPAM.

* remove comments

* separate windows & linux

* remove dnsServers

* remove comments

* address comments

* add dns verification

* abstract linux policy struct

* remove setPolicies

* separte Windows & Linux code

* change package

* add policy structure to Linux

* move policy code to policy.go

* fix network_linux func signature

* restructure policy pkg
2018-05-03 19:02:53 -07:00