Skip to content

Add implementation of network configuration proxy#915

Merged
dcantah merged 1 commit intomicrosoft:masterfrom
dcantah:ncproxy-newdesign
Mar 4, 2021
Merged

Add implementation of network configuration proxy#915
dcantah merged 1 commit intomicrosoft:masterfrom
dcantah:ncproxy-newdesign

Conversation

@dcantah
Copy link
Copy Markdown
Contributor

@dcantah dcantah commented Dec 19, 2020

  • Ncproxy (abbreviation of network configuration proxy) is a proxy used to facilitate
    external configuration of a pods network through a set of TTRPC and GRPC services.
    Ncproxy relies on other TTRPC/GRPC services to get the information it needs to perform
    its actions.

The full set of services are as follows:


NetworkConfigProxy (TTRPC) - This service is exposed by Ncproxy and is used by the shim.

NodeNetworkService (GRPC) - This service is exposed by any application implementing the interface
to the service (/cmd/ncproxy/sdn_nodenetsvc/nodenetsvc.proto).

NetworkConfigProxy (GRPC) - This service is exposed by Ncproxy and is used by a service implementing
the NodeNetworkService GRPC interface.

ComputeAgent (TTRPC) - This service is exposed by the shim and is called by ncproxy.


This is an optional feature that can be enabled by setting the annotation "io.microsoft.network.ncproxy"
and providing an address to a TTRPC service that implements the NetworkConfigProxy TTRPC service defined in
/internal/ncproxyttrpc.

Signed-off-by: Daniel Canter dcanter@microsoft.com

@dcantah dcantah requested a review from a team as a code owner December 19, 2020 05:35
@dcantah
Copy link
Copy Markdown
Contributor Author

dcantah commented Dec 19, 2020

Just remaking the PR as the comments for the old one were ancient and it was also complaining about merge conflicts that weren't showing up locally.

