-
Notifications
You must be signed in to change notification settings - Fork 2k
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
refactor: move discovery and util under package app/customresource to make packages highly cohesive #2104
refactor: move discovery and util under package app/customresource to make packages highly cohesive #2104
Conversation
6972a72
to
7ff1ff4
Compare
5450836
to
18f03c1
Compare
Ready for reviewing~ |
) | ||
|
||
var config *rest.Config | ||
var currentKubeClient clientset.Interface | ||
var currentDiscoveryClient *discovery.DiscoveryClient | ||
var currentDynamicClient *dynamic.DynamicClient | ||
|
||
// CreateKubeClient creates a Kubernetes clientset and a custom resource clientset. | ||
func CreateKubeClient(apiserver string, kubeconfig string) (clientset.Interface, error) { |
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'm not quite sure why this was moved out?
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.
Remove this dependency
v2/pkg/util
└──v2/pkg/customresource
util should be independent with customresource.
c721bf0
to
b6a8e0d
Compare
/hold I find it still has these newly added dependencies. Will try to remove these as well.
|
e6a46fe
to
ab98c78
Compare
ea97350
to
e67b6c8
Compare
/unhold Current godepgraph is
Before: #2103 |
Sorry for the delay here, I got caught up, will review before end of the day. 🙂 |
@@ -15,93 +15,22 @@ package discovery | |||
|
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.
Can we move the entire discovery package (what's left of it in internal/discovery
under pkg/app
as well)? It would make sense to have the types for discovery in the same place as the logic.
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 would also help clean up the same import from app/discovery.go
and app/discovery_test.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.
If moving entire discovery package, v2/pkg/customresourcestate will depend on all packages where internal/discovery depends on.
This is shown in #2103
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.
ACK, can we move the discovery
types inside pkg/app
to it's own package (could be types
, which would contain all such exported types for the app
package, since discovery
comes under that now)?
EDIT: It seems moving them under pkg
would make more sense, since these are used in areas other than just pkg/app
.
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.
discovery.go and internal/discovery/types.go should be in different packages. Because customresourcestate depends on internal/discovery/types.go and discovery.go depends on many other pkgs.
Does can we move the discovery types inside pkg/app to it's own package
mean moving internal/discovery/types.go under types
and discovery.go under app
?
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.
My bad, it seems the discovery
types are not used in internal
, so moving these types within a types
package in pkg
is a valid alternative, in case we do not want to have a root-level types
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.
I'm not sure if it's worth reorganizing when we want to change the way customresource metrics are created at the same time, so I don't have a strong opinion here.
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.
ACK. In that case I think we can proceed with a types
package within pkg
that encapsulates all types used throughout pkg
, instead of a root-level types
package. This would ensure relevant types live close to their logic, while providing a degree of desired isolation away from the package the logic is present under.
@CatherineF-dev Does this sound good?
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.
QQ: what's the package name for types.go? pkg or types.
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.
types
should suffice I believe.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: CatherineF-dev The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
use interface to decouple customresourcestate and CRDiscoverer
Update pkg/app/discovery.go Co-authored-by: Pranshu Srivastava <[email protected]> Update internal/discovery/types.go Co-authored-by: Pranshu Srivastava <[email protected]> Update internal/discovery/types.go Co-authored-by: Pranshu Srivastava <[email protected]> Update pkg/customresourcestate/config.go Co-authored-by: Pranshu Srivastava <[email protected]> Update pkg/customresourcestate/config.go Co-authored-by: Pranshu Srivastava <[email protected]>
2bbd48e
to
e134ac9
Compare
b41d1ff
to
1ff59e3
Compare
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. 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. |
What this PR does / why we need it:
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2103