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

podprobemarker support serverless pod #1875

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zmberg
Copy link
Member

@zmberg zmberg commented Jan 7, 2025

Ⅰ. Describe what this PR does

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 58.87850% with 88 lines in your changes missing coverage. Please review.

Project coverage is 50.96%. Comparing base (0d0031a) to head (66151df).
Report is 142 commits behind head on master.

Files with missing lines Patch % Lines
...ller/podprobemarker/pod_probe_marker_controller.go 53.84% 25 Missing and 11 partials ⚠️
...ler/podprobemarker/podprobemarker_event_handler.go 69.81% 11 Missing and 5 partials ⚠️
pkg/util/podprobemarker/pod_probe_marker.go 46.15% 11 Missing and 3 partials ⚠️
pkg/webhook/pod/mutating/pod_probe_marker.go 76.08% 7 Missing and 4 partials ⚠️
.../webhook/pod/mutating/pod_create_update_handler.go 0.00% 6 Missing ⚠️
pkg/util/pods.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1875      +/-   ##
==========================================
+ Coverage   47.91%   50.96%   +3.04%     
==========================================
  Files         162      194      +32     
  Lines       23491    25137    +1646     
==========================================
+ Hits        11256    12810    +1554     
+ Misses      11014    11004      -10     
- Partials     1221     1323     +102     
Flag Coverage Δ
unittests 50.96% <58.87%> (+3.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -109,6 +109,14 @@ func (h *PodCreateHandler) Handle(ctx context.Context, req admission.Request) ad
}
}

if utilfeature.DefaultFeatureGate.Enabled(features.EnablePodProbeMarkerOnServerless) {
if skip, err := h.podProbeMakerMutatingPod(ctx, req, obj); 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.

podProbeMakerMutatingPod -> podProbeMarkerMutatingPod

pkg/webhook/pod/mutating/pod_probe_marker.go Outdated Show resolved Hide resolved
req.AdmissionRequest.Resource.Resource != "pods" {
return true, nil
}
ppmList := &appsv1alpha1.PodProbeMarkerList{}
Copy link
Member

Choose a reason for hiding this comment

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

why not reuse the func getPodProbeMarkerForPod

apis/apps/v1alpha1/pod_probe_marker_types.go Show resolved Hide resolved
@@ -116,14 +120,56 @@ func (p *enqueueRequestForPod) Update(ctx context.Context, evt event.UpdateEvent
})
}
}

// serverless pod
if utilfeature.DefaultFeatureGate.Enabled(features.EnablePodProbeMarkerOnServerless) {
Copy link
Member

Choose a reason for hiding this comment

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

if -> else if ?

serverless pod can also entry the if clause of L107

matchedProbes = append(matchedProbes, probe)
matchedProbeKey.Insert(key)
matchedConditions.Insert(probe.PodConditionType)
if !matchedPodProbeMarkerName.Has(obj.Name) {
Copy link
Member

Choose a reason for hiding this comment

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

no need to check agaist the existence of entry, set operation will ensure only one entry exists

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.

2 participants