diff --git a/.github/workflows/golagci.yaml b/.github/workflows/golagci.yaml index 9bf4d79..f74df69 100644 --- a/.github/workflows/golagci.yaml +++ b/.github/workflows/golagci.yaml @@ -33,5 +33,5 @@ jobs: - name: GolangCI uses: golangci/golangci-lint-action@v3 with: - version: v1.55.2 - args: --timeout=3m + version: v1.61.0 + args: --timeout=3m -c .golangci.toml diff --git a/.golangci.toml b/.golangci.toml index b8b5f91..14b9b50 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -7,7 +7,7 @@ formats = "colored-line-number" [linters] enable = [ "gocyclo", "unconvert", "goimports", "unused", - "misspell", "nakedret", "errcheck", "revive", "ineffassign", + "misspell", "nakedret", "errcheck", "ineffassign", "goconst", "govet", "unparam", "gofmt" ] diff --git a/go.mod b/go.mod index d82cc59..ba8b423 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,6 @@ toolchain go1.23.1 require ( k8s.io/apimachinery v0.31.0 - k8s.io/component-base v0.31.0 - k8s.io/klog/v2 v2.130.1 sigs.k8s.io/cluster-api v1.8.2 sigs.k8s.io/controller-runtime v0.19.0 sigs.k8s.io/external-dns v0.15.0 @@ -63,6 +61,7 @@ require ( k8s.io/api v0.31.0 // indirect k8s.io/apiextensions-apiserver v0.31.0 // indirect k8s.io/client-go v0.31.0 // indirect + k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/go.sum b/go.sum index 0b6227f..79dec22 100644 --- a/go.sum +++ b/go.sum @@ -177,8 +177,6 @@ k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= -k8s.io/component-base v0.31.0 h1:/KIzGM5EvPNQcYgwq5NwoQBaOlVFrghoVGr8lG6vNRs= -k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f h1:0LQagt0gDpKqvIkAMPaRGcXawNMouPECM1+F9BVxEaM= diff --git a/main.go b/main.go index a51c445..1a2020e 100644 --- a/main.go +++ b/main.go @@ -19,63 +19,53 @@ Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic */ import ( - "os" - - epclient "github.com/absaoss/cap-infra-dns/pkg/client" - - "github.com/absaoss/cap-infra-dns/pkg/controller" - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/component-base/version" - "k8s.io/klog/v2" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/healthz" + "fmt" ) var ( - runtimeScheme = runtime.NewScheme() - setupLog = ctrl.Log.WithName("setup") +// runtimeScheme = runtime.NewScheme() +// setupLog = ctrl.Log.WithName("setup") ) -func init() { - utilruntime.Must(clusterv1.AddToScheme(runtimeScheme)) - utilruntime.Must(epclient.AddToScheme(runtimeScheme)) -} +//func init() { +// utilruntime.Must(clusterv1.AddToScheme(runtimeScheme)) +// utilruntime.Must(epclient.AddToScheme(runtimeScheme)) +//} func main() { - ctrl.SetLogger(klog.Background()) - - ctx := ctrl.SetupSignalHandler() - opts := ctrl.Options{ - Scheme: runtimeScheme, - } - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), opts) - if err != nil { - setupLog.Error(err, "unable to start manager") - os.Exit(1) - } - - if err = (&controller.ClusterReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(ctx, mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "DNSEndpoint") - os.Exit(1) - } - - if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up health check") - os.Exit(1) - } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up ready check") - os.Exit(1) - } - - setupLog.Info("starting manager", "version", version.Get().String()) - if err := mgr.Start(ctx); err != nil { - setupLog.Error(err, "problem running manager") - os.Exit(1) - } + fmt.Println("hello") + //ctrl.SetLogger(klog.Background()) + // + //ctx := ctrl.SetupSignalHandler() + //opts := ctrl.Options{ + // Scheme: runtimeScheme, + //} + //mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), opts) + //if err != nil { + // setupLog.Error(err, "unable to start manager") + // os.Exit(1) + //} + // + //if err = (&controller.ClusterReconciler{ + // Client: mgr.GetClient(), + // Scheme: mgr.GetScheme(), + //}).SetupWithManager(ctx, mgr); err != nil { + // setupLog.Error(err, "unable to create controller", "controller", "DNSEndpoint") + // os.Exit(1) + //} + // + //if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { + // setupLog.Error(err, "unable to set up health check") + // os.Exit(1) + //} + //if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { + // setupLog.Error(err, "unable to set up ready check") + // os.Exit(1) + //} + // + //setupLog.Info("starting manager", "version", version.Get().String()) + //if err := mgr.Start(ctx); err != nil { + // setupLog.Error(err, "problem running manager") + // os.Exit(1) + //} } diff --git a/taskfile.yaml b/taskfile.yaml index 1e00e10..4ee4e3d 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -19,4 +19,7 @@ tasks: cmds: - brew install gitleaks - brew install yamllint - - brew install golangci-lint +# - brew install golangci-lint +# the program is in GO 1.23, whether you use `go install` or `brew install`, +# make sure that golangci-lint is >= v1.6.0 + - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0