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

pod probe marker controller #1075

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

zmberg
Copy link
Member

@zmberg zmberg commented Sep 14, 2022

Ⅰ. Describe what this PR does

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

@zmberg zmberg force-pushed the pod-probe-marker-controller branch 2 times, most recently from 2a7d8a1 to 015b43b Compare September 14, 2022 03:30
@zmberg zmberg force-pushed the pod-probe-marker-controller branch 2 times, most recently from d388010 to 94afac6 Compare September 15, 2022 02:15
pkg/controller/podprobemarker/node_pod_probe.go Outdated Show resolved Hide resolved
pkg/controller/podprobemarker/node_pod_probe.go Outdated Show resolved Hide resolved
return err
}
// remove podProbe from NodePodProbe.Spec
if !ppm.DeletionTimestamp.IsZero() {
Copy link
Member

Choose a reason for hiding this comment

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

shall we stop probing when pod with never restart policy exits, actually we can use IsPodActive directly

Copy link
Member Author

Choose a reason for hiding this comment

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

func getMatchingPods already use IsPodActive to filter pods.

Copy link
Member

Choose a reason for hiding this comment

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

if pod become not active, we should remove the pod from NodePodProe

}
// add finalizer
if !controllerutil.ContainsFinalizer(ppm, PodProbeMarkerFinalizer) {
err = util.UpdateFinalizer(r.Client, ppm, util.AddFinalizerOpType, PodProbeMarkerFinalizer)
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 add the finalizer in webhook , so that we don't need to update podmarker itself

Copy link
Member Author

Choose a reason for hiding this comment

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

There is currently no logic for mutating webhook, is it a bit heavy for only finalizer?

pkg/controller/podprobemarker/ppm_event_handler.go Outdated Show resolved Hide resolved
pkg/controller/podprobemarker/ppm_event_handler.go Outdated Show resolved Hide resolved
pkg/controller/podprobemarker/ppm_event_handler.go Outdated Show resolved Hide resolved
@zmberg zmberg force-pushed the pod-probe-marker-controller branch 3 times, most recently from 235fd8e to 4e121cb Compare September 16, 2022 06:00
}
// remove pod probe from nodePodProbe.spec
if kubecontroller.IsPodActive(new) && new.Spec.NodeName != "" &&
old.DeletionTimestamp.IsZero() && !new.DeletionTimestamp.IsZero() {
Copy link
Member

Choose a reason for hiding this comment

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

If kubecontroller.IsPodActive(new) is true, then !new.DeletionTimestamp.IsZero() will always be false.

q.Add(reconcile.Request{
NamespacedName: types.NamespacedName{
Namespace: npp.Namespace,
Name: fmt.Sprintf("%s#%s", ReconNodePodProbe, npp.Name),
Copy link
Member

Choose a reason for hiding this comment

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

Should it be ReconPodProbeMarker?

old.DeletionTimestamp.IsZero() && !new.DeletionTimestamp.IsZero() {

npp := &appsalphav1.NodePodProbe{}
if err := p.reader.Get(context.TODO(), client.ObjectKey{Name: new.Spec.NodeName}, npp); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Should better use field index instead of enqueuing every NodePodProbe for every terminating pod

)

var (
nodeImageCreationDelayAfterNodeReady = time.Second * 30
Copy link
Member

Choose a reason for hiding this comment

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

nodePodProbeCreationDelayAfterNodeReady

@zmberg zmberg force-pushed the pod-probe-marker-controller branch 2 times, most recently from 1352504 to 656363e Compare September 19, 2022 02:30
@zmberg zmberg force-pushed the pod-probe-marker-controller branch from 656363e to 7ac82dd Compare September 19, 2022 02:38
} else {
conStatus = corev1.ConditionFalse
}
ppmName, probeName := strings.Split(probeState.Name, "#")[0], strings.Split(probeState.Name, "#")[1]
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 can get pod probe marker name from NodePodProbe.probes[*].podProbeMarkerName, why we have to encode the podProbeMarkerName in the probe name ?

podProbe.Probes = append(podProbe.Probes, appsv1alpha1.ContainerProbe{
Name: fmt.Sprintf("%s#%s", ppm.Name, probe.Name),
ContainerName: probe.ContainerName,
Probe: probe.Probe,
Copy link
Member

Choose a reason for hiding this comment

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

populate podProbeMarkerName using. probe.Name

@zmberg zmberg force-pushed the pod-probe-marker-controller branch from 7ac82dd to f542471 Compare September 19, 2022 06:22
@zmberg zmberg force-pushed the pod-probe-marker-controller branch from f542471 to 6b7dbf9 Compare September 19, 2022 07:07
@furykerry
Copy link
Member

/lgtm

RemoveFinalizerOpType FinalizerOpType = "Remove"
)

func UpdateFinalizer(c client.Client, object client.Object, op FinalizerOpType, finalizer string) error {
Copy link
Member

Choose a reason for hiding this comment

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

We don't have to define UpdateFinalizer function, just use Patch in the two places that want to add or remove finalizer.

@FillZpp
Copy link
Member

FillZpp commented Sep 20, 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 984d649 into openkruise:master Sep 20, 2022
@zmberg zmberg deleted the pod-probe-marker-controller branch September 26, 2022 10:02
baxiaoshi pushed a commit to baxiaoshi/kruise that referenced this pull request Nov 21, 2022
Signed-off-by: peng.xin <[email protected]>

optimize workloadspread when suitable subset maxReplicas is niil (openkruise#1066)

Signed-off-by: mingzhou.swx <[email protected]>

Signed-off-by: mingzhou.swx <[email protected]>
Co-authored-by: mingzhou.swx <[email protected]>

Optimize performance of LabelSelector conversion (openkruise#1068)

Signed-off-by: FillZpp <[email protected]>

Signed-off-by: FillZpp <[email protected]>

Support timezone for AdvancedCronJob (openkruise#1070)

Signed-off-by: FillZpp <[email protected]>

Signed-off-by: FillZpp <[email protected]>

ignore if pod condition has been updated (openkruise#1074)

Signed-off-by: mingzhou.swx <[email protected]>

Signed-off-by: mingzhou.swx <[email protected]>
Co-authored-by: mingzhou.swx <[email protected]>

pod probe marker apis (openkruise#1073)

* pod probe marker apis

Signed-off-by: liheng.zms <[email protected]>

* fix statefulset truncateHistory panic

Signed-off-by: liheng.zms <[email protected]>

Signed-off-by: liheng.zms <[email protected]>

pod probe marker controller (openkruise#1075)

Signed-off-by: liheng.zms <[email protected]>

Signed-off-by: liheng.zms <[email protected]>

consider whether patch field is matched when assign existing pods to subset (openkruise#1083)

Signed-off-by: mingzhou.swx <[email protected]>

Signed-off-by: mingzhou.swx <[email protected]>
Co-authored-by: mingzhou.swx <[email protected]>

pod probe marker webhook (openkruise#1078)

Signed-off-by: liheng.zms <[email protected]>

Signed-off-by: liheng.zms <[email protected]>

sidecarset support pods ns(kube-system, kube-public) (openkruise#1084)

Signed-off-by: liheng.zms <[email protected]>

Signed-off-by: liheng.zms <[email protected]>

pod probe marker proposal (openkruise#1053)

Signed-off-by: liheng.zms <[email protected]>

Signed-off-by: liheng.zms <[email protected]>

node pod probe daemon (openkruise#1077)

Signed-off-by: liheng.zms <[email protected]>

sidecarset support patch pod metadata proposal (openkruise#993)

Signed-off-by: liheng.zms <[email protected]>

Support predownload image in ads (openkruise#1057)

Signed-off-by: Abner <[email protected]>

* support predownload image for ads

Add PreDownloadImageForDaemonSetUpdate featureGate (openkruise#1093)

Signed-off-by: FillZpp <[email protected]>

Signed-off-by: FillZpp <[email protected]>

Add changelog for v1.3.0 (openkruise#1092)

Signed-off-by: liheng.zms <[email protected]>

Signed-off-by: liheng.zms <[email protected]>

fix sidecarset inject annotations abnormal (openkruise#1101)

Signed-off-by: liheng.zms <[email protected]>

Signed-off-by: liheng.zms <[email protected]>

fix InPlaceUpdateEnvFromMetadata bug (openkruise#1108)

Co-authored-by: 郭已钦 <[email protected]>

support uniteddeployment persistentVolumeClaimRetentionPolicy inherit from  advancestatefulset template (openkruise#1110)

Signed-off-by: cheyuexian <[email protected]>

Signed-off-by: cheyuexian <[email protected]>
Co-authored-by: cheyuexian <[email protected]>

Add PreNormal Lifecycle Hook for CloneSet (openkruise#1071)

* add pre-normal(pre-available) hook

Signed-off-by: mingzhou.swx <[email protected]>

* add pre-normal(pre-available) hook

Signed-off-by: mingzhou.swx <[email protected]>

Signed-off-by: mingzhou.swx <[email protected]>
Co-authored-by: mingzhou.swx <[email protected]>

partition support float percent (openkruise#1124)

Signed-off-by: shiyan2016 <[email protected]>

Signed-off-by: shiyan2016 <[email protected]>

improve error hanlding of inplace update env from metadata (openkruise#1125)

Signed-off-by: mingzhou.swx <[email protected]>

Signed-off-by: mingzhou.swx <[email protected]>
Co-authored-by: mingzhou.swx <[email protected]>

pub support to configure Evict,Delete,Update Operation (openkruise#1126)

Signed-off-by: liheng.zms <[email protected]>

Signed-off-by: liheng.zms <[email protected]>

feat: add watch whitelist

feat: add watch whitelist

add watch whitelist check

add dynamic watch option

feat: add persistent annotations

format

feat: add pps support custom workload

Signed-off-by: peng.xin <[email protected]>

fix: nodeSelector and nodeAffinity have not been modified

Signed-off-by: peng.xin <[email protected]>

fix: error string

Signed-off-by: peng.xin <[email protected]>

fix: error string

Signed-off-by: peng.xin <[email protected]>

fix: goimports

Signed-off-by: peng.xin <[email protected]>

refactor: refactoring ersistentPodAnnotations type

Signed-off-by: peng.xin <[email protected]>

- add statefulet group check
- modify the pod create processing logic

Signed-off-by: peng.xin <[email protected]>

refactor: pps watch of whitelist workload

Signed-off-by: peng.xin <[email protected]>

fix: add statefulsetlike's pod controller

Signed-off-by: peng.xin <[email protected]>
ppbits pushed a commit to ppbits/kruise that referenced this pull request Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants