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
test/e2e/framework: remove direct dependency to k8s.io/kubernetes/pkg/controller #89506
test/e2e/framework: remove direct dependency to k8s.io/kubernetes/pkg/controller #89506
Conversation
/priority important-longterm /cc @neolit123 @oomichi |
@@ -175,6 +175,26 @@ func waitForPodsInactive(ps *testutils.PodStore, interval, timeout time.Duration | |||
return err | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k8s.io/kubernetes/pkg/controller source code.
// FilterActivePods returns pods that have not terminated.
func FilterActivePods(pods []*v1.Pod) []*v1.Pod {
var result []*v1.Pod
for _, p := range pods {
if IsPodActive(p) {
result = append(result, p)
} else {
klog.V(4).Infof("Ignoring inactive pod %v/%v in state %v, deletion time %v",
p.Namespace, p.Name, p.Status.Phase, p.DeletionTimestamp)
}
}
return result
}
func IsPodActive(p *v1.Pod) bool {
return v1.PodSucceeded != p.Status.Phase &&
v1.PodFailed != p.Status.Phase &&
p.DeletionTimestamp == nil
}
🤔 CI... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @tanjunchen
isPodActive := func(p *v1.Pod) bool { | ||
return v1.PodSucceeded != p.Status.Phase && | ||
v1.PodFailed != p.Status.Phase && | ||
p.DeletionTimestamp == nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave this one as a separate function.
It is handy and it is used in some other e2e tests.
So we can get this framework onto staging and add another utility function to the e2epod pkg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
@@ -175,6 +175,26 @@ func waitForPodsInactive(ps *testutils.PodStore, interval, timeout time.Duration | |||
return err | |||
} | |||
|
|||
// filterActivePods returns pods that have not terminated. | |||
func filterActivePods(pods []*v1.Pod) []*v1.Pod { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function seems to only be used (in k/k/test) here.
Though given the name and the fact that it uses IsPodActive()
(which would definitely fit in into the e2epod pkg), I wonder whether we should keep it here, e2eresource, or move it over to e2epod.
I vote for e2epod just based on the sort of logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for e2epod 😄
/retest |
/test pull-kubernetes-e2e-gce-100-performance |
/cc @alejandrox1 |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: oomichi, tanjunchen 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
ref:#74352
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: