Skip to content

Commit

Permalink
chore: refactor import statements
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytd committed Oct 14, 2024
1 parent 0f14e75 commit 3b8321f
Show file tree
Hide file tree
Showing 24 changed files with 149 additions and 135 deletions.
10 changes: 7 additions & 3 deletions cmd/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import (
"flag"
"fmt"

oidc_apps_controller "github.com/gardener/oidc-apps-controller/pkg/oidc-apps-controller"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/component-base/version"
"k8s.io/component-base/version/verflag"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

oidc_apps_controller "github.com/gardener/oidc-apps-controller/pkg/oidc-apps-controller"
)

var _log = logf.Log
Expand All @@ -42,10 +42,14 @@ func NewOidcAppsController() *cobra.Command {
SilenceErrors: true,
RunE: func(cmd *cobra.Command, _ []string) error {
logf.SetLogger(zap.New(zap.UseFlagOptions(fromFlags)))
_log.Info("started",
"version", version.Get().GitVersion,
"revision", version.Get().GitCommit,
"gitTreeState", version.Get().GitTreeState,
)

verflag.PrintAndExitIfRequested()

_log.Info(fmt.Sprintf("VERSION: %s", version.Get().String()))
cmd.Flags().VisitAll(func(flag *pflag.Flag) {
_log.Info(fmt.Sprintf("FLAG: --%s=%s", flag.Name, flag.Value))
})
Expand Down
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ package main
import (
"os"

"github.com/gardener/oidc-apps-controller/cmd/app"

_ "go.uber.org/automaxprocs"
runtimelog "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"

"github.com/gardener/oidc-apps-controller/cmd/app"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/certificates/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"path/filepath"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
gomock "go.uber.org/mock/gomock"
)

var tmp string
Expand Down
13 changes: 9 additions & 4 deletions pkg/certificates/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/configuration/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import (
"strings"
"sync"

oidc_apps_controller "github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"

"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -34,6 +31,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/yaml"

oidc_apps_controller "github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"
)

// OIDCAppsControllerConfig is the root configuration node
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/deployment-reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ package controllers
import (
"context"

"github.com/gardener/oidc-apps-controller/pkg/configuration"

appsv1 "k8s.io/api/apps/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
)

// DeploymentReconciler holds configuration for the reconciler
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/image-pull-secret-reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ package controllers
import (
"context"

constants "github.com/gardener/oidc-apps-controller/pkg/constants"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

constants "github.com/gardener/oidc-apps-controller/pkg/constants"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/modifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import (
"strconv"
"strings"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
constants "github.com/gardener/oidc-apps-controller/pkg/constants"

gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
gardenextensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
v1 "k8s.io/api/apps/v1"
Expand All @@ -39,6 +36,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/log"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
constants "github.com/gardener/oidc-apps-controller/pkg/constants"
)

func fetchOidcAppsServices(ctx context.Context, c client.Client, object client.Object) (*corev1.ServiceList, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/namespace-reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ package controllers
import (
"context"

constants "github.com/gardener/oidc-apps-controller/pkg/constants"

corev1 "k8s.io/api/core/v1"
"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/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

constants "github.com/gardener/oidc-apps-controller/pkg/constants"
)

// NamespaceReconciler holds configuration for the reconciler
Expand Down
8 changes: 4 additions & 4 deletions pkg/controllers/oidc-apps-ingresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import (
"fmt"
"strings"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
constants "github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"

corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
constants "github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"
)

func createIngressForDeployment(object client.Object) (networkingv1.Ingress, error) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/controllers/oidc-apps-secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import (
"os"
"path/filepath"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
constants "github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientcmdv1 "k8s.io/client-go/tools/clientcmd/api/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
constants "github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"
)

var errSecretDoesNotExist = errors.New("secret does not exist")
Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/oidc-apps-services.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ package controllers
import (
"strings"

constants "github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"sigs.k8s.io/controller-runtime/pkg/client"

constants "github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"
)

func createOauth2Service(selectors client.MatchingLabels, object client.Object) (corev1.Service, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/statefulset-reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ package controllers
import (
"context"

"github.com/gardener/oidc-apps-controller/pkg/configuration"

appsv1 "k8s.io/api/apps/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
)

// StatefulSetReconciler holds configuration for the reconciler
Expand Down
4 changes: 2 additions & 2 deletions pkg/notifiers/gardener-access-token.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (
"os"
"time"

constants "github.com/gardener/oidc-apps-controller/pkg/constants"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
clientcmdv1 "k8s.io/client-go/tools/clientcmd/api/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/yaml"

constants "github.com/gardener/oidc-apps-controller/pkg/constants"
)

var _ manager.Runnable = &gardenerAccessTokenNotifier{}
Expand Down
14 changes: 7 additions & 7 deletions pkg/oidc-apps-controller/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ import (
"sync"
"time"

"github.com/gardener/oidc-apps-controller/pkg/certificates"
"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/controllers"
"github.com/gardener/oidc-apps-controller/pkg/notifiers"
oidcappswebhook "github.com/gardener/oidc-apps-controller/pkg/webhook"

gardenextensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
gardenerhealthz "github.com/gardener/gardener/pkg/healthz"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -59,6 +52,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/gardener/oidc-apps-controller/pkg/certificates"
"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/controllers"
"github.com/gardener/oidc-apps-controller/pkg/notifiers"
oidcappswebhook "github.com/gardener/oidc-apps-controller/pkg/webhook"
)

var (
Expand Down
10 changes: 5 additions & 5 deletions pkg/webhook/modifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import (
"strconv"
"strings"

"github.com/gardener/oidc-apps-controller/imagevector"
"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/gardener/oidc-apps-controller/imagevector"
"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"
)

//go:embed oidc-check.sh
Expand Down
6 changes: 3 additions & 3 deletions pkg/webhook/pod-webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ import (
"slices"
"strings"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/json"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
)

// Register the webhook with the server
Expand Down
10 changes: 5 additions & 5 deletions pkg/webhook/test/pod-mutating-webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ import (
"path/filepath"
"strings"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"
"github.com/gardener/oidc-apps-controller/pkg/webhook"

jsonpatch "github.com/evanphx/json-patch"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -40,6 +35,11 @@ import (
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/rand"
"github.com/gardener/oidc-apps-controller/pkg/webhook"
)

var targetDeployment, nonTargetDeployment *appsv1.Deployment
Expand Down
8 changes: 4 additions & 4 deletions pkg/webhook/test/vpa-mutating-webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ import (
"encoding/json"
"path/filepath"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/webhook"

jsonpatch "github.com/evanphx/json-patch"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -37,6 +33,10 @@ import (
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/gardener/oidc-apps-controller/pkg/configuration"
"github.com/gardener/oidc-apps-controller/pkg/constants"
"github.com/gardener/oidc-apps-controller/pkg/webhook"
)

var targetVPA, nonTargetVpa *autoscalerv1.VerticalPodAutoscaler
Expand Down
Loading

0 comments on commit 3b8321f

Please sign in to comment.