Skip to content

Commit ce87310

Browse files
committed
Import deprecated but needed errors constants from CAPI
Context: kubernetes-sigs/cluster-api#10784 We'll maintain them here for the time being, until we have conditions replacing these errors.
1 parent 5fd2c80 commit ce87310

24 files changed

+124
-108
lines changed

api/v1alpha6/openstackcluster_types.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ package v1alpha6
1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
22-
capierrors "sigs.k8s.io/cluster-api/errors"
22+
23+
capoerrors "sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors"
2324
)
2425

2526
const (
@@ -190,7 +191,7 @@ type OpenStackClusterStatus struct {
190191
// OpenStackClusters can be added as events to the OpenStackCluster object
191192
// and/or logged in the controller's output.
192193
// +optional
193-
FailureReason *capierrors.ClusterStatusError `json:"failureReason,omitempty"`
194+
FailureReason *capoerrors.DeprecatedCAPIClusterStatusError `json:"failureReason,omitempty"`
194195

195196
// FailureMessage will be set in the event that there is a terminal problem
196197
// reconciling the OpenStackCluster and will contain a more verbose string suitable

api/v1alpha6/openstackmachine_types.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/utils/ptr"
2323
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
24-
"sigs.k8s.io/cluster-api/errors"
24+
25+
capoerrors "sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors"
2526
)
2627

2728
const (
@@ -118,7 +119,7 @@ type OpenStackMachineStatus struct {
118119
// +optional
119120
InstanceState *InstanceState `json:"instanceState,omitempty"`
120121

121-
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
122+
FailureReason *capoerrors.DeprecatedCAPIMachineStatusError `json:"failureReason,omitempty"`
122123

123124
// FailureMessage will be set in the event that there is a terminal problem
124125
// reconciling the Machine and will contain a more verbose string suitable
@@ -189,7 +190,7 @@ func (r *OpenStackMachine) SetConditions(conditions clusterv1.Conditions) {
189190
}
190191

191192
// SetFailure sets the OpenStackMachine status failure reason and failure message.
192-
func (r *OpenStackMachine) SetFailure(failureReason errors.MachineStatusError, failureMessage error) {
193+
func (r *OpenStackMachine) SetFailure(failureReason capoerrors.DeprecatedCAPIMachineStatusError, failureMessage error) {
193194
r.Status.FailureReason = &failureReason
194195
r.Status.FailureMessage = ptr.To(failureMessage.Error())
195196
}

api/v1alpha6/zz_generated.conversion.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha6/zz_generated.deepcopy.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha7/openstackcluster_types.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ package v1alpha7
1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
22-
capierrors "sigs.k8s.io/cluster-api/errors"
22+
23+
capoerrors "sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors"
2324
)
2425

2526
const (
@@ -207,7 +208,7 @@ type OpenStackClusterStatus struct {
207208
// OpenStackClusters can be added as events to the OpenStackCluster object
208209
// and/or logged in the controller's output.
209210
// +optional
210-
FailureReason *capierrors.ClusterStatusError `json:"failureReason,omitempty"`
211+
FailureReason *capoerrors.DeprecatedCAPIClusterStatusError `json:"failureReason,omitempty"`
211212

212213
// FailureMessage will be set in the event that there is a terminal problem
213214
// reconciling the OpenStackCluster and will contain a more verbose string suitable

api/v1alpha7/openstackmachine_types.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/utils/ptr"
2323
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
24-
"sigs.k8s.io/cluster-api/errors"
24+
25+
capoerrors "sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors"
2526
)
2627

2728
const (
@@ -118,7 +119,7 @@ type OpenStackMachineStatus struct {
118119
// +optional
119120
InstanceState *InstanceState `json:"instanceState,omitempty"`
120121

121-
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
122+
FailureReason *capoerrors.DeprecatedCAPIMachineStatusError `json:"failureReason,omitempty"`
122123

123124
// FailureMessage will be set in the event that there is a terminal problem
124125
// reconciling the Machine and will contain a more verbose string suitable
@@ -187,7 +188,7 @@ func (r *OpenStackMachine) SetConditions(conditions clusterv1.Conditions) {
187188
}
188189

189190
// SetFailure sets the OpenStackMachine status failure reason and failure message.
190-
func (r *OpenStackMachine) SetFailure(failureReason errors.MachineStatusError, failureMessage error) {
191+
func (r *OpenStackMachine) SetFailure(failureReason capoerrors.DeprecatedCAPIMachineStatusError, failureMessage error) {
191192
r.Status.FailureReason = &failureReason
192193
r.Status.FailureMessage = ptr.To(failureMessage.Error())
193194
}

api/v1alpha7/zz_generated.conversion.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha7/zz_generated.deepcopy.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/openstackcluster_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ package v1beta1
1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
22-
capierrors "sigs.k8s.io/cluster-api/errors"
2322

23+
capoerrors "sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors"
2424
"sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/optional"
2525
)
2626

@@ -258,7 +258,7 @@ type OpenStackClusterStatus struct {
258258
// OpenStackClusters can be added as events to the OpenStackCluster object
259259
// and/or logged in the controller's output.
260260
// +optional
261-
FailureReason *capierrors.ClusterStatusError `json:"failureReason,omitempty"`
261+
FailureReason *capoerrors.DeprecatedCAPIClusterStatusError `json:"failureReason,omitempty"`
262262

263263
// FailureMessage will be set in the event that there is a terminal problem
264264
// reconciling the OpenStackCluster and will contain a more verbose string suitable

api/v1beta1/openstackmachine_types.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/utils/ptr"
2323
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
24-
"sigs.k8s.io/cluster-api/errors"
2524

25+
capoerrors "sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/errors"
2626
"sigs.k8s.io/cluster-api-provider-openstack/pkg/utils/optional"
2727
)
2828

@@ -211,7 +211,7 @@ type OpenStackMachineStatus struct {
211211
// +optional
212212
Resources *MachineResources `json:"resources,omitempty"`
213213

214-
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
214+
FailureReason *capoerrors.DeprecatedCAPIMachineStatusError `json:"failureReason,omitempty"`
215215

216216
// FailureMessage will be set in the event that there is a terminal problem
217217
// reconciling the Machine and will contain a more verbose string suitable
@@ -276,7 +276,7 @@ func (r *OpenStackMachine) SetConditions(conditions clusterv1.Conditions) {
276276
}
277277

278278
// SetFailure sets the OpenStackMachine status failure reason and failure message.
279-
func (r *OpenStackMachine) SetFailure(failureReason errors.MachineStatusError, failureMessage error) {
279+
func (r *OpenStackMachine) SetFailure(failureReason capoerrors.DeprecatedCAPIMachineStatusError, failureMessage error) {
280280
r.Status.FailureReason = &failureReason
281281
r.Status.FailureMessage = ptr.To(failureMessage.Error())
282282
}

api/v1beta1/zz_generated.deepcopy.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controllers/openstackcluster_controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
"k8s.io/client-go/tools/record"
3434
"k8s.io/utils/ptr"
3535
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
36-
capierrors "sigs.k8s.io/cluster-api/errors"
3736
"sigs.k8s.io/cluster-api/util"
3837
"sigs.k8s.io/cluster-api/util/annotations"
3938
"sigs.k8s.io/cluster-api/util/collections"
@@ -886,7 +885,7 @@ func (r *OpenStackClusterReconciler) SetupWithManager(ctx context.Context, mgr c
886885

887886
func handleUpdateOSCError(openstackCluster *infrav1.OpenStackCluster, message error, isFatal bool) {
888887
if isFatal {
889-
err := capierrors.UpdateClusterError
888+
err := capoerrors.DeprecatedCAPOUpdateClusterError
890889
openstackCluster.Status.FailureReason = &err
891890
openstackCluster.Status.FailureMessage = ptr.To(message.Error())
892891
}

0 commit comments

Comments
 (0)