@dcantah dcantah force-pushed the ncproxy-newdesign branch 2 times, most recently from 7e070c6 to 637f0fc Compare December 19, 2020 05:39
Comment thread cmd/containerd-shim-runhcs-v1/pod.go
Comment thread internal/hcsoci/network.go Outdated
Comment thread cmd/ncproxy/main.go Outdated
Comment thread cmd/ncproxy/main.go Outdated
Comment thread cmd/ncproxy/ncproxy.go Outdated
Comment thread cmd/ncproxy/ncproxy.go
Comment thread cmd/ncproxy/ncproxy.go Outdated
Comment thread cmd/ncproxy/server.go
Comment thread hcn/hcn.go
@dcantah dcantah force-pushed the ncproxy-newdesign branch 2 times, most recently from 6c55cd5 to 69ebb66 Compare January 14, 2021 16:14
Comment thread cmd/ncproxy/ncproxygrpc/networkconfigproxy.proto
Comment thread internal/hcsoci/network.go Outdated
Comment thread cmd/containerd-shim-runhcs-v1/pod.go Outdated
@@ -1,221 +0,0 @@
file {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevpar do we still need these files for something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevpar I'd also like to know. Everytime I make a change to the runhcs options this file gets deleted

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need these files. It looks like they are used as part of documenting old API versions in containerd.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevpar Awesome

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're removing it, though, you should also remove the descriptor entry from Protobuild.toml.

Comment thread internal/resources/resources.go Outdated
Comment thread internal/uvm/network.go Outdated
@dcantah dcantah force-pushed the ncproxy-newdesign branch 2 times, most recently from fe2a067 to 1080429 Compare February 25, 2021 06:36
Comment thread cmd/containerd-shim-runhcs-v1/pod.go Outdated
Comment thread internal/resources/resources.go Outdated
Comment thread internal/uvm/network.go
//
// `addr` is an optional parameter
func (uvm *UtilityVM) CreateAndAssignNetworkSetup(ctx context.Context, addr, containerID string) (err error) {
if uvm.NCProxyEnabled() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also enforce that addr is not empty here and fall back to local if it is for some reason?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can enforce addr isn't empty to fail earlier, but I don't think we should fallback

Comment thread internal/hcsoci/create.go
Comment on lines +239 to +247
if err == uvm.ErrNoNetworkSetup {
// No network interface passed in, just set up locally.
coi.HostingSystem.NetworkSetup = uvm.NewInternalNetworkSetup(coi.HostingSystem)
err := coi.HostingSystem.ConfigureNetworking(ctx, coi.actualNetworkNamespace)
if err != nil {
return err
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to use CreateAndAssignNetworkSetup here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, makes more sense if we're using everywhere else

Comment thread internal/resources/resources.go Outdated
@dcantah dcantah force-pushed the ncproxy-newdesign branch from 1080429 to 54704d9 Compare March 1, 2021 22:23
@dcantah
Copy link
Copy Markdown
Contributor Author

dcantah commented Mar 1, 2021

@katiewasnothere Remedied last round

Comment thread internal/hcsoci/create.go
// No network setup type was specified for this UVM. Create and assign one here unless
// we received a different error.
if err == uvm.ErrNoNetworkSetup {
if err := coi.HostingSystem.CreateAndAssignNetworkSetup(ctx, "", ""); err != nil {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we know for sure at this point that ncproxy is not enabled for the VM?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only time in our use cases we'd end up here is for a standalone task (launched through ctr) and we don't have any code to setup ncproxy for that so I think this is a fine assumption for now.

Copy link
Copy Markdown

@katiewasnothere katiewasnothere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dcantah
Copy link
Copy Markdown
Contributor Author

dcantah commented Mar 2, 2021

I think the plan was to check this in after @katiewasnothere's review, as this was just seen as "adding on" to what we have and not changing anything else, but as can be seen this is not the case 😄. A lot of the UVM networking code was reworked or moved around to make a cleaner abstraction between setting up networking via our normal path vs. ncproxy. @kevpar should we get another review on this?

@kevpar
Copy link
Copy Markdown
Member

kevpar commented Mar 2, 2021

I think the plan was to check this in after @katiewasnothere's review, as this was just seen as "adding on" to what we have and not changing anything else, but as can be seen this is not the case 😄. A lot of the UVM networking code was reworked or moved around to make a cleaner abstraction between setting up networking via our normal path vs. ncproxy. @kevpar should we get another review on this?

If this has risk to existing code paths then I think a 2nd reviewer would be a good idea.

* Ncproxy (abbreviation of network configuration proxy) is a proxy used to facilitate
external configuration of a pods network through a set of TTRPC and GRPC services.
Ncproxy relies on other TTRPC/GRPC services to get the information it needs to perform
its actions.

The full set of services are as follows:

------------------------------------------------------------------------------------------------------

NetworkConfigProxy (TTRPC) - This service is exposed by Ncproxy and is used by the shim.

NodeNetworkService (GRPC) - This service is exposed by any application implementing the interface
to the service (/cmd/ncproxy/sdn_nodenetsvc/nodenetsvc.proto).

NetworkConfigProxy (GRPC) - This service is exposed by Ncproxy and is used by a service implementing
the NodeNetworkService GRPC interface.

ComputeAgent (TTRPC) - This service is exposed by the shim and is called by ncproxy.

---------------------------------------------------------------------------------------------------------

This is an optional feature that can be enabled by setting the annotation "io.microsoft.network.ncproxy"
and providing an address to a TTRPC service that implements the NetworkConfigProxy TTRPC service defined in
/internal/ncproxyttrpc.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
@dcantah dcantah force-pushed the ncproxy-newdesign branch from 54704d9 to 88e182c Compare March 2, 2021 06:58
Copy link
Copy Markdown
Contributor

@anmaxvl anmaxvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skimmed through old code paths and the changes look ok. had one comment though

Spec: s,
HostingSystem: parent,
NetworkNamespace: netNS,
ScaleCPULimitsToSandbox: shimOpts.ScaleCpuLimitsToSandbox,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this affecting something? or was it a rebase?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase :)

@dcantah dcantah merged commit 8f44f31 into microsoft:master Mar 4, 2021
princepereira pushed a commit to princepereira/hcsshim that referenced this pull request Aug 29, 2024
Add implementation of network configuration proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants