Skip to content

Commit

Permalink
Upgrade k8s dependencies to v0.31.0 and controller-runtime to `v0.1…
Browse files Browse the repository at this point in the history
…9.0`
  • Loading branch information
sujeet01 committed Dec 19, 2024
1 parent 23ea9bb commit 2135707
Show file tree
Hide file tree
Showing 143 changed files with 1,514 additions and 4,363 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
version: v1.62
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ METALNETLET_IMG ?= metalnetlet:latest
KIND_CLUSTER_NAME ?= kind

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.30.3
ENVTEST_K8S_VERSION = 1.31

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -334,12 +334,13 @@ GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
## Tool Versions
KUSTOMIZE_VERSION ?= v5.1.1
VGOPATH_VERSION ?= v0.1.5
CONTROLLER_TOOLS_VERSION ?= v0.15.0
CONTROLLER_TOOLS_VERSION ?= v0.16.0
GEN_CRD_API_REFERENCE_DOCS_VERSION ?= v0.3.0
ADDLICENSE_VERSION ?= v1.1.1
GOIMPORTS_VERSION ?= v0.25.0
GOLANGCI_LINT_VERSION ?= v1.61.0
OPENAPI_EXTRACTOR_VERSION ?= v0.1.4
GOLANGCI_LINT_VERSION ?= v1.62.2
OPENAPI_EXTRACTOR_VERSION ?= v0.1.9
SETUP_ENVTEST_VERSION ?= release-0.19

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down Expand Up @@ -376,7 +377,7 @@ $(VGOPATH): $(LOCALBIN)
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@$(SETUP_ENVTEST_VERSION)

.PHONY: openapi-extractor
openapi-extractor: $(OPENAPI_EXTRACTOR) ## Download openapi-extractor locally if necessary.
Expand Down
5 changes: 4 additions & 1 deletion apinetlet/controllers/controllers_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
ctrlconfig "sigs.k8s.io/controller-runtime/pkg/config"
"sigs.k8s.io/controller-runtime/pkg/envtest"
. "sigs.k8s.io/controller-runtime/pkg/envtest/komega"
logf "sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -77,7 +79,7 @@ var _ = BeforeSuite(func() {
// 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)),
fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)),
}
testEnvExt = &envtestutils.EnvironmentExtensions{
APIServiceDirectoryPaths: []string{
Expand Down Expand Up @@ -148,6 +150,7 @@ func SetupTest(apiNetNamespace *corev1.Namespace) *corev1.Namespace {
Metrics: metricsserver.Options{
BindAddress: "0",
},
Controller: ctrlconfig.Controller{SkipNameValidation: ptr.To(true)},
})
Expect(err).ToNot(HaveOccurred())

Expand Down
13 changes: 7 additions & 6 deletions apinetlet/controllers/networkpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"
)

Expand Down Expand Up @@ -470,7 +471,7 @@ func (r *NetworkPolicyReconciler) enqueueByNetwork() handler.EventHandler {
}

func (r *NetworkPolicyReconciler) enqueueByNetworkInterface() handler.EventHandler {
getEnqueueFunc := func(ctx context.Context, nic *apinetv1alpha1.NetworkInterface) func(nics []*apinetv1alpha1.NetworkInterface, queue workqueue.RateLimitingInterface) {
getEnqueueFunc := func(ctx context.Context, nic *apinetv1alpha1.NetworkInterface) func(nics []*apinetv1alpha1.NetworkInterface, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
log := ctrl.LoggerFrom(ctx)
networkPolicyList := &apinetv1alpha1.NetworkPolicyList{}
if err := r.APINetClient.List(ctx, networkPolicyList,
Expand All @@ -481,7 +482,7 @@ func (r *NetworkPolicyReconciler) enqueueByNetworkInterface() handler.EventHandl
return nil
}

return func(nics []*apinetv1alpha1.NetworkInterface, queue workqueue.RateLimitingInterface) {
return func(nics []*apinetv1alpha1.NetworkInterface, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
for _, networkPolicy := range networkPolicyList.Items {
networkPolicyKey := client.ObjectKeyFromObject(&networkPolicy)
log := log.WithValues("networkPolicyKey", networkPolicyKey)
Expand All @@ -507,29 +508,29 @@ func (r *NetworkPolicyReconciler) enqueueByNetworkInterface() handler.EventHandl
}

return handler.Funcs{
CreateFunc: func(ctx context.Context, evt event.CreateEvent, queue workqueue.RateLimitingInterface) {
CreateFunc: func(ctx context.Context, evt event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
nic := evt.Object.(*apinetv1alpha1.NetworkInterface)
enqueueFunc := getEnqueueFunc(ctx, nic)
if enqueueFunc != nil {
enqueueFunc([]*apinetv1alpha1.NetworkInterface{nic}, queue)
}
},
UpdateFunc: func(ctx context.Context, evt event.UpdateEvent, queue workqueue.RateLimitingInterface) {
UpdateFunc: func(ctx context.Context, evt event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
newNic := evt.ObjectNew.(*apinetv1alpha1.NetworkInterface)
oldNic := evt.ObjectOld.(*apinetv1alpha1.NetworkInterface)
enqueueFunc := getEnqueueFunc(ctx, newNic)
if enqueueFunc != nil {
enqueueFunc([]*apinetv1alpha1.NetworkInterface{newNic, oldNic}, queue)
}
},
DeleteFunc: func(ctx context.Context, evt event.DeleteEvent, queue workqueue.RateLimitingInterface) {
DeleteFunc: func(ctx context.Context, evt event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
nic := evt.Object.(*apinetv1alpha1.NetworkInterface)
enqueueFunc := getEnqueueFunc(ctx, nic)
if enqueueFunc != nil {
enqueueFunc([]*apinetv1alpha1.NetworkInterface{nic}, queue)
}
},
GenericFunc: func(ctx context.Context, evt event.GenericEvent, queue workqueue.RateLimitingInterface) {
GenericFunc: func(ctx context.Context, evt event.GenericEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
nic := evt.Object.(*apinetv1alpha1.NetworkInterface)
enqueueFunc := getEnqueueFunc(ctx, nic)
if enqueueFunc != nil {
Expand Down
4 changes: 2 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/affinity.go

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

10 changes: 8 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/daemonset.go

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

4 changes: 2 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/daemonsetspec.go

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

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

10 changes: 8 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/instance.go

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

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

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

4 changes: 2 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/instancespec.go

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

4 changes: 2 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/instancestatus.go

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

10 changes: 8 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/instancetemplate.go

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

10 changes: 8 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/ip.go

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

10 changes: 8 additions & 2 deletions client-go/applyconfigurations/core/v1alpha1/ipaddress.go

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

Loading

0 comments on commit 2135707

Please sign in to comment.