Skip to content

Commit 0a86296

Browse files
committed
chore: refactored kcp api imports
On-behalf-of: SAP aleh.yarshou@sap.com
1 parent e0b7d1e commit 0a86296

11 files changed

+144
-144
lines changed

cmd/operator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
// to ensure that exec-entrypoint and run can make use of them.
1111
"github.com/kcp-dev/logicalcluster/v3"
1212
"github.com/kcp-dev/multicluster-provider/apiexport"
13-
apisv1alpha1 "github.com/kcp-dev/sdk/apis/apis/v1alpha1"
13+
kcpapisv1alpha1 "github.com/kcp-dev/sdk/apis/apis/v1alpha1"
1414
kcpcorev1alpha1 "github.com/kcp-dev/sdk/apis/core/v1alpha1"
1515
openfgav1 "github.com/openfga/api/proto/openfga/v1"
1616
accountsv1alpha1 "github.com/platform-mesh/account-operator/api/v1alpha1"
@@ -220,7 +220,7 @@ func init() {
220220

221221
utilruntime.Must(kcptenancyv1alphav1.AddToScheme(scheme))
222222
utilruntime.Must(corev1alpha1.AddToScheme(scheme))
223-
utilruntime.Must(apisv1alpha1.AddToScheme(scheme))
223+
utilruntime.Must(kcpapisv1alpha1.AddToScheme(scheme))
224224
utilruntime.Must(kcpcorev1alpha1.AddToScheme(scheme))
225225
utilruntime.Must(accountsv1alpha1.AddToScheme(scheme))
226226
// +kubebuilder:scaffold:scheme

internal/controller/apibinding_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77

88
"github.com/kcp-dev/logicalcluster/v3"
9-
apisv1alpha1 "github.com/kcp-dev/sdk/apis/apis/v1alpha1"
9+
kcpapisv1alpha1 "github.com/kcp-dev/sdk/apis/apis/v1alpha1"
1010
platformeshconfig "github.com/platform-mesh/golang-commons/config"
1111
"github.com/platform-mesh/golang-commons/controller/lifecycle/builder"
1212
lifecyclesubroutine "github.com/platform-mesh/golang-commons/controller/lifecycle/subroutine"
@@ -76,9 +76,9 @@ type APIBindingReconciler struct {
7676

7777
func (r *APIBindingReconciler) Reconcile(ctx context.Context, req mcreconcile.Request) (ctrl.Result, error) {
7878
ctxWithCluster := mccontext.WithCluster(ctx, req.ClusterName)
79-
return r.mclifecycle.Reconcile(ctxWithCluster, req, &apisv1alpha1.APIBinding{})
79+
return r.mclifecycle.Reconcile(ctxWithCluster, req, &kcpapisv1alpha1.APIBinding{})
8080
}
8181

8282
func (r *APIBindingReconciler) SetupWithManager(mgr mcmanager.Manager, cfg *platformeshconfig.CommonServiceConfig, evp ...predicate.Predicate) error {
83-
return r.mclifecycle.SetupWithManager(mgr, cfg.MaxConcurrentReconciles, "apibinding-controller", &apisv1alpha1.APIBinding{}, cfg.DebugLabelValue, r, r.log, evp...)
83+
return r.mclifecycle.SetupWithManager(mgr, cfg.MaxConcurrentReconciles, "apibinding-controller", &kcpapisv1alpha1.APIBinding{}, cfg.DebugLabelValue, r, r.log, evp...)
8484
}

internal/subroutine/authorization_model_generation.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"text/template"
99

1010
"github.com/kcp-dev/logicalcluster/v3"
11-
kcpv1alpha1 "github.com/kcp-dev/sdk/apis/apis/v1alpha1"
11+
kcpapisv1alpha1 "github.com/kcp-dev/sdk/apis/apis/v1alpha1"
1212
accountv1alpha1 "github.com/platform-mesh/account-operator/api/v1alpha1"
1313
lifecyclecontrollerruntime "github.com/platform-mesh/golang-commons/controller/lifecycle/runtimeobject"
1414
lifecyclesubroutine "github.com/platform-mesh/golang-commons/controller/lifecycle/subroutine"
@@ -87,14 +87,14 @@ type modelInput struct {
8787
func (a *AuthorizationModelGenerationSubroutine) Finalize(ctx context.Context, instance lifecyclecontrollerruntime.RuntimeObject) (ctrl.Result, errors.OperatorError) {
8888
log := logger.LoadLoggerFromContext(ctx)
8989

90-
bindingToDelete := instance.(*kcpv1alpha1.APIBinding)
90+
bindingToDelete := instance.(*kcpapisv1alpha1.APIBinding)
9191

9292
bindingCluster, err := a.mgr.ClusterFromContext(ctx)
9393
if err != nil {
9494
return ctrl.Result{}, errors.NewOperatorError(fmt.Errorf("unable to get cluster from context: %w", err), true, false)
9595
}
9696

97-
var bindings kcpv1alpha1.APIBindingList
97+
var bindings kcpapisv1alpha1.APIBindingList
9898
err = a.allClient.List(ctx, &bindings)
9999
if err != nil {
100100
return ctrl.Result{}, errors.NewOperatorError(err, true, true)
@@ -149,15 +149,15 @@ func (a *AuthorizationModelGenerationSubroutine) Finalize(ctx context.Context, i
149149
}
150150
apiExportClient := apiExportCluster.GetClient()
151151

152-
var apiExport kcpv1alpha1.APIExport
152+
var apiExport kcpapisv1alpha1.APIExport
153153
err = apiExportClient.Get(ctx, types.NamespacedName{Name: bindingToDelete.Spec.Reference.Export.Name}, &apiExport)
154154
if err != nil {
155155
log.Error().Err(err).Msg("failed to get apiexport for binding deletion")
156156
return ctrl.Result{}, errors.NewOperatorError(err, true, true)
157157
}
158158

159159
for _, latestResourceSchema := range apiExport.Spec.LatestResourceSchemas {
160-
var resourceSchema kcpv1alpha1.APIResourceSchema
160+
var resourceSchema kcpapisv1alpha1.APIResourceSchema
161161
err := apiExportClient.Get(ctx, types.NamespacedName{Name: latestResourceSchema}, &resourceSchema)
162162
if err != nil {
163163
log.Error().Err(err).Msg("failed to get resource schema for binding deletion")
@@ -198,7 +198,7 @@ func (a *AuthorizationModelGenerationSubroutine) GetName() string {
198198

199199
// Process implements lifecycle.Subroutine.
200200
func (a *AuthorizationModelGenerationSubroutine) Process(ctx context.Context, instance lifecyclecontrollerruntime.RuntimeObject) (ctrl.Result, errors.OperatorError) {
201-
binding := instance.(*kcpv1alpha1.APIBinding)
201+
binding := instance.(*kcpapisv1alpha1.APIBinding)
202202

203203
cluster, err := a.mgr.ClusterFromContext(ctx)
204204
if err != nil {
@@ -225,14 +225,14 @@ func (a *AuthorizationModelGenerationSubroutine) Process(ctx context.Context, in
225225
return ctrl.Result{}, errors.NewOperatorError(err, true, true)
226226
}
227227

228-
var apiExport kcpv1alpha1.APIExport
228+
var apiExport kcpapisv1alpha1.APIExport
229229
err = apiExportCluster.GetClient().Get(ctx, types.NamespacedName{Name: binding.Spec.Reference.Export.Name}, &apiExport)
230230
if err != nil {
231231
return ctrl.Result{}, errors.NewOperatorError(err, true, true)
232232
}
233233

234234
for _, latestResourceSchema := range apiExport.Spec.LatestResourceSchemas {
235-
var resourceSchema kcpv1alpha1.APIResourceSchema
235+
var resourceSchema kcpapisv1alpha1.APIResourceSchema
236236
err := apiExportCluster.GetClient().Get(ctx, types.NamespacedName{Name: latestResourceSchema}, &resourceSchema)
237237
if err != nil {
238238
return ctrl.Result{}, errors.NewOperatorError(err, true, true)

0 commit comments

Comments
 (0)