Skip to content

Commit

Permalink
fix issues reported by linter
Browse files Browse the repository at this point in the history
  • Loading branch information
m00g3n committed May 8, 2024
1 parent 3c23b68 commit 5da8f5f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
12 changes: 4 additions & 8 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ import (

"github.com/gardener/gardener/pkg/apis/core/v1beta1"
gardener_apis "github.com/gardener/gardener/pkg/client/core/clientset/versioned/typed/core/v1beta1"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"

infrastructuremanagerv1 "github.com/kyma-project/infrastructure-manager/api/v1"
"github.com/kyma-project/infrastructure-manager/internal/controller"
"github.com/kyma-project/infrastructure-manager/internal/controller/metrics"
"github.com/kyma-project/infrastructure-manager/internal/gardener"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
16 changes: 2 additions & 14 deletions internal/controller/runtime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ package controller
import (
"context"

infrastructuremanagerv1 "github.com/kyma-project/infrastructure-manager/api/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"

infrastructuremanagerv1 "github.com/kyma-project/infrastructure-manager/api/v1"
)

// RuntimeReconciler reconciles a Runtime object
Expand All @@ -38,20 +37,9 @@ type RuntimeReconciler struct {
//+kubebuilder:rbac:groups=infrastructuremanager.kyma-project.io,resources=runtimes/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=infrastructuremanager.kyma-project.io,resources=runtimes/finalizers,verbs=update

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by
// the Runtime object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.3/pkg/reconcile
func (r *RuntimeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
func (r *RuntimeReconciler) Reconcile(ctx context.Context, _ ctrl.Request) (ctrl.Result, error) {
_ = log.FromContext(ctx)

// TODO(user): your logic here

return ctrl.Result{}, nil
}

Expand Down
13 changes: 4 additions & 9 deletions internal/controller/runtime_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ package controller
import (
"context"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
imv1 "github.com/kyma-project/infrastructure-manager/api/v1"
. "github.com/onsi/ginkgo/v2" //nolint:revive
. "github.com/onsi/gomega" //nolint:revive
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

imv1 "github.com/kyma-project/infrastructure-manager/api/v1"
)

var _ = Describe("Runtime Controller", func() {
Expand Down Expand Up @@ -64,7 +62,6 @@ var _ = Describe("Runtime Controller", func() {
})

AfterEach(func() {
// TODO(user): Cleanup logic after each test, like removing the resource instance.
resource := &imv1.Runtime{}
err := k8sClient.Get(ctx, typeNamespacedName, resource)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -83,8 +80,6 @@ var _ = Describe("Runtime Controller", func() {
NamespacedName: typeNamespacedName,
})
Expect(err).NotTo(HaveOccurred())
// TODO(user): Add more specific assertions depending on your controller's reconciliation logic.
// Example: If you expect a certain status condition after reconciliation, verify it here.
})
})
})

0 comments on commit 5da8f5f

Please sign in to comment.