-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Refactored framework deployment utils #77373
Refactored framework deployment utils #77373
Conversation
7dd6ccc
to
383a3a3
Compare
ptal 🙂 |
/priority backlog |
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.
/approve
i think this is fine.
something i've noticed in the other similar PR is that we are naming the imports deployment
instead of frameworkdeployment
. did someone say that frameworkdeployment
is the preferred pattern?
I did chose it rather arbitrarily; I wanted to avoid any name collision and make it more explicit. Question: if we went for |
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.
change imports
383a3a3
to
8ba1a96
Compare
8ba1a96
to
87371fe
Compare
Changed imports from |
87371fe
to
a12de05
Compare
Fixed conflicts in |
@@ -0,0 +1,75 @@ | |||
/* |
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.
I would prefer to collapse the files in here with util.go
(I also don't love util.go
as a name but that can probably be done in a follow-up PR) because aside from the fact that the methods here are just wrappers for testutils
, the methods are still similar to what's in util.go
. What do you think?
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.
That makes sense. Would it be better to separate the file into public and private functions?
and change the file names to helpers.go
and deployment.go
?
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.
Which methods are private?
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.
Made the changes on the latest commit to see it better.
The couple functions in helpers.go
are not used anywhere outside of framework/deployment
.
logReplicaSetsOfDeployment
and logPodsOfDeployment
are private, while MakeDeployment
is not used outside of the package.
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.
hmm 🤔. I'd like to avoid files like helper.go
that become a dumping ground for generic functions in the package. How about we put all the create/update deployment functions in fixtures.go
(including MakeDeployment) and all the Wait*
methods in wait.go
? The log methods can go in the same file as the callers. What do you think?
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.
I like that idea. et me give it a try
a12de05
to
01dcc22
Compare
@@ -1,5 +1,5 @@ | |||
/* | |||
Copyright 2017 The Kubernetes Authors. | |||
Copyright 2019 The Kubernetes Authors. |
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.
Don't update copy right date if you're moving a file :)
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.
Will keep in mind. thank you!
|
||
// MakeDeployment creates a deployment definition based on the namespace. The deployment references the PVC's | ||
// name. A slice of BASH commands can be supplied as args to be run by the pod | ||
func MakeDeployment(replicas int32, podLabels map[string]string, nodeSelector map[string]string, namespace string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) *apps.Deployment { |
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.
makeDeployment
if it's only called in this package. I think testDeployment
is a better name if you're willing to rename in this PR
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.
makes sense.
01dcc22
to
e0f0088
Compare
Gave it another try based on @andrewsykim's feedback |
e0f0088
to
234f425
Compare
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.
/approve
@andrewsykim for final lgtm.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alejandrox1, neolit123, timothysc 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 |
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.
minor comment re copyright :)
@@ -1,5 +1,5 @@ | |||
/* | |||
Copyright 2017 The Kubernetes Authors. | |||
Copyright 2019 The Kubernetes Authors. |
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.
2017 - you probably made a new file here but basing it off what is seen by git
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.
Changed it to "2017" for all files that have code straight from deployment_util.go.
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.
2019 only if it's a new file. If you're moving a file, keep the old copy right date
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.
Changed it to "2017" for all files that have code straight from deployment_util.go.
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.
fixed this
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, general rule (that I follow at least) is new files according to git should have the current year. Any file "renamed" should keep whatever date is already there
"time" | ||
) | ||
|
||
const ( |
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.
Don't think we need a new file for holding unexported functions, what do you think about just putting these in wait.go
?
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.
Have a point there. I wanted to make it clear that the constants are used throughout the pkg but it does look good with wait.go and no "outsider" should notice it.
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.
Yeah, I see the original intent though since it was called in both files
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.
and fixed this
dab82ec
to
ab36908
Compare
@@ -0,0 +1,119 @@ | |||
/* | |||
Copyright 2017 The Kubernetes Authors. |
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.
last nit: 2019, cause new file :)
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.
fixed.
I think I got you mean now. It's not necessarily that the code came from a file that already existed but how Git sees it. i.e., fixtures.go is a new version of deployment_utils.go but wait.go is a new file from Git's point of view?
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.
yes! you can use git mv
to control this better if you want
This is the continuation of the refactoring of framework/deployment_utils.go into framework/deployment. Signed-off-by: Jorge Alarcon Ochoa <alarcj137@gmail.com>
ab36908
to
dc61906
Compare
/lgtm Thanks @alejandrox1! |
/retest |
This is the continuation of the refactoring of framework/deployment_utils.go
into framework/deployment.
Signed-off-by: Jorge Alarcon Ochoa alarcj137@gmail.com
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This is a refactoring of
framework/deployment_utils.go
intoframework/deployment
.Which issue(s) this PR fixes:
Part of #76206
Special notes for your reviewer:
This is a continuation of #76978
Does this PR introduce a user-facing change?:
/area e2e-test-framework
/area test
/sig testing