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

use kubeclient to get and delete machineconfig #848

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

crliu3227
Copy link

Use kubeclient to get and delete machineconfig, to fix #846

Copy link

Thanks for your PR,
To run vendors CIs, Maintainers can 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, Maintainers can 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.

Signed-off-by: liucongran <[email protected]>
@crliu3227 crliu3227 force-pushed the fix-cache-machineconfig branch from 489995f to e7a88a3 Compare February 19, 2025 08:54
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.

@crliu3227 thanks for dealing with this issue.

It would be great if we could disable the cache for all MachineConfig when we create the Manager in main.go#L134

According to this article, it should be possible:
https://medium.com/@timebertt/kubernetes-controllers-at-scale-clients-caches-conflicts-patches-explained-aa0f7a8b4332#8181

WDYT?

@@ -59,6 +59,7 @@ type SriovOperatorConfigReconciler struct {
Scheme *runtime.Scheme
PlatformHelper platforms.Interface
FeatureGate featuregate.FeatureGate
KubeClient client.Client
Copy link
Member

Choose a reason for hiding this comment

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

Can we be more specific and use mgr.GetAPIReader(). It would be clearer if anyone else needs to do operations avoiding the cache,

Suggested change
KubeClient client.Client
uncachedAPIReader client.Reader

Copy link
Author

Choose a reason for hiding this comment

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

OK, I will modify this part and resubmit the PR again

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

@@ -413,7 +414,8 @@ func (r *SriovOperatorConfigReconciler) syncOpenShiftSystemdService(ctx context.

if cr.Spec.ConfigurationMode != sriovnetworkv1.SystemdConfigurationMode {
obj := &machinev1.MachineConfig{}
err := r.Get(context.TODO(), types.NamespacedName{Name: consts.SystemdServiceOcpMachineConfigName}, obj)
// use uncached api reader to get machineconfig to reduce memory footprint
err := r.UncachedAPIReader.Get(context.TODO(), types.NamespacedName{Name: consts.SystemdServiceOcpMachineConfigName}, obj)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not to use ctx that is passed to syncOpenShiftSystemdService as arg?

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.

sriov-network-operator consumes a large amount of memory due to caching machineconfig
3 participants