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

Remove scaffolding fields that were not used #1219

Conversation

Adirio
Copy link
Contributor

@Adirio Adirio commented Nov 23, 2019

Removes some fields that File structs had but are not being used.

This PR is part of a bigger change tracked in #1218 but can be applied rightaway.

/kind cleanup

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 23, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @Adirio. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 23, 2019
&webhook.Server{Resource: o.res, Config: webhook.Config{Server: o.server, Type: o.webhookType, Operations: o.operations}},
&webhook.AddServer{Resource: o.res, Config: webhook.Config{Server: o.server, Type: o.webhookType, Operations: o.operations}},
&webhook.Server{Config: webhook.Config{Server: o.server, Type: o.webhookType, Operations: o.operations}},
&webhook.AddServer{Config: webhook.Config{Server: o.server, Type: o.webhookType, Operations: o.operations}},
)
Copy link
Member

Choose a reason for hiding this comment

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

The v1 is deprecated then I am not sure if we should do refractories on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did the changes project-wide. Removing all fields that were not used. As I am not changing any functionality, I don't think v1 being deprecated should be a stopper.

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Following my review:

Regards v1

The v1 is deprecated then I am not sure if we should do refractories on it. So, I'd probably recommend revert it but I will let this to team members decide.

Regards v2

I could check that the golden is using a group domain with . (see here)and the integration test is checking the webhooks (see here).

The changes show fine 👍

@mengqiy @pwittrock could we move with this one? WDYT?

@camilamacedo86
Copy link
Member

/assign @pwittrock

@camilamacedo86
Copy link
Member

/assign @camilamacedo86

Signed-off-by: Adrian Orive <adrian.orive.oneca@gmail.com>
@Adirio Adirio force-pushed the scaffold-enhancement/remove-fields branch from 8c42e7e to 99f5668 Compare November 26, 2019 10:13
@Adirio
Copy link
Contributor Author

Adirio commented Nov 26, 2019

Rebased (no changes)

@DirectXMan12
Copy link
Contributor

/lgtm
/approve

code cleanups to v1 are fine-ish. I think this isn't a big deal.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 6, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Adirio, DirectXMan12

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 6, 2019
@k8s-ci-robot k8s-ci-robot merged commit 3ec07ea into kubernetes-sigs:master Dec 6, 2019
@Adirio Adirio deleted the scaffold-enhancement/remove-fields branch December 9, 2019 10:34

ctrlImportCodeFragment := fmt.Sprintf(`"%s/controllers"
`, a.Repo)
apiImportCodeFragment := fmt.Sprintf(`%s%s "%s/%s"
`, a.Resource.GroupImportSafe, a.Resource.Version, a.ResourcePackage, a.Resource.Version)
`, a.Resource.GroupImportSafe, a.Resource.Version, resourcePackage, a.Resource.Version)

Copy link
Member

@camilamacedo86 camilamacedo86 Jan 7, 2020

Choose a reason for hiding this comment

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

The a.ResourcePackage is used in this case.
You are replacing the attribute of the struct for the usage of local var instead of.
IMO, the previous code has a better approach and follows the same impl of conttroller.go as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has already been merged. We do not need that field in the struct. The struct represents a file object. The file does not require the ResourcePackage field for anything. When updating this file we do need it, so we compute it locally there. This was applied to all the files. Every field that is not needed for the file has been removed. controller.go does need it for the file (you can make a search for .ResourcePackage in the template to see where it is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants