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

SriovNetwork: react on namespace creation #493

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

zeeke
Copy link
Member

@zeeke zeeke commented Aug 21, 2023

If a user creates an SriovNetwork with a network namespace that doesn't exist, retrying reconciling with an exponential backoff is not efficient, as the routing will fail until the namespace is created.

This patch makes the controller watch Namespace resource creation and reconcile the related SriovNetworks if needed.

Before this PR, the SriovNetwork reconcile function returned an error, triggering the exponential back-off retry system:

2023-08-11T16:14:18.839626394Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "9783b6b4-b193-4d78-9371-be4f3487d68b", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:18.905244077Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "fccf9f74-f963-47f4-b672-d5099eb40484", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:18.970988294Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "5c790fc5-ca13-4283-b0a8-22753d0ccb89", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:19.047349515Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "388e00a0-dfe3-4b01-afef-b2ec0b62a675", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:19.142652361Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "dd8a06d4-08d8-479f-b5c4-b29e2d07a6b9", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:19.278729554Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "8267549b-ec6c-4370-a162-c4b88987c2aa", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:19.496675162Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "7764a8ea-fd2e-4704-82b1-902f066e2cda", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:19.87228528Z   ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "5c111316-1313-470c-9e95-3637f5386bd1", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:20.569108499Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "ac4bfd17-af0e-4421-8ec7-b583ce7c2831", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}
2023-08-11T16:14:21.905604308Z  ERROR   Couldn't create NetworkAttachmentDefinition CR  {"controller": "sriovnetwork", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovNetwork", "SriovNetwork": {"name":"test-missing-ns","namespace":"openshift-sriov-network-operator"}, "namespace": "openshift-sriov-network-operator", "name": "test-missing-ns", "reconcileID": "c63c700a-537d-4fc4-b64d-6b4dba8f7a4e", "sriovnetwork": "openshift-sriov-network-operator/test-missing-ns", "Namespace": "ns-xxx", "Name": "test-missing-ns", "error": "namespaces \"ns-xxx\" not found"}

@zeeke zeeke marked this pull request as ready for review August 21, 2023 11:10
@github-actions
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.

@github-actions
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 Aug 21, 2023

Pull Request Test Coverage Report for Build 5962355735

  • 45 of 51 (88.24%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.4%) to 25.078%

Changes Missing Coverage Covered Lines Changed/Added Lines %
controllers/sriovibnetwork_controller.go 23 26 88.46%
controllers/sriovnetwork_controller.go 22 25 88.0%
Files with Coverage Reduction New Missed Lines %
controllers/sriovibnetwork_controller.go 2 70.23%
Totals Coverage Status
Change from base Build 5949253686: 0.4%
Covered Lines: 2158
Relevant Lines: 8605

💛 - Coveralls

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.

LGTM

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.

overall LGTM !

few small nits

@zeeke you mind adding the same logic for sriovIbNetwork controller ? i believe we have the same problem there as well.

if you dont have BW for it, can you create an issue to track ?

controllers/sriovnetwork_controller.go Show resolved Hide resolved
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: could you remove spaces here and below ?

controllers/sriovnetwork_controller.go Outdated Show resolved Hide resolved
@github-actions
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.

@zeeke
Copy link
Member Author

zeeke commented Aug 24, 2023

@zeeke you mind adding the same logic for sriovIbNetwork controller ? i believe we have the same problem there as well.

Done, please take a look

@github-actions
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

@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.

LGTM

nice work!

I learn about the index one it's nice!

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, just need to rebase this one and we are good 2 go 🚗

@adrianchiris
Copy link
Collaborator

@zeeke you mind adding the same logic for sriovIbNetwork controller ? i believe we have the same problem there as well.

Done, please take a look

Awesome Thanks !

If a user creates an SriovNetwork with a network namespace
that doesn't exist, retrying reconciling with an exponential
backoff is not efficient, as the routing will fail until the namespace
is created.

This patch makes the controller watch Namespace resource
creation and reconcile the related SriovNetworks if needed.

Signed-off-by: Andrea Panattoni <[email protected]>
Apply the same namespace reaction as the SriovNetwork

Signed-off-by: Andrea Panattoni <[email protected]>
@github-actions
Copy link

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

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