Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[software-bridges 3/x] Add bridge package #691

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

ykulazhenkov
Copy link
Collaborator

@ykulazhenkov ykulazhenkov commented Apr 29, 2024

The package contains logic to work with managed OVS bridges.

// DiscoverBridges returns information about managed bridges on the host
DiscoverBridges() (sriovnetworkv1.Bridges, error)
// ConfigureBridge configure managed bridges for the host
ConfigureBridges(bridgesSpec sriovnetworkv1.Bridges, bridgesStatus sriovnetworkv1.Bridges) error
// DetachInterfaceFromManagedBridge detach interface from a managed bridge,
// this step is required before applying some configurations to PF, e.g. changing of eSwitch mode.
// The function detach interface from managed bridges only.
DetachInterfaceFromManagedBridge(pciAddr string) error

Context is Software bridge management feature

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Apr 29, 2024

Pull Request Test Coverage Report for Build 9958277243

Details

  • 648 of 856 (75.7%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+2.2%) to 43.08%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/host/internal/bridge/bridge.go 41 46 89.13%
pkg/host/internal/bridge/ovs/store/store.go 109 149 73.15%
pkg/host/internal/bridge/ovs/ovs.go 388 551 70.42%
Totals Coverage Status
Change from base Build 9955379640: 2.2%
Covered Lines: 6266
Relevant Lines: 14545

💛 - Coveralls

Copy link
Collaborator

@SchSeba SchSeba left a comment

Choose a reason for hiding this comment

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

I left some comments in general the code looks good.

just one comment when we are not running in systemdmode the configuration will be done after a chroot? if not we need to update the ovs socket file to support the /host mount inside the container

pkg/host/internal/bridge/ovs/store/store.go Show resolved Hide resolved
pkg/host/internal/bridge/ovs/store/store.go Show resolved Hide resolved
pkg/host/internal/bridge/ovs/store/store.go Show resolved Hide resolved
CreateOVSBridge(ctx context.Context, conf *sriovnetworkv1.OVSConfigExt) error
// GetOVSBridges returns configuration for all managed bridges
GetOVSBridges(ctx context.Context) ([]sriovnetworkv1.OVSConfigExt, error)
// RemoveOVSBridge removes managed OVS bridge by name
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we also want/need getOVSBridge(name string)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not required by the implementation at the moment. I don't want to add this function just for API fullness

// if OVS bridge exist with different config it will be removed and re-created
func (o *ovs) CreateOVSBridge(ctx context.Context, conf *sriovnetworkv1.OVSConfigExt) error {
ctx, cFunc := setDefaultTimeout(ctx)
defer cFunc()
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can you change cFunc to just cancel please ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

return nil
}

// RemoveInterfaceFromOVSBridge interface from the managed OVS bridge
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add: removes interface from the managed OVS bridge

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

}

// RemoveInterfaceFromOVSBridge interface from the managed OVS bridge
func (o *ovs) RemoveInterfaceFromOVSBridge(ctx context.Context, ifaceAddr string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ifaceAddr -> pciAddress it looks like it's ip address

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

func (o *ovs) RemoveInterfaceFromOVSBridge(ctx context.Context, ifaceAddr string) error {
ctx, cFunc := setDefaultTimeout(ctx)
defer cFunc()
funcLog := log.Log.WithValues("ifaceAddr", ifaceAddr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here ifaceAddr -> pciAddress

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

}

// delete bridge by the name
func (o *ovs) deleteBridge(ctx context.Context, dbClient client.Client, brName string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

deleteBridgeByName

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

}

// delete interface by the name
func (o *ovs) deleteInterface(ctx context.Context, dbClient client.Client, ifaceName string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

deleteInterfaceByName

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

pkg/host/internal/bridge/ovs/models.go Outdated Show resolved Hide resolved
pkg/host/internal/bridge/ovs/models.go Outdated Show resolved Hide resolved
pkg/host/internal/bridge/ovs/models.go Outdated Show resolved Hide resolved
pkg/host/internal/bridge/ovs/ovs.go Outdated Show resolved Hide resolved
pkg/host/internal/bridge/ovs/ovs.go Show resolved Hide resolved
pkg/host/internal/bridge/ovs/store/store.go Outdated Show resolved Hide resolved
pkg/host/internal/bridge/ovs/store/store.go Outdated Show resolved Hide resolved
@adrianchiris
Copy link
Collaborator

partial review for now. added a few comments :)

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@ykulazhenkov
Copy link
Collaborator Author

@adrianchiris @SchSeba thanks for your reviews! I addressed your comments. PTAL

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@ykulazhenkov
Copy link
Collaborator Author

PR reabased. Currently it has no dependencies from other PRs

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Copy link
Collaborator

@adrianchiris adrianchiris left a comment

Choose a reason for hiding this comment

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

LGTM !!

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@ykulazhenkov
Copy link
Collaborator Author

The PR rebased. @SchSeba I think all comments are addressed. Can you take another look? Thanks

@adrianchiris
Copy link
Collaborator

@SchSeba can we merge this one ?

Copy link

github-actions bot commented Jul 9, 2024

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Copy link
Member

@zeeke zeeke left a comment

Choose a reason for hiding this comment

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

Only two minor comments on my side. Otherwise LGTM

As soon as we have a full working feature, I want to check if and how config-daemon logs are affected by bridge management. We're already suffering there and I really need them to not grow much.

pkg/host/internal/bridge/bridge.go Outdated Show resolved Hide resolved
pkg/host/internal/bridge/bridge.go Outdated Show resolved Hide resolved
The package contains logic to work
with managed OVS bridges.

// DiscoverBridges returns information about managed bridges on the host
DiscoverBridges() (sriovnetworkv1.Bridges, error)
// ConfigureBridge configure managed bridges for the host
ConfigureBridges(bridgesSpec sriovnetworkv1.Bridges, bridgesStatus sriovnetworkv1.Bridges) error
// DetachInterfaceFromManagedBridge detach interface from a managed bridge,
// this step is required before applying some configurations to PF, e.g. changing of eSwitch mode.
// The function detach interface from managed bridges only.
DetachInterfaceFromManagedBridge(pciAddr string) error

Signed-off-by: Yury Kulazhenkov <ykulazhenkov@nvidia.com>
@ykulazhenkov
Copy link
Collaborator Author

@zeeke Thanks for the review. I addressed your comments. Please, take another look

Copy link
Collaborator

@SchSeba SchSeba left a comment

Choose a reason for hiding this comment

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

Great work!

@zeeke zeeke merged commit fc8f4ee into k8snetworkplumbingwg:master Jul 17, 2024
12 checks passed
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.

None yet

5 participants