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

🐛 replace pkg/runtime/log for pkg/log in just the v2 scaffolding. #1326

Merged
merged 1 commit into from
Jan 17, 2020

Conversation

camilamacedo86
Copy link
Member

Closes: #1269

@camilamacedo86
Copy link
Member Author

camilamacedo86 commented Jan 17, 2020

/assign @mengqiy

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 17, 2020
@@ -96,7 +96,7 @@ package {{ .Resource.Version }}

import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
logf "sigs.k8s.io/controller-runtime/pkg/log"
Copy link
Member Author

Choose a reason for hiding this comment

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

@mengqiy done 👍

Copy link
Member

@mengqiy mengqiy left a comment

Choose a reason for hiding this comment

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

Besides pkg/scaffold/v2/webhook/webhook.go, there are 3 more places need to be change:

  • pkg/scaffold/v1/controller/controller.go
  • pkg/scaffold/v1/manager/cmd.go
  • pkg/scaffold/v1/webhook/server.go
    Though they are for v1 project, but the idea is to not generating something using an deprecated package.

@camilamacedo86
Copy link
Member Author

Oks, I will do that @mengqiy. I thought that we should not do it for v1.

@mengqiy
Copy link
Member

mengqiy commented Jan 17, 2020

I thought that we should not do it for v1.

It should be very low risk doing that, since (1) the the deprecated package redirect to the new package. (2) Not many users use v1 any more.

The point here is mostly that we should not scaffold project using a deprecated package, which causing it doesn't pass staticcheck linter.

@camilamacedo86
Copy link
Member Author

camilamacedo86 commented Jan 17, 2020

Hi @mengqiy

It should be very low risk doing that, since (1) the the deprecated package redirect to the new package. (2) Not many users use v1 any more.

The point here is mostly that we should not scaffold project using a deprecated package, which causing it doesn't pass staticcheck linter.

My comment was because of:

Screenshot 2020-01-17 at 19 42 47

Also, see that after this PR be merged any V2 project will NOT be scaffolded with the deprecated lib. So, if the user is using the lint it should pass in the test/check

Regards:

Besides pkg/scaffold/v2/webhook/webhook.go, there are 3 more places need to be change:

pkg/scaffold/v1/controller/controller.go
pkg/scaffold/v1/manager/cmd.go
pkg/scaffold/v1/webhook/server.go
Though they are for v1 project, but the idea is to not generating something using a deprecated package.

I do not think that it will be possible. The V1 is using the vendor and other versions. So, for the version used in V1, the lib is not deprecated and the new implementation is not available.

Screenshot 2020-01-17 at 19 56 25

[[projects]]
  digest = "1:fbd9138a454764d4037f8edeb7bdea3f4ef4ad24b672a52cceff2a9609aacf91"
  name = "sigs.k8s.io/controller-runtime"
  packages = [
    "pkg/cache",
    "pkg/cache/internal",
    "pkg/client",
    "pkg/client/apiutil",
    "pkg/client/config",
    "pkg/controller",
    "pkg/event",
    "pkg/handler",
    "pkg/internal/controller",
    "pkg/internal/controller/metrics",
    "pkg/internal/objectutil",
    "pkg/internal/recorder",
    "pkg/leaderelection",
    "pkg/manager",
    "pkg/metrics",
    "pkg/patch",
    "pkg/predicate",
    "pkg/reconcile",
    "pkg/recorder",
    "pkg/runtime/inject",
    "pkg/runtime/log",
    "pkg/runtime/signals",
    "pkg/source",
    "pkg/source/internal",
    "pkg/webhook/admission",
    "pkg/webhook/admission/types",
    "pkg/webhook/internal/metrics",
    "pkg/webhook/types",
  ]
  pruneopts = "T"
  revision = "f1eaba5087d69cebb154c6a48193e6667f5b512c"
  version = "v0.1.12"

See that in V2 we are using an upper version:

go 1.13

require (
	github.com/go-logr/logr v0.1.0
	github.com/onsi/ginkgo v1.8.0
	github.com/onsi/gomega v1.5.0
	k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655
	k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90
	sigs.k8s.io/controller-runtime v0.4.0
)

This changed was made/introduced in the version v0.2.0-alpha.0. See the PR: kubernetes-sigs/controller-runtime#290.

Please, let me know if it makes sense and if has anything else that you would like to get done for we close this one.

@mengqiy
Copy link
Member

mengqiy commented Jan 17, 2020

You are right!
Just checked what we scaffold for v1, V1 scaffolding is using controller-runtime v0.1.8, which is not a problem here. Because the log package moving and old path deprecation happened in v0.2.0+.

@mengqiy mengqiy changed the title replace pkg/runtime/log for pkg/log in just the v2 scaffolding. 🐛 replace pkg/runtime/log for pkg/log in just the v2 scaffolding. Jan 17, 2020
@mengqiy
Copy link
Member

mengqiy commented Jan 17, 2020

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, mengqiy

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 Jan 17, 2020
@k8s-ci-robot k8s-ci-robot merged commit 52db7c3 into kubernetes-sigs:master Jan 17, 2020
@camilamacedo86 camilamacedo86 deleted the fix-issue branch January 17, 2020 20:35
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why two different log packages?
3 participants