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

47 Коммитов

Автор SHA1 Сообщение Дата
Alexander 3e161f00bf
chore: remove cnm code (#2906)
* remove cnm code

* remove cnm refs in docs, comments, cns args, and makefile

* remove cns ipamclient as it uses cnm

* remove cns ipam client consts
2024-08-24 02:45:06 +00:00
msvik 6c50d0dcdd
feat: Add CNS API to retrieve VMUniqueID from IMDS (#2842)
* Add CNS API to retrieve VMUniqueID from IMDS

* Address the PR review comments

* Address the security comment from Evans to expose this API wherever needed

* fixed the linter error

* address the PR comments from Matt

* lowercase the struct json fields
2024-07-18 21:32:02 +00:00
Kshitija Murudi b9b8627220
Add swiftv2 middleware support for standalone service fabric scenario (windows) (#2634)
* feature: add sfswiftv2 middleware support for standalone service fabric swiftv2 windows path

* feat: add switch case for middlewaretype

* review: address comments

* pkg: move swiftv2mode for cnsconfig from configuration to cns package to avoid import-cycle

* address review comment

* linter: context check, wrap error

* linter: fix errors wrap return static err

* review: address comments:

* refactor: keep old variable enableswiftv2, initialization pattern

* address pr comments

* rename the middleware to standaloneswiftv2middleware

* remove HostSecondaryIPInfo from podIpInfo

* address review comments-1

* address review comments-2

* Update cns/service/main.go

Co-authored-by: tamilmani1989 <tamanoha@microsoft.com>
Signed-off-by: Kshitija Murudi <kmurudi@microsoft.com>

* fix an linter issue

* rename the IPConfigRequest func

* fix a comment linter issue

* fix a comment linter issue

* remove checking hnsTransparent network mdoe

* remove orchestrator checker

---------

Signed-off-by: Kshitija Murudi <kmurudi@microsoft.com>
Co-authored-by: tamilmani1989 <tamanoha@microsoft.com>
Co-authored-by: Paul Yu <129891899+paulyufan2@users.noreply.github.com>
Co-authored-by: paulyufan2 <paulyu01@outlook.com>
2024-07-10 00:07:14 +00:00
Behzad Mirkhanzadeh 008dadc990
feat: Modifying stateless CNI state to account for swift 2.0 changes. (#2523)
* Modyfying stateless CNI state to account for swift 2.0 changes

* Removing SecondaryNICInfor fro EPInfo.

* removing SecondaryNic from the epInfo.

* Make change to UpdateEndpointState API to support SwiftV2 for Stateless CNI

* updating Makefile to include azure CNI binary.
2024-04-25 19:39:01 +00:00
Kshitija Murudi d8de157af7
Revert "Enable CNS swiftv2 path for SF/Standalone scenario to program secondary nics" (#2608)
* Revert "Enable CNS swiftv2 path for SF/Standalone scenario to program seconda…"

This reverts commit bc218edb4e.

* fix linter errors-1

* fix linter errors-2

* fix linter errors-3

* fix linter errors-4

* address comment, add todo
2024-03-04 07:30:26 +00:00
Kshitija Murudi bc218edb4e
Enable CNS swiftv2 path for SF/Standalone scenario to program secondary nics (#2444)
* changes for adding swiftv2 SF config

* refactor: getSecondaryInterfaceInfo

* checks for sf orch

* Add hnsclient new mode & NCID in PodIpInfo

* undoing cni part changes

* undoing cni part changes

* fix: reordering code

* fix: golint errors

* fix: add new macaddressEqualCheck func

* feat: adding swiftv2-SF middleware, refactor

* review: address comments

* review: address comments-2

* feat: change middleware initialization at right cns channel mode

* test:UTs to validate IP configs request, refactor cnsclient import, api.go new packages, remove cnsclient dependency on restserver package

* fix: updatepodinfowithinterfaces & linters fix

* fix: linter errors

* fix: linter errors context check & govet

* removed validateIpConfigs, removed failureHandler, removed swiftv2sf_test file, removed addInterfaces config field

* test: move out UTs to restserver package, avoid import cycle

* test: modify tests

* test: fix constant values used in UT

* test: fix linter errors

* remove enableswiftv2, add new field in podipinfo, remove ipconfigsrequest passed as a pointer

* fix: address comment

* fix: remove enableswiftv2, replace by swiftv2mode

---------

Signed-off-by: Kshitija Murudi <kmurudi@microsoft.com>
2024-02-09 21:14:34 +00:00
Evan Baker 51d7c5cc68
feat: v2 swift ipampool (#2422)
feat: v2 ipampool with idempotent scaling math
2024-01-26 19:01:55 +00:00
Quang Nguyen 25996f7f6b
refactor: SWIFT v2 Middlewares (#2390)
* refractor: swift v2 middleware

* revert: unexport getTestService

* fix: linter

* fix: linter issue

* refactor: generic renaming of middlewares-related code in cns

* refactor: change type of swiftv2middleware

* address feedbacks

* rename for clarity

* missed some renaming

* renaming

* addressed comments

* add UT for no-op releasing ip config for v2 pod even if its mtpnc is not ready

* pass in SWIFTv2Mode as string

* typed SWIFTV2Mode
2024-01-18 21:30:29 +00:00
Behzad Mirkhanzadeh c4fe3a8fa7
feat: Dev stateless cni (#2276)
* 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>
2023-12-12 00:15:54 +00:00
Quang Nguyen d34c61f940
feat: CNS RequestIPAddress branching for MT/V2 (#2300)
* fix overlay IPAM not reporting version

* revert file and var naming, add correct path to makefile

* proposal design for multitenant IPAM flow

* change podipinfo + linter issue

* pointer issues for printf

* update IPAM branching

* remove comments

* pod client placeholder

* address lint issue for httpservicefake

* getting pod info in validator

* linter issue

* update network container contract

* renaming

* mtpnc changes

* rebase

* revert file and var naming, add correct path to makefile

* add default route

* add unit tests

* update unit tests for ipam

* go get to fix linter

* go mod tidy

* update routes

* update routes

* remove stale comments + remove redundant method

* add contexts + change address type

* addressed review

* embedded client to mock + enum for address type

* fix error

* change addressType to NICType

* change isDefaultRoute to SkipDefaultRoutes

* address comments

* refractor: make changes according to cni/cns contract

* refractor: make adding route its own func + move swift v2 ipam branching to after normal ipam flow

* refractor: change vars naming

* refractor: more var naming

* test: add test for podv6cidr

* refractor: make the returning podIpInfo init cleaner in swiftv2.go

* refractor + tests: add contexts to ipconfigs req validators + set route tests

* refractor: change labels for swift v2 pods

* fix: fix swift v2 UT

* refractor: add v4/v6 distinction for service cidr

* rebase

* revert file and var naming, add correct path to makefile

* rebase

* revert file and var naming, add correct path to makefile

* change podipinfo + linter issue

* update IPAM branching

* pod client placeholder

* getting pod info in validator

* linter issue

* rebase

* revert file and var naming, add correct path to makefile

* refractor: fix conflicts

* refractor: revert podwatcher code changes

* docs: change comment

* refractor: change CIDR to CDIRs

* refractor: parse CIDRs as semicolons separated string from env in SetRoutes

* docs: add minor comment

* refractor: change separator for parsing CIDRs

* feat: add rbac roles

* fix: gofumpt

* fix: update clusterrole

* fix: add namespace to clusterrolebinding

* fix: UT

* fix: add labels toswift v2 clusterrole

* fix: release default ipconfig early if getting swiftv2 ipconfig failed

* test: add more UT

* fix: parsing MTPNC as CIDR instead

* fix: toggle skipDefaultRoutes for infraNic to true

* fix: add route for node cidr in ipv4 podipconfig

* feat: add node cidrs route

* fix: linter

* address comments

* fix: minor logs formatting

* feat: move cns yaml for swiftv2 scenario to a diff file + more logging for swiftv2middleware

* fix: log debugf to printf

* fix: add testmain to avoid nil pointer error for loggers

* Update azure-cns.yaml

Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>

* fix: move parseCIDRs to a common package, use net/netip instead of net

* fix: exhaustive all switch case for nic type

* fix: exhaustive all switch case for nic type

* refractor: change fmt.Errorf to errors.Wrapf

* fix: add mtpnc status check in validator + use netip package

* fix: minor

* revert: azure-cns.yaml

---------

Signed-off-by: Quang Nguyen <nddangquang@gmail.com>
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
2023-10-31 13:44:59 -04:00
Evan Baker 6fd545a5e6
fix: implement String for logging of PodInfo and IPConfig (#2020)
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2023-06-19 11:55:47 -05:00
ZetaoZhuang e6eadd3379
feat: expose getHomeAzInfo api in cns to retrieve node home az infos from NMAgent (#1642) 2022-12-08 08:23:41 -08:00
Evan Baker 3d5660cf14
create nnc listener concept and adapt existing poolmonitor and swift service to it (#1323)
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2022-04-11 19:34:18 -05:00
Evan Baker 9fff334a19
feat: shim in metric for ipconfigstatus state transition durations (#1080)
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2021-12-06 18:32:51 -06:00
Evan Baker a8ba90e608
Update IPAM pool monitor's pool state logic and language (#1126)
* move and rename ipstate and change allocated to assigned

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

typo

* build ip pool state and populate struct pre-reconcile

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

* upcast to int64 and move scaler fields to metastate

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

* delint

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

* fix tests

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

* upcast usage of int to int64 in monitor fake tests

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

* update remaining usages of allocate to assign

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2021-12-01 18:02:27 -06: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 642028dabc
chore: remove rename from nnc/v1alpha import (#980) 2021-08-25 11:57:14 -05:00
Evan Baker a94dee97d7
typed State and lazy reusable filters (#978)
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
2021-08-23 12:29:45 -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 212105f260
chore: typed response codes (#954)
* chore: typed error response code
2021-08-06 14:19:21 -07: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
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
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
Kshitija Murudi 199980cb42 CNS_Fixing debug API
The GetIPAddressesMatchingStates now returns IPConfigurationStatus
 type, which also includes PodInfo along with IP address and state
fix : minor formatting
2021-03-02 09:14:27 -08:00
neaggarwMS c5f7dcd81a
Cns fixipampoolmonitor errorhandling (#806)
* temp changes

* Fixed error handling in IPAMPoolMonitor

* incorporate feedback

* Fixed the String() implementation for struct

* Fixed error message

* Fixed logging

* Fixed regressions
2021-03-01 18:38:52 -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
Vamsi Kalapala 52b030f41d
Merge branch 'master' into vakr/cns_lb_mnat 2020-11-11 16:43:58 -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
vakr 9921109e02 Adding greKey allocation support for mNAT and LB 2020-09-28 15:09:05 -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
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
Vivek Aggarwal 6dbe872067 adding missed file 2019-07-23 14:56:55 -07:00
Vivek Aggarwal f3708f5b17 adding missed file 2019-07-23 14:56:12 -07:00
Vivek Aggarwal 9f3c1f35de Addressed feedback 2019-07-23 14:22:47 -07:00
Vivek Aggarwal e7bc1ea912 Exposed a new API to get number of CPU COres 2019-07-22 19:39:24 -07:00
Ashvin Deodhar 99833b00a3
Create functions for service network state (#336)
Create get, set and remove functions for service network state
operations. This acquires the service lock inside the functions.
2019-04-15 15:59:53 -07:00
Ashvin Deodhar 2dbc856ca1
Add option in CNS to pre-provision hns network (#323)
* Add option in CNS to pre-provision hns network

Add a commandline option in CNS to pre-provision hns network.
The commandline option take the type of the network that needs
pre-provisioning. This allows orchestrators to start CNS with this
option so that the VM network blip / disconnect is avoided when
calling cni add the very first time.
2019-04-15 13:10:23 -07:00
jaer-tsun 0bb2d2cbeb Renaming and modifying NetworkContainerOrchestratorInfo (#112)
* Rename NetworkContainerOrchestratorInfo -> OrchestratorInfo and modify its structure and content.

* Split api into api and dnccontract.
2018-04-03 12:12:34 -07:00
Jaeryn 5556667406 Changed Podname -> PodName 2018-04-02 14:09:18 -07:00
Jaeryn f8527d22f3 Adding NetworkContainerOrchestratorInfo field to CreateNetworkContainerRequest. 2018-04-02 13:09:19 -07:00
Sushant Sharma c69ab4e8e4
Add APIs in CNS to support multitenancy (#106)
* APIs to support multitenancy in Azure. 

* Add support to create, update, and delete network containers (adapters) in windows hosts

* Add API to query host for programmed version of a container

* Add API to retrieve interface given a container ID

* Add support for custom log directory.
2018-03-28 15:03:58 -07:00
Tamilmani Manoharan 405f9f471e Started azure vnet and ipam as part of CNS and enabled outbound connectivity for containers by default 2017-09-18 13:43:02 -07:00
Sushant Sharma 0264723b05 CNS - Container Network Service (#64)
* Creates container network service (CNS): A service that exposes a set of REST API calls to support/manage networking for containers in Windows and Linux hosts. It currently requires docker daemon to be running on the node, as well as azure-vnet plugins for IPAM and Network.

Supported Scenarios: Windows/Azure
Future Scenarios: Linux/Azure, Windows/Overlay, Linux/Overlay
2017-07-05 22:31:49 -07:00