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

Interface redesign #553

Merged

Conversation

SchSeba
Copy link
Collaborator

@SchSeba SchSeba commented Nov 25, 2023

This PR is mainly moving stuff around and creating interfaces so we can have much better coverage in our unit tests

This is the second part needed to have a parallel configuration after #552

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

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 Nov 25, 2023

Pull Request Test Coverage Report for Build 7451460358

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-2.3%) to 23.391%

Totals Coverage Status
Change from base Build 7449232442: -2.3%
Covered Lines: 2300
Relevant Lines: 9833

💛 - Coveralls

}
return FilesystemRoot
defer file.Close()

Check warning

Code scanning / CodeQL

Writable file handle closed without error handling Warning

File handle may be writable as a result of data flow from a
call to OpenFile
and closing it may result in data loss upon failure, which is not handled explicitly.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@SchSeba do we need to address this alert?

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

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.

1 similar comment
Copy link

github-actions bot commented Dec 4, 2023

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.

This was referenced Dec 5, 2023
@e0ne
Copy link
Collaborator

e0ne commented Dec 7, 2023

/test-all

@e0ne
Copy link
Collaborator

e0ne commented Dec 7, 2023

/test-e2e-nvidia-all

pkg/global/vars/vars.go Outdated Show resolved Hide resolved
pkg/global/consts/constants.go Outdated Show resolved Hide resolved
pkg/host/host.go Outdated Show resolved Hide resolved
pkg/global/vars/vars.go Outdated Show resolved Hide resolved
api/v1/helper.go Outdated Show resolved Hide resolved
pkg/global/vars/vars.go Outdated Show resolved Hide resolved
@zeeke
Copy link
Member

zeeke commented Dec 11, 2023

Left some comments.
Though there are a lot of changed files for a single PR, I like the approach of moving toward a more testable operator.
Looking forward to propose PRs based on this with even more cleanups and improvements

@SchSeba
Copy link
Collaborator Author

SchSeba commented Dec 12, 2023

@zeeke yep agree with you there is more stuff to do here.
my next work on cleanups and improvements will be to move also the systemd stuff we have to interfaces so we can have unit-tests in that area

pkg/platforms/openshift/openshift.go Show resolved Hide resolved
pkg/platforms/openshift/openshift.go Outdated Show resolved Hide resolved
pkg/platforms/openshift/openshift.go Outdated Show resolved Hide resolved
pkg/platforms/openstack/openstack.go Show resolved Hide resolved
pkg/platforms/openstack/openstack.go Outdated Show resolved Hide resolved
pkg/platforms/openstack/openstack.go Outdated Show resolved Hide resolved
pkg/platforms/platforms.go Outdated Show resolved Hide resolved
pkg/platforms/platforms.go Outdated Show resolved Hide resolved
pkg/platforms/platforms.go Outdated Show resolved Hide resolved
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.

@SchSeba
Copy link
Collaborator Author

SchSeba commented Dec 17, 2023

Hi @e0ne @zeeke @adrianchiris please take another look if you can I think I fixed everything

pkg/vendors/mellanox/mellanox.go Outdated Show resolved Hide resolved
pkg/vendors/mellanox/mellanox.go Show resolved Hide resolved
pkg/vendors/mellanox/mellanox.go Outdated Show resolved Hide resolved
pkg/vendors/mellanox/mellanox.go Outdated Show resolved Hide resolved
pkg/vendors/mellanox/mellanox.go Outdated Show resolved Hide resolved
pkg/vendors/mellanox/mellanox.go Outdated Show resolved Hide resolved
pkg/vendors/mellanox/mellanox.go Outdated Show resolved Hide resolved
@adrianchiris
Copy link
Collaborator

@SchSeba im reviewing commits 1 by 1 so expect several comment batches from me :)

pkg/host/host.go Outdated Show resolved Hide resolved
pkg/utils/utils.go Outdated Show resolved Hide resolved
pkg/utils/utils.go Outdated Show resolved Hide resolved
pkg/host/host.go Outdated Show resolved Hide resolved
pkg/host/service.go Outdated Show resolved Hide resolved
pkg/host/sriov.go Show resolved Hide resolved
pkg/host/store.go Outdated Show resolved Hide resolved
pkg/plugins/plugin.go Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Jan 5, 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
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 !

please rebase this one as discussed. then once rebased ill pull, and deploy on switchdev setup as discussed.

like openstack and openshift add interfaces and mocks for better unit test

Signed-off-by: Sebastian Sch <[email protected]>
for example MLX special mstconfig wrapper and create mock for unit tests

Signed-off-by: Sebastian Sch <[email protected]>
…kage

create also interfaces for everything so we can have better unit tests coverage

Signed-off-by: Sebastian Sch <[email protected]>
@SchSeba SchSeba force-pushed the interface_redesign branch from adc6706 to 5a70e9e Compare January 7, 2024 16:31
Copy link

github-actions bot commented Jan 7, 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.

@SchSeba
Copy link
Collaborator Author

SchSeba commented Jan 7, 2024

Thanks!
Done please have a look :)

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.

LGTM

