-
Notifications
You must be signed in to change notification settings - Fork 532
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
bugfix about update occupied in podGroup status #360
Conversation
Welcome @NoicFank! |
Hi @NoicFank. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
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.
Thanks @NoicFank
Some comments for you.
pkg/controller/podgroup_test.go
Outdated
if err != nil { | ||
return false, err | ||
} | ||
if pg.Status.OccupiedBy != c.desiredGroupOccupied { |
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.
We can change desiredGroupOccupied
to []string
and compare them by cmp.Diff
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.
the type of pg.Status.OccupiedBy
is string
, thus cmp.Diff
works? as we change desiredGroupOccupied
to []string
.
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.
O.. I forget the OccupiedBy is string....
pkg/controller/podgroup_test.go
Outdated
pg := makePG(c.pgName, c.minMember, c.groupPhase, nil) | ||
pgClient := pgfake.NewSimpleClientset(pg) | ||
|
||
informerFactory := informers.NewSharedInformerFactory(kubeClient, controller.NoResyncPeriodFunc()) | ||
pgInformerFactory := schedinformer.NewSharedInformerFactory(pgClient, controller.NoResyncPeriodFunc()) | ||
podInformer := informerFactory.Core().V1().Pods() | ||
pgInformer := pgInformerFactory.Scheduling().V1alpha1().PodGroups() | ||
ctrl := NewPodGroupController(kubeClient, pgInformer, podInformer, pgClient) |
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 part of the code has a lot of duplication with another test.
It's better to define a separate function for setup env for test
.
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.
done. another one bug founded:
it should be desiredGroupPhase: v1alpha1.PodGroupPending
in the case "Group min member more than Pod number"
from test Test_Run
.
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.
It's better to define a separate function for setup env for test.
We can leave it to the kubebuilder migration. (@helayoty is working on using kubebuilder and envtest to migrate existing controller-related code).
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.
We can leave it to the kubebuilder migration.
Sure
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.
tagging the kubebuilder issue here so I remember to handle that #327
pkg/controller/podgroup_test.go
Outdated
pds := make([]*v1.Pod, 0) | ||
for _, name := range podNames { | ||
pod := st.MakePod().Namespace("default").Name(name).Obj() | ||
pod.Labels = map[string]string{v1alpha1.PodGroupLabel: pgName} | ||
pod.Status.Phase = phase | ||
if reference != 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.
if reference != nil { | |
if reference != nil && len(reference) != 0 { |
pkg/controller/podgroup_test.go
Outdated
desiredGroupOccupied string | ||
}{ | ||
{ | ||
name: "fill the desired Occupied", |
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.
fill the Occupied of PodGroup with a single ownerReference?
pkg/controller/podgroup_test.go
Outdated
desiredGroupOccupied: "default/new-occupied", | ||
}, | ||
{ | ||
name: "fill the desired Occupied, with multi ownerReference", |
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.
fill the Occupied of PodGroup with multi ownerReferences ?
63e008a
to
e1f6706
Compare
@denkensk thanks for reviews. its updated, PTAL. |
/lgtm Thanks. @NoicFank |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: denkensk, NoicFank 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 bug
What this PR does / why we need it:
currently, The updated information about occupied is edited locally rather than updated into apiserver. See the test
TestFillGroupStatusOccupied
for details.Which issue(s) this PR fixes:
Fixes #
NONE
Special notes for your reviewer: