-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Clean Code - Remove V1 implementation #1355
Clean Code - Remove V1 implementation #1355
Conversation
6fafcb9
to
b3c3950
Compare
/assing @droot |
I said this in several places but will say it here as its where it makes sense. I think we should not remove v1The code has received a huge refactor lately and v1-v2 separation is quite clear right now. Other commits such as #1348 or #1290 will help in this sense even more. I would just leave v1 as it is right now, change the deprecation warning to something like: "v1 has been completely deprecated since 1st of February, 2020, and will no longer receive any fix or update. Upgrading your projects to v2 is highly recommended. In the following link you can find a step-by-step guide on how to do it: URL". I would probably also prevent the initialization of new v1 projects. |
Hi @Adirio, Thank you for your input. Following my comments inline.
Your work was not envious. It was great and indeed allow us to continue the lifecycle doing more cleanups. And then, the work made in the V2 will still as the code that will allow us to create the V3 in the future, however, the V1 was already flagged for no longer be supported and as I said many times we should not change/update and/or care so much because we knew that at some point it would be removed. Why should we keep a code, tests, mocks, scripts, vendor and etc if they should no longer be used/updated/changed? Note that by removing the V1 we can:
So, IMO by removing all unnecessary V1 implementation it can simplify a lot. However, in POV we can keep the updated command to allow users are able to upgrade their projects to V2 @droot @mengqiy @DirectXMan12 WDYT? |
I'm not worried about my code dissapearing. 😄 The point I was trying to make is that the situation when it was decided that v1 should be deprecated (3 months ago) and now is quite different, so despite being deprecated we may not need to remove the code completely.
I do agree that we should remove the v1 tests from |
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.
There are 22 files deleted from testdata/package-v2*
and both go.mod
files which have three less lines. I think these removals are due to the make all test
removal I mention in one of my comments. Please readd that line and run generate_golden.sh again to see if they get removed in that case.
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.
Forgot about this two lines
b3c3950
to
47009c5
Compare
47009c5
to
0eb3eb8
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.
You are using this PR (removing v1) to introduce another completly different change (removing force
flag and enforcing the resource to be scaffolded if it doesn't exist. This needs to be done in another PR not here.
Aside from that, a few NITs.
cba7f97
to
17578da
Compare
This comment has been minimized.
This comment has been minimized.
@camilamacedo86: GitHub didn't allow me to assign the following users: diroot. Note that only kubernetes-sigs members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
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. |
17578da
to
f6ecbe2
Compare
8a7fb2e
to
f2fe2b1
Compare
@@ -20,7 +20,7 @@ import ( | |||
"sigs.k8s.io/kubebuilder/pkg/model" |
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 think we can fully remove the update
command right @mengqiy?
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.
Or at least remove it's logic and check updateCmd.HasSubCommands()
before adding it, like kubebuilder does with alpha
.
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 seems this file is no longer needed.
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 agree but IHMO we should remove the update command in a follow-up PR.
Then, if we need for any reason to do a revert will be easier.
The scope here is NOT to remove commands or deprecated args. The goal here is just clean up and remove the v1 code source.
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and | |||
limitations under the License. |
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 file should be removed.
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 is used in the update.
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.
See #1355 (comment).
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 agree that we could/should remove. After thinking about and checking it I just think that it should be better done in a follow-up PR. note that we need to check/change the docs and all places that are speaking about it. So, shows out of the scope. WDYT? Could we agree in to do it a follow-up PR?
6e8987d
to
0115566
Compare
d17db6b
to
51b539c
Compare
test/e2e/v3/e2e_suite.go
Outdated
@@ -67,7 +67,7 @@ var _ = Describe("kubebuilder", func() { | |||
err := kbc.Init( | |||
"--project-version", "3-alpha", | |||
"--domain", kbc.Domain, | |||
"--dep=false") | |||
"--fetch-deps=false") |
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 may miss something, but why do we switch to use the new flag? What's the motiviation?
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.
In some point, we received a suggestion to remove the deprecated flags. However, I revert this suggestion. It is not part of the scope of this PR. Here we are only removing the V1 code. So, good catcher. It is using dep again.
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.
Is —dep
not deprecated? It says so in code comments. Was this depreciation unrelated to the v2 change?
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 is deprecated but still valid for v2.
We can remove the flag for V3 since is deprecated and I think we should do that.
However, it shows not part of the scope of this one and then, I think that would be better we have a specific or for that.
f5855de
to
76c13b3
Compare
76c13b3
to
bcf261b
Compare
bcf261b
to
f276961
Compare
test/e2e/v2/e2e_suite.go
Outdated
@@ -65,7 +65,6 @@ var _ = Describe("kubebuilder", func() { | |||
var controllerPodName string | |||
By("init v2 project") | |||
err := kbc.Init( | |||
"--project-version", "2", |
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 is still necessary now that the default project version is 3-alpha
.
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.
Two nits then lgtm
pkg/model/config/project_type.go
Outdated
@@ -0,0 +1,12 @@ | |||
package config |
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.
Should be removed.
f276961
to
08861e7
Compare
08861e7
to
7bdcf98
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.
/lgtm
Description
Motivation