api/v1/helper.go Outdated
if ifaceSpec.Mtu > 0 {
mtu := ifaceSpec.Mtu
if mtu != ifaceStatus.Mtu {
log.V(2).Info("NeedUpdate(): MTU needs update", "desired", mtu, "current", ifaceStatus.Mtu)
Copy link
Contributor

Choose a reason for hiding this comment

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

function is now NeedToUpdateSriov instead of NeedUpdate for the log

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right thanks!

if err != nil {
setupLog.Error(err, "failed to create store manager")
return err
setupLog.Error(err, "failed to create vendorHelpers")
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't it be hostHelpers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right thanks!

return Interface{}, fmt.Errorf("unable to find interface: %v", name)
}

func NeedToUpdateSriov(ifaceSpec *Interface, ifaceStatus *InterfaceExt) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

why can't this be part of pkg/host/sriov.go? It's used there by ConfigSriovInterfaces and both of them are only used by the generic plugin. Both can be called using the helpers. What am I missing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the reason I didn't put it in the host package is because that function doesn't do anything on the host. this function just make a API verification that is with it should be in the API helpers and not in the host package

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,

Tested this out on my setup both with switchdev and legacy sriov, seems to behave as expected.

@e0ne PTAL i see you requested changes, please approve if they were resolved.

id like to merge this one tommorow. as several PRs depend on it.

if we have non-critical comments remaining they can be addressed as follloup IMO

Copy link
Collaborator

@e0ne e0ne left a comment

Choose a reason for hiding this comment

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

Thank for addressing my comments! No blockers from my side now

@SchSeba SchSeba force-pushed the interface_redesign branch from 5a70e9e to d5eb696 Compare January 8, 2024 18:11
Copy link

github-actions bot commented Jan 8, 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.

@SchSeba
Copy link
Collaborator Author

SchSeba commented Jan 8, 2024

Thanks everyone great work!!!

@adrianchiris adrianchiris merged commit 443a301 into k8snetworkplumbingwg:master Jan 9, 2024
11 checks passed
zeeke added a commit to zeeke/sriov-network-operator-1 that referenced this pull request Feb 1, 2024
Refactoring in [1] left the openstackContext uninitialized.

[1] k8snetworkplumbingwg#553

Signed-off-by: Andrea Panattoni <[email protected]>
zeeke added a commit to zeeke/sriov-network-operator-1 that referenced this pull request Feb 2, 2024
Refactoring in [1] left the openstackContext uninitialized.

[1] k8snetworkplumbingwg#553

Signed-off-by: Andrea Panattoni <[email protected]>
zeeke added a commit to zeeke/sriov-network-operator-1 that referenced this pull request Mar 14, 2024
Passing `/bin/sh -c xxx` to `RunCommand` requires xxx to be a single string
representing a full command. Multiple arguments shifts the executed command
from:
```
/bin/sh -c "cat file.txt"
```
to:
```
/bin/sh -c cat file.txt
```

This regression has been introduced by:
- k8snetworkplumbingwg#553

Signed-off-by: Andrea Panattoni <[email protected]>
@zeeke zeeke mentioned this pull request Mar 14, 2024
zeeke added a commit to zeeke/sriov-network-operator-1 that referenced this pull request Mar 14, 2024
Passing `/bin/sh -c xxx` to `RunCommand` requires xxx to be a single string
representing a full command. Multiple arguments shifts the executed command
from:
```
/bin/sh -c "cat file.txt"
```
to:
```
/bin/sh -c cat file.txt
```

This regression has been introduced by:
- k8snetworkplumbingwg#553

Signed-off-by: Andrea Panattoni <[email protected]>
SchSeba pushed a commit to SchSeba/sriov-network-operator that referenced this pull request May 7, 2024
Refactoring in [1] left the openstackContext uninitialized.

[1] k8snetworkplumbingwg/sriov-network-operator#553

Signed-off-by: Andrea Panattoni <[email protected]>
SchSeba pushed a commit to SchSeba/sriov-network-operator that referenced this pull request May 7, 2024
Passing `/bin/sh -c xxx` to `RunCommand` requires xxx to be a single string
representing a full command. Multiple arguments shifts the executed command
from:
```
/bin/sh -c "cat file.txt"
```
to:
```
/bin/sh -c cat file.txt
```

This regression has been introduced by:
- k8snetworkplumbingwg/sriov-network-operator#553

Signed-off-by: Andrea Panattoni <[email protected]>
SchSeba pushed a commit to SchSeba/sriov-network-operator that referenced this pull request May 25, 2024
Refactoring in [1] left the openstackContext uninitialized.

[1] k8snetworkplumbingwg/sriov-network-operator#553

Signed-off-by: Andrea Panattoni <[email protected]>
SchSeba pushed a commit to SchSeba/sriov-network-operator that referenced this pull request May 25, 2024
Passing `/bin/sh -c xxx` to `RunCommand` requires xxx to be a single string
representing a full command. Multiple arguments shifts the executed command
from:
```
/bin/sh -c "cat file.txt"
```
to:
```
/bin/sh -c cat file.txt
```

This regression has been introduced by:
- k8snetworkplumbingwg/sriov-network-operator#553

Signed-off-by: Andrea Panattoni <[email protected]>
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.

8 participants