-
Notifications
You must be signed in to change notification settings - Fork 1.3k
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Move error variables out of utils package #5356
Comments
/kind cleanup |
These seems only used or returned within that package, should we consider instead moving the functions using them to a different package instead? |
/milestone Next |
These do seem to be used - ErrNoCluster in kubeadmconfig_controller.go and ErrUnstructuredFieldNotFound in cluster_controller_phases.go. If they were just used in package I'd say keep them, but it looks like they're being used as importable error messages which says to me they belong in errors. |
Are they used for error checking outside of util? |
|
hey can I try this issue out , I am new here , this is my approach Lines 56 to 62 in 573f005
to the error package here -> https://github.com/kubernetes-sigs/cluster-api/blob/58905fb5140a7844c3e24aa70d255fb8f9d0c491/errors/consts.go then replace the util.ErrNoCluster and similar errors with the errors package ones does this sound appropriate |
@DiptoChakrabarty That sounds right - it's important to not remove the original variables from the utils package and instead add a deprecation message so we can remove the errors with the next breaking changes to Cluster API. So:
|
Hey I have done just like that with a bit of changes since importing the clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" causes an import cycle and I noticed that the error names are defined here https://github.com/kubernetes-sigs/cluster-api/blob/main/errors/consts.go and the errors are configured here https://github.com/kubernetes-sigs/cluster-api/blob/main/errors/clusters.go so I made particular functions for these two util errors |
There's a couple of problems with this approach as it looks out of the scope of the current errors package. Currently the errors package covers mostly status conditions whereas these are closer to client errors. Should we expand the overall usage of the errors package to include client errors like ClusterNotFound? These are commonly used and compared errors across the code base, but there's unwanted constraints we could possibly introduce by trying to implement them all in one format. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
@killianmuldoon @DiptoChakrabarty Is it ok to close this issue and the related PR based on #5419 (comment)? |
I'm fine with that given there's no agreed way to move those errors right now. |
👍 |
@vincepri: Closing this issue. 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. |
Detailed Description
There are a few errors defined in the top level utils package that are better placed in the top level errors package. These errors should be deprecated and recreated in the errors package. The util errors should then be removed in a coming release.
Examples:
cluster-api/util/util.go
Line 58 in 573f005
cluster-api/util/util.go
Line 62 in 573f005
/kind cleanup
The text was updated successfully, but these errors were encountered: