-
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
🌱 Deprecate obsolete errors pkg #10798
🌱 Deprecate obsolete errors pkg #10798
Conversation
0b6a1c2
to
c22f1e1
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
LGTM label has been added. Git tree hash: 175a6cc5d9ea0c04b43946305ac3f18b0d933267
|
Am I wrong or MachineError is still used in the machine controller? |
I can't find any cluster-api/api/v1beta1/machine_types.go Line 173 in ada2764
We also use the InvalidConfigurationMachineError wrapper here
These are known importers https://pkg.go.dev/sigs.k8s.io/cluster-api/errors?tab=importedby. I think we can keep MachineStatusError type and deprecate and drop all the others unused wrappers and funcs. Or still deprecate MachineStatusError as well but don't drop it until next api bump reconsideration. |
Double checked this and you are correct. |
/area util (note, no rush at all to get this into the 1.8 release) |
c22f1e1
to
84eeccb
Compare
rebased now cc @fabriziopandini |
@@ -33,3 +33,4 @@ maintainers of providers and consumers of our Go API. | |||
- To support Kubernetes 1.31, providers should stop setting caBundle to invalid values in there CRDs (see core CAPI PR: https://github.com/kubernetes-sigs/cluster-api/pull/10972) | |||
Setting caBundle to `Cg==` is a pattern that is widely spread across the ecosystem but it will stop working with Kubernetes 1.31. | |||
Please see the following Slack thread for details: https://kubernetes.slack.com/archives/C0EG7JC6T/p1722441161968339 | |||
- The Errors package [has been deprecated in v1.8](https://github.com/kubernetes-sigs/cluster-api/issues/10784). It's recommented to remove any usage of the currently exported variables. |
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 should go in migrations/v1.9-to-v1.9.md now 😅
84eeccb
to
0bd4482
Compare
Thanks Fabrizio, updated the doc. |
|
||
### Suggested changes for providers | ||
|
||
- The Errors package [has been deprecated in v1.8](https://github.com/kubernetes-sigs/cluster-api/issues/10784). It's recommented to remove any usage of the currently exported variables. |
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 it would be good to provide some more context.
If I understand this correctly we are basically deprecating and eventually removing the types used for FailureReason.
This means that providers have to stop using them in their API types and instead use conditions correct? (can we give them some more details what they should do instead & that the concept of "terminal failure" will go away)
(a deprecation without some hints about what to do instead is just not ideal)
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.
Updated! Let me know if that works.
0bd4482
to
0705559
Compare
|
||
### Suggested changes for providers | ||
|
||
- The Errors package was created when capi provider implementation was running as machineActuators that needed to vendor core capi to function. There is no usage recommendations today and its value is questionable since we moved to CRDs that inter-operate mostly via conditions. Instead we plan to drop the dedicated semantic for terminal failure and keep improving Machine lifecycle signal through conditions. Therefore the Errors package [has been deprecated in v1.8](https://github.com/kubernetes-sigs/cluster-api/issues/10784). It's recommented to remove any usage of the currently exported variables. |
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.
The Errors package was created when capi provider implementation was running as machineActuators that needed to vendor core capi to function. There is no usage recommendations today
Just to avoid misunderstandings (and to ensure we're talking about the same thing)
MachineStatusError & ClusterStatusError are types used in our API and they are both used to read the corresponding fields from InfrastructureCluster & InfrastructureMachine (e.g.:
cluster-api/internal/controllers/machine/machine_controller_phases.go
Lines 105 to 111 in 4714c48
failureReason, failureMessage, err := external.FailuresFrom(obj) | |
if err != nil { | |
return external.ReconcileOutput{}, err | |
} | |
if failureReason != "" { | |
machineStatusError := capierrors.MachineStatusError(failureReason) | |
m.Status.FailureReason = &machineStatusError |
So as of right now, they are even part of our contract (vs. "no usage recommendation").
But this will be deprecated with #10897 and then removed with v1beta2.
Correct?
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.
(cc @fabriziopandini)
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.
That's what I'm proposing yes. The whole package mostly got obsolete and unused when we move to CRDs, conditions and continuous reconciliation flow vs create/update. An even more as we move towards dropping existing terminal failure signal in favour of fleshed out conditions now.
If we need to have specific machine error types for v1beta2 I think we should redefine then when the time comes, but those will most likely come as conditions reasons. My intent with this PR is mainly to avoid confusion and perpetuating a dead end pattern e.g. https://github.com/kubernetes-sigs/cluster-api/pull/10360/files
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.
Sounds 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.
+1
/lgtm |
LGTM label has been added. Git tree hash: dba0e84689985dacf194c6f09e86dbe07d5c1be9
|
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini 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 |
/test pull-cluster-api-verify-main |
@enxebre not 100% why the job is failing, might be the PR needs a rebase 🤔 |
It needs a fix for: |
0705559
to
b6f5f10
Compare
The /errors package has its origin in when capi providers were machineActuators that needed to vendor core capi to function. There's no usage recommendations and value is questionable since we moved to CRDs and conditions for interoperability between core and providers. I think we should deprecate it and if there's any use case relying on it we should support it via conditions
b6f5f10
to
bc87d3d
Compare
Thx! |
LGTM label has been added. Git tree hash: 131f2a9865480ad313c3b9e1c04f950ecc53717e
|
The /errors package has its origin in when capi providers were machineActuators that needed to vendor core capi to function. There's no usage recommendations and value is questionable since we moved to CRDs and conditions for interoperability between core and providers. I think we should deprecate it and if there's any use case relying on it we should support it via conditions
What this PR does / why we need it:
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 #10784