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

Optimize Advanced DaemonSet internal new pod for imitating scheduling #1011

Merged
merged 1 commit into from
Jun 30, 2022

Conversation

FillZpp
Copy link
Member

@FillZpp FillZpp commented Jun 29, 2022

Signed-off-by: FillZpp [email protected]

Ⅰ. Describe what this PR does

Optimize Advanced DaemonSet internal new pod for imitating scheduling

@kruise-bot kruise-bot requested review from Fei-Guo and furykerry June 29, 2022 09:43
@kruise-bot kruise-bot added the size/M size/M: 30-99 label Jun 29, 2022
newPod := &corev1.Pod{Spec: ds.Spec.Template.Spec, ObjectMeta: ds.Spec.Template.ObjectMeta}
newPod.Namespace = ds.Namespace
newPod.Spec.NodeName = nodeName
// no need to set nodeName
Copy link
Member

Choose a reason for hiding this comment

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

since we're confident that pod for ds not exist here, plz consider using newPodForDSCache. LoadOrStore so that we don't have to maintain newPodForDSLock

Copy link
Member Author

@FillZpp FillZpp Jun 29, 2022

Choose a reason for hiding this comment

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

No, only LoadOrStore might have multiple NewPod to be create and store, for this is not only called in reconcile, but also event handler.

@@ -223,6 +223,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
ds := e.Object.(*appsv1alpha1.DaemonSet)
klog.V(4).Infof("Deleting DaemonSet %s/%s", ds.Namespace, ds.Name)
dsc.expectations.DeleteExpectations(keyFunc(ds))
newPodForDSCache.Delete(ds.UID)
Copy link
Member

Choose a reason for hiding this comment

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

plz delete entry of ds.UID if daemonset is not found in the beginning of Reconcile()

Copy link
Member Author

Choose a reason for hiding this comment

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

Emm.. I can't do that, for there is no UID since daemonset is not found. Delete handler should be enough.

Copy link
Member

@furykerry furykerry left a comment

Choose a reason for hiding this comment

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

/lgtm

@FillZpp
Copy link
Member Author

FillZpp commented Jun 30, 2022

/approve

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FillZpp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kruise-bot kruise-bot merged commit 69f33a1 into openkruise:master Jun 30, 2022
@FillZpp FillZpp added this to the v1.3.0 milestone Jul 21, 2022
diannaowa pushed a commit to diannaowa/kruise that referenced this pull request Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants