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

Avoid reconciling SriovNetworkNodePolicies multiple times #478

Conversation

zeeke
Copy link
Member

@zeeke zeeke commented Jul 14, 2023

SriovNetworkNodePolicy reconcile function lists all node policies and updates all SriovNetworkNodeState. Hence there is no need to resync all of them periodically.

Avoid triggering multiple reconciliations when creating multiple policies in a row (that is what happens when using yaml files).

@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 Jul 14, 2023

Pull Request Test Coverage Report for Build 5647611763

  • 0 of 28 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 24.475%

Changes Missing Coverage Covered Lines Changed/Added Lines %
controllers/sriovnetworknodepolicy_controller.go 0 28 0.0%
Totals Coverage Status
Change from base Build 5645891211: 0.02%
Covered Lines: 2085
Relevant Lines: 8519

💛 - Coveralls

@zeeke zeeke force-pushed the optimize-operator-reconciliation branch from 08d59d4 to 436c496 Compare July 14, 2023 14:06
@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 zeeke force-pushed the optimize-operator-reconciliation branch from 436c496 to afe02e0 Compare July 14, 2023 15:32
@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 zeeke force-pushed the optimize-operator-reconciliation branch from afe02e0 to 52dd721 Compare July 14, 2023 15:43
@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.

},
UpdateFunc: func(e event.UpdateEvent, q workqueue.RateLimitingInterface) {
log.Log.WithName("SriovNetworkNodePolicy").
Info("Enqueuing sync for create event", "resource", e.ObjectNew.GetName())
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: create -> update

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.

general question is it possible for the user to create an object with that name?

can we use a non existing namespace or something like that to be sure there is not going to be an object like that?

}}, time.Second)
}

squashAndDebounceHandler := handler.Funcs{
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: just name it delayedEventHandler ?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@adrianchiris
Copy link
Collaborator

general question is it possible for the user to create an object with that name?

can we use a non existing namespace or something like that to be sure there is not going to be an object like that?

why do we care ? its just an "event" to trigger reconcile that is not dependent on the specific obj that triggered the event.

@zeeke zeeke force-pushed the optimize-operator-reconciliation branch from 52dd721 to 17987d7 Compare July 24, 2023 15:59
@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.

`SriovNetworkNodePolicy` reconcile function lists all node policies
and updates all SriovNetworkNodeState. Hence there is no need to
resync all of them periodically.

Avoid triggering multiple reconciliations when creating multiple
policies in a row (that is what happens when using yaml files).

Signed-off-by: Andrea Panattoni <[email protected]>
@zeeke
Copy link
Member Author

zeeke commented Jul 24, 2023

general question is it possible for the user to create an object with that name?

can we use a non existing namespace or something like that to be sure there is not going to be an object like that?

Good point. If the user creates a node policy called node-policy-sync-event, then the Reconcile logic is invoked twice. Not a big deal, but this PR is all about avoiding doing the same things multiple times. Changing.

why do we care ? its just an "event" to trigger reconcile that is not dependent on the specific obj that triggered the event.

Because the controller (and the Reconcile method) are still triggered by every SriovNetworkNodePolicy, as it's the .For(...) argument.

@zeeke zeeke force-pushed the optimize-operator-reconciliation branch from 17987d7 to 9d8f31e Compare July 24, 2023 16:52
@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

thanks!

@adrianchiris adrianchiris merged commit 87d2860 into k8snetworkplumbingwg:master Aug 8, 2023
9 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.

5 participants