diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d3754b7c..a31f7ea9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,4 +17,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.61 diff --git a/Makefile b/Makefile index 3c10d20e..0145051d 100644 --- a/Makefile +++ b/Makefile @@ -352,8 +352,8 @@ VGOPATH_VERSION ?= v0.1.5 CONTROLLER_TOOLS_VERSION ?= v0.14.0 GEN_CRD_API_REFERENCE_DOCS_VERSION ?= v0.3.0 ADDLICENSE_VERSION ?= v1.1.1 -GOIMPORTS_VERSION ?= v0.24.0 -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOIMPORTS_VERSION ?= v0.25.0 +GOLANGCI_LINT_VERSION ?= v1.61.0 OPENAPI_EXTRACTOR_VERSION ?= v0.1.4 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" diff --git a/apinetlet/controllers/controllers_suite_test.go b/apinetlet/controllers/controllers_suite_test.go index 72f44a48..70827994 100644 --- a/apinetlet/controllers/controllers_suite_test.go +++ b/apinetlet/controllers/controllers_suite_test.go @@ -5,7 +5,9 @@ package controllers import ( "context" + "fmt" "path/filepath" + "runtime" "testing" "time" @@ -68,7 +70,15 @@ var _ = BeforeSuite(func() { var err error By("bootstrapping test environment") - testEnv = &envtest.Environment{} + testEnv = &envtest.Environment{ + // The BinaryAssetsDirectory is only required if you want to run the tests directly + // without call the makefile target test. If not informed it will look for the + // default path defined in controller-runtime which is /usr/local/kubebuilder/. + // Note that you must have the required binaries setup under the bin directory to perform + // the tests directly. When we run make test it will be setup and used automatically. + BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", + fmt.Sprintf("1.29.0-%s-%s", runtime.GOOS, runtime.GOARCH)), + } testEnvExt = &envtestutils.EnvironmentExtensions{ APIServiceDirectoryPaths: []string{ filepath.Join("..", "..", "config", "apiserver", "apiservice", "bases"), diff --git a/go.mod b/go.mod index 57bb3b49..24290252 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ironcore-dev/ironcore-net -go 1.22.2 +go 1.23.0 require ( github.com/bits-and-blooms/bitset v1.14.3 @@ -15,15 +15,15 @@ require ( github.com/spf13/pflag v1.0.5 go4.org/netipx v0.0.0-20220812043211-3cc044ffd68d golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 - k8s.io/api v0.29.4 - k8s.io/apimachinery v0.29.4 - k8s.io/apiserver v0.29.4 - k8s.io/client-go v0.29.4 - k8s.io/component-base v0.29.4 + k8s.io/api v0.29.9 + k8s.io/apimachinery v0.29.9 + k8s.io/apiserver v0.29.9 + k8s.io/client-go v0.29.9 + k8s.io/component-base v0.29.9 k8s.io/klog/v2 v2.130.1 k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 k8s.io/utils v0.0.0-20240102154912-e7106e64919e - sigs.k8s.io/controller-runtime v0.17.3 + sigs.k8s.io/controller-runtime v0.17.6 sigs.k8s.io/structured-merge-diff/v4 v4.4.1 ) @@ -108,7 +108,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.29.2 // indirect - k8s.io/kms v0.29.4 // indirect + k8s.io/kms v0.29.9 // indirect k8s.io/kube-aggregator v0.29.4 // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/go.sum b/go.sum index e76ea72c..a4aa0f59 100644 --- a/go.sum +++ b/go.sum @@ -316,22 +316,22 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.29.4 h1:WEnF/XdxuCxdG3ayHNRR8yH3cI1B/llkWBma6bq4R3w= -k8s.io/api v0.29.4/go.mod h1:DetSv0t4FBTcEpfA84NJV3g9a7+rSzlUHk5ADAYHUv0= +k8s.io/api v0.29.9 h1:FwdflpNsfMUYUOblMZNWJ4K/q0OSL5A4jGa0iOgcJco= +k8s.io/api v0.29.9/go.mod h1:fNhmzRfKaSEHCmczA/jRx6CiDKhYOnFLJBERMJAXEk8= k8s.io/apiextensions-apiserver v0.29.2 h1:UK3xB5lOWSnhaCk0RFZ0LUacPZz9RY4wi/yt2Iu+btg= k8s.io/apiextensions-apiserver v0.29.2/go.mod h1:aLfYjpA5p3OwtqNXQFkhJ56TB+spV8Gc4wfMhUA3/b8= -k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q= -k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= -k8s.io/apiserver v0.29.4 h1:wPwGOO58GQOpRiZu59P5eRoDcB7QtV+QBglkRiXwCiM= -k8s.io/apiserver v0.29.4/go.mod h1:VqTF9t98HVfhKZVRohCPezsdUt9u2g3bHKftxGcXoRo= -k8s.io/client-go v0.29.4 h1:79ytIedxVfyXV8rpH3jCBW0u+un0fxHDwX5F9K8dPR8= -k8s.io/client-go v0.29.4/go.mod h1:kC1thZQ4zQWYwldsfI088BbK6RkxK+aF5ebV8y9Q4tk= -k8s.io/component-base v0.29.4 h1:xeKzuuHI/1tjleu5jycDAcYbhAxeGHCQBZUY2eRIkOo= -k8s.io/component-base v0.29.4/go.mod h1:pYjt+oEZP9gtmwSikwAJgfSBikqKX2gOqRat0QjmQt0= +k8s.io/apimachinery v0.29.9 h1:YZ8HUid1TzQVz94cnNlsQjLdH0VoAhWSqz7t0q6B12A= +k8s.io/apimachinery v0.29.9/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= +k8s.io/apiserver v0.29.9 h1:BiHTZbAYcNYHTE9RlWMBe5AX2XoZbRujy6oo5krU4V8= +k8s.io/apiserver v0.29.9/go.mod h1:3zmBeYworciVZHs8jSfzt/naTpDQb3AM++aYJ5Pkqqo= +k8s.io/client-go v0.29.9 h1:4f/Wz6li3rEyIPFj32XAQMtOGMM1tg7KQi1oeS6ibPg= +k8s.io/client-go v0.29.9/go.mod h1:2N1drQEZ5yiYrWVaE2Un8JiISUhl47D8pyZlYLszke4= +k8s.io/component-base v0.29.9 h1:lPENvp3CCwdeMEWGjiTfn5b287qQYuK7gX32OBOovmA= +k8s.io/component-base v0.29.9/go.mod h1:NGDa6Ih0EdcLA2G4K2ZYySoiB+2Tn+rmSqPyudCPgDY= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kms v0.29.4 h1:cFGEoCLwoXk/eqYZppLZxybCdmEWeRKMCbm9f13IdRQ= -k8s.io/kms v0.29.4/go.mod h1:vWVImKkJd+1BQY4tBwdfSwjQBiLrnbNtHADcDEDQFtk= +k8s.io/kms v0.29.9 h1:7B9VGhFAzNfBmfXeQ0Xi+OzIcNPw/xazPnLm/J3vNT4= +k8s.io/kms v0.29.9/go.mod h1:vWVImKkJd+1BQY4tBwdfSwjQBiLrnbNtHADcDEDQFtk= k8s.io/kube-aggregator v0.29.4 h1:yT7vYtwIag4G8HNrktYZ3qz6p6oHKronMAXOw4eQ2WQ= k8s.io/kube-aggregator v0.29.4/go.mod h1:zBfe4iXXmw5HinNgN0JoAu5rpXdyCUvRfG99+FVOd68= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= @@ -340,8 +340,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= -sigs.k8s.io/controller-runtime v0.17.3 h1:65QmN7r3FWgTxDMz9fvGnO1kbf2nu+acg9p2R9oYYYk= -sigs.k8s.io/controller-runtime v0.17.3/go.mod h1:N0jpP5Lo7lMTF9aL56Z/B2oWBJjey6StQM0jRbKQXtY= +sigs.k8s.io/controller-runtime v0.17.6 h1:12IXsozEsIXWAMRpgRlYS1jjAHQXHtWEOMdULh3DbEw= +sigs.k8s.io/controller-runtime v0.17.6/go.mod h1:N0jpP5Lo7lMTF9aL56Z/B2oWBJjey6StQM0jRbKQXtY= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/internal/app/app_suite_test.go b/internal/app/app_suite_test.go index 3810a846..bb5df40f 100644 --- a/internal/app/app_suite_test.go +++ b/internal/app/app_suite_test.go @@ -4,7 +4,9 @@ package app_test import ( + "fmt" "path/filepath" + "runtime" "testing" "time" @@ -54,7 +56,15 @@ var _ = BeforeSuite(func() { var err error By("bootstrapping test environment") - testEnv = &envtest.Environment{} + testEnv = &envtest.Environment{ + // The BinaryAssetsDirectory is only required if you want to run the tests directly + // without call the makefile target test. If not informed it will look for the + // default path defined in controller-runtime which is /usr/local/kubebuilder/. + // Note that you must have the required binaries setup under the bin directory to perform + // the tests directly. When we run make test it will be setup and used automatically. + BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", + fmt.Sprintf("1.29.0-%s-%s", runtime.GOOS, runtime.GOARCH)), + } testEnvExt = &utilsenvtest.EnvironmentExtensions{ APIServiceDirectoryPaths: []string{filepath.Join("..", "..", "config", "apiserver", "apiservice", "bases")}, ErrorIfAPIServicePathIsMissing: true, diff --git a/internal/controllers/controllers_suite_test.go b/internal/controllers/controllers_suite_test.go index 0eecf933..2c6527e8 100644 --- a/internal/controllers/controllers_suite_test.go +++ b/internal/controllers/controllers_suite_test.go @@ -5,8 +5,10 @@ package controllers import ( "context" + "fmt" "net/netip" "path/filepath" + "runtime" "testing" "time" @@ -73,7 +75,15 @@ var _ = BeforeSuite(func() { var err error By("bootstrapping test environment") - testEnv = &envtest.Environment{} + testEnv = &envtest.Environment{ + // The BinaryAssetsDirectory is only required if you want to run the tests directly + // without call the makefile target test. If not informed it will look for the + // default path defined in controller-runtime which is /usr/local/kubebuilder/. + // Note that you must have the required binaries setup under the bin directory to perform + // the tests directly. When we run make test it will be setup and used automatically. + BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", + fmt.Sprintf("1.29.0-%s-%s", runtime.GOOS, runtime.GOARCH)), + } testEnvExt = &utilsenvtest.EnvironmentExtensions{ APIServiceDirectoryPaths: []string{filepath.Join("..", "..", "config", "apiserver", "apiservice", "bases")}, ErrorIfAPIServicePathIsMissing: true, diff --git a/metalnetlet/controllers/controllers_suite_test.go b/metalnetlet/controllers/controllers_suite_test.go index ee35cd15..70a4a4c8 100644 --- a/metalnetlet/controllers/controllers_suite_test.go +++ b/metalnetlet/controllers/controllers_suite_test.go @@ -5,8 +5,10 @@ package controllers import ( "context" + "fmt" "net/netip" "path/filepath" + "runtime" "testing" "time" @@ -85,6 +87,13 @@ var _ = BeforeSuite(func() { filepath.Join(modutils.Dir("github.com/ironcore-dev/metalnet", "config", "crd", "bases")), }, ErrorIfCRDPathMissing: true, + // The BinaryAssetsDirectory is only required if you want to run the tests directly + // without call the makefile target test. If not informed it will look for the + // default path defined in controller-runtime which is /usr/local/kubebuilder/. + // Note that you must have the required binaries setup under the bin directory to perform + // the tests directly. When we run make test it will be setup and used automatically. + BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", + fmt.Sprintf("1.29.0-%s-%s", runtime.GOOS, runtime.GOARCH)), } testEnvExt = &utilsenvtest.EnvironmentExtensions{ APIServiceDirectoryPaths: []string{filepath.Join("..", "..", "config", "apiserver", "apiservice", "bases")}, diff --git a/metalnetlet/controllers/network_controller.go b/metalnetlet/controllers/network_controller.go index dc158271..4857e3cb 100644 --- a/metalnetlet/controllers/network_controller.go +++ b/metalnetlet/controllers/network_controller.go @@ -165,10 +165,10 @@ func (r *NetworkReconciler) reconcile(ctx context.Context, log logr.Logger, netw metalnetNetwork.Spec.PeeredIDs = append(metalnetNetwork.Spec.PeeredIDs, id) - if peering.Prefixes != nil && len(peering.Prefixes) > 0 { + if len(peering.Prefixes) > 0 { ipPrefixes := getIPPrefixes(peering.Prefixes) peeredPrefix := metalnetv1alpha1.PeeredPrefix{ - ID: int32(id), + ID: id, Prefixes: ipPrefixesToMetalnetPrefixes(ipPrefixes), } peeredPrefixes = append(peeredPrefixes, peeredPrefix)