Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade k8s Dependencies to v0.30.4 & controller-runtime to v0.18.5 #338

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 4 additions & 53 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.29.0
ENVTEST_K8S_VERSION = 1.30.3

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -64,17 +64,10 @@ manifests: controller-gen ## Generate rbac objects.
./hack/promote-let-role.sh config/metalnetlet/apinet-rbac/role.yaml config/apiserver/rbac/metalnetlet_role.yaml apinet.ironcore.dev:system:metalnetlets

.PHONY: generate
generate: vgopath models-schema deepcopy-gen client-gen lister-gen informer-gen defaulter-gen conversion-gen openapi-gen applyconfiguration-gen
generate: vgopath models-schema openapi-gen
VGOPATH=$(VGOPATH) \
MODELS_SCHEMA=$(MODELS_SCHEMA) \
DEEPCOPY_GEN=$(DEEPCOPY_GEN) \
CLIENT_GEN=$(CLIENT_GEN) \
LISTER_GEN=$(LISTER_GEN) \
INFORMER_GEN=$(INFORMER_GEN) \
DEFAULTER_GEN=$(DEFAULTER_GEN) \
CONVERSION_GEN=$(CONVERSION_GEN) \
OPENAPI_GEN=$(OPENAPI_GEN) \
APPLYCONFIGURATION_GEN=$(APPLYCONFIGURATION_GEN) \
./hack/update-codegen.sh

.PHONY: add-license
Expand Down Expand Up @@ -330,14 +323,7 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
OPENAPI_EXTRACTOR ?= $(LOCALBIN)/openapi-extractor
DEEPCOPY_GEN ?= $(LOCALBIN)/deepcopy-gen
CLIENT_GEN ?= $(LOCALBIN)/client-gen
LISTER_GEN ?= $(LOCALBIN)/lister-gen
INFORMER_GEN ?= $(LOCALBIN)/informer-gen
DEFAULTER_GEN ?= $(LOCALBIN)/defaulter-gen
CONVERSION_GEN ?= $(LOCALBIN)/conversion-gen
OPENAPI_GEN ?= $(LOCALBIN)/openapi-gen
APPLYCONFIGURATION_GEN ?= $(LOCALBIN)/applyconfiguration-gen
VGOPATH ?= $(LOCALBIN)/vgopath
GEN_CRD_API_REFERENCE_DOCS ?= $(LOCALBIN)/gen-crd-api-reference-docs
ADDLICENSE ?= $(LOCALBIN)/addlicense
Expand All @@ -347,9 +333,8 @@ GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint

## Tool Versions
KUSTOMIZE_VERSION ?= v5.1.1
CODE_GENERATOR_VERSION ?= v0.29.0
VGOPATH_VERSION ?= v0.1.5
CONTROLLER_TOOLS_VERSION ?= v0.14.0
CONTROLLER_TOOLS_VERSION ?= v0.15.0
GEN_CRD_API_REFERENCE_DOCS_VERSION ?= v0.3.0
ADDLICENSE_VERSION ?= v1.1.1
GOIMPORTS_VERSION ?= v0.25.0
Expand All @@ -372,45 +357,11 @@ $(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

.PHONY: deepcopy-gen
deepcopy-gen: $(DEEPCOPY_GEN) ## Download deepcopy-gen locally if necessary.
$(DEEPCOPY_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/deepcopy-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/deepcopy-gen@$(CODE_GENERATOR_VERSION)

.PHONY: client-gen
client-gen: $(CLIENT_GEN) ## Download client-gen locally if necessary.
$(CLIENT_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/client-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/client-gen@$(CODE_GENERATOR_VERSION)

.PHONY: lister-gen
lister-gen: $(LISTER_GEN) ## Download lister-gen locally if necessary.
$(LISTER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/lister-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/lister-gen@$(CODE_GENERATOR_VERSION)

.PHONY: informer-gen
informer-gen: $(INFORMER_GEN) ## Download informer-gen locally if necessary.
$(INFORMER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/informer-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/informer-gen@$(CODE_GENERATOR_VERSION)

.PHONY: defaulter-gen
defaulter-gen: $(DEFAULTER_GEN) ## Download defaulter-gen locally if necessary.
$(DEFAULTER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/defaulter-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/defaulter-gen@$(CODE_GENERATOR_VERSION)

.PHONY: conversion-gen
conversion-gen: $(CONVERSION_GEN) ## Download conversion-gen locally if necessary.
$(CONVERSION_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/conversion-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/conversion-gen@$(CODE_GENERATOR_VERSION)

.PHONY: openapi-gen
openapi-gen: $(OPENAPI_GEN) ## Download openapi-gen locally if necessary.
$(OPENAPI_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/openapi-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/openapi-gen@$(CODE_GENERATOR_VERSION)
test -s $(LOCALBIN)/openapi-gen || GOBIN=$(LOCALBIN) go install k8s.io/kube-openapi/cmd/openapi-gen

.PHONY: applyconfiguration-gen
applyconfiguration-gen: $(APPLYCONFIGURATION_GEN) ## Download applyconfiguration-gen locally if necessary.
$(APPLYCONFIGURATION_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/applyconfiguration-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODE_GENERATOR_VERSION)

.PHONY: vgopath
vgopath: $(VGOPATH) ## Download vgopath locally if necessary.
Expand Down
20 changes: 20 additions & 0 deletions api/core/v1alpha1/zz_generated.defaults.go

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

2 changes: 1 addition & 1 deletion apinetlet/controllers/controllers_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
apinetclient "github.com/ironcore-dev/ironcore-net/internal/client"

apinetv1alpha1 "github.com/ironcore-dev/ironcore-net/api/core/v1alpha1"
"github.com/ironcore-dev/ironcore-net/client-go/ironcorenet"
ironcorenet "github.com/ironcore-dev/ironcore-net/client-go/ironcorenet/versioned"
ipamv1alpha1 "github.com/ironcore-dev/ironcore/api/ipam/v1alpha1"
networkingv1alpha1 "github.com/ironcore-dev/ironcore/api/networking/v1alpha1"
envtestutils "github.com/ironcore-dev/ironcore/utils/envtest"
Expand Down
12 changes: 6 additions & 6 deletions apinetlet/controllers/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
apinetv1alpha1 "github.com/ironcore-dev/ironcore-net/api/core/v1alpha1"
"github.com/ironcore-dev/ironcore-net/apimachinery/api/net"
apinetv1alpha1ac "github.com/ironcore-dev/ironcore-net/client-go/applyconfigurations/core/v1alpha1"
apinetmetav1ac "github.com/ironcore-dev/ironcore-net/client-go/applyconfigurations/meta/v1"
metav1ac "k8s.io/client-go/applyconfigurations/meta/v1"

commonv1alpha1 "github.com/ironcore-dev/ironcore/api/common/v1alpha1"
corev1alpha1 "github.com/ironcore-dev/ironcore/api/core/v1alpha1"
Expand Down Expand Up @@ -163,19 +163,19 @@ func translateObjectSelector(objSel *corev1alpha1.ObjectSelector) *apinetv1alpha
WithMatchExpressions(translateLabelSelectorRequirements(objSel.MatchExpressions)...)
}

func translateLabelSelectorRequirements(reqs []metav1.LabelSelectorRequirement) []*apinetmetav1ac.LabelSelectorRequirementApplyConfiguration {
var translated []*apinetmetav1ac.LabelSelectorRequirementApplyConfiguration
func translateLabelSelectorRequirements(reqs []metav1.LabelSelectorRequirement) []*metav1ac.LabelSelectorRequirementApplyConfiguration {
var translated []*metav1ac.LabelSelectorRequirementApplyConfiguration
for _, req := range reqs {
translated = append(translated, apinetmetav1ac.LabelSelectorRequirement().
translated = append(translated, metav1ac.LabelSelectorRequirement().
WithKey(req.Key).
WithOperator(req.Operator).
WithValues(req.Values...))
}
return translated
}

func translateLabelSelector(labelSelector metav1.LabelSelector) *apinetmetav1ac.LabelSelectorApplyConfiguration {
return apinetmetav1ac.LabelSelector().
func translateLabelSelector(labelSelector metav1.LabelSelector) *metav1ac.LabelSelectorApplyConfiguration {
return metav1ac.LabelSelector().
WithMatchLabels(labelSelector.MatchLabels).
WithMatchExpressions(translateLabelSelectorRequirements(labelSelector.MatchExpressions)...)
}
Expand Down
11 changes: 7 additions & 4 deletions apinetlet/controllers/loadbalancer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
apinetlethandler "github.com/ironcore-dev/ironcore-net/apinetlet/handler"
"github.com/ironcore-dev/ironcore-net/apinetlet/provider"
apinetv1alpha1ac "github.com/ironcore-dev/ironcore-net/client-go/applyconfigurations/core/v1alpha1"
metav1ac "github.com/ironcore-dev/ironcore-net/client-go/applyconfigurations/meta/v1"
"github.com/ironcore-dev/ironcore-net/client-go/ironcorenet"
ironcorenet "github.com/ironcore-dev/ironcore-net/client-go/ironcorenet/versioned"
metav1ac "k8s.io/client-go/applyconfigurations/meta/v1"

"github.com/ironcore-dev/controller-utils/clientutils"
commonv1alpha1 "github.com/ironcore-dev/ironcore/api/common/v1alpha1"
Expand Down Expand Up @@ -342,8 +342,11 @@ func (r *LoadBalancerReconciler) SetupWithManager(mgr ctrl.Manager, apiNetCache
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.LoadBalancer{}),
apinetlethandler.EnqueueRequestForSource(r.Scheme(), r.RESTMapper(), &networkingv1alpha1.LoadBalancer{}),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.LoadBalancer{},
apinetlethandler.EnqueueRequestForSource(r.Scheme(), r.RESTMapper(), &networkingv1alpha1.LoadBalancer{}),
),
).
Owns(&ipamv1alpha1.Prefix{}).
Watches(
Expand Down
16 changes: 11 additions & 5 deletions apinetlet/controllers/natgateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
apinetletclient "github.com/ironcore-dev/ironcore-net/apinetlet/client"
"github.com/ironcore-dev/ironcore-net/apinetlet/handler"
apinetv1alpha1ac "github.com/ironcore-dev/ironcore-net/client-go/applyconfigurations/core/v1alpha1"
"github.com/ironcore-dev/ironcore-net/client-go/ironcorenet"
ironcorenet "github.com/ironcore-dev/ironcore-net/client-go/ironcorenet/versioned"

"github.com/ironcore-dev/controller-utils/clientutils"
commonv1alpha1 "github.com/ironcore-dev/ironcore/api/common/v1alpha1"
Expand Down Expand Up @@ -215,12 +215,18 @@ func (r *NATGatewayReconciler) SetupWithManager(mgr ctrl.Manager, apiNetCache ca
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.NATGateway{}),
handler.EnqueueRequestForSource(mgr.GetScheme(), mgr.GetRESTMapper(), &networkingv1alpha1.NATGateway{}),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.NATGateway{},
handler.EnqueueRequestForSource(mgr.GetScheme(), mgr.GetRESTMapper(), &networkingv1alpha1.NATGateway{}),
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.NATGatewayAutoscaler{}),
handler.EnqueueRequestForSource(mgr.GetScheme(), mgr.GetRESTMapper(), &networkingv1alpha1.NATGateway{}),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.NATGatewayAutoscaler{},
handler.EnqueueRequestForSource(mgr.GetScheme(), mgr.GetRESTMapper(), &networkingv1alpha1.NATGateway{}),
),
).
Complete(r)
}
7 changes: 5 additions & 2 deletions apinetlet/controllers/network_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,11 @@ func (r *NetworkReconciler) SetupWithManager(mgr ctrl.Manager, apiNetCache cache
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.Network{}),
handler.EnqueueRequestForSource(mgr.GetScheme(), mgr.GetRESTMapper(), &networkingv1alpha1.Network{}),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.Network{},
handler.EnqueueRequestForSource(mgr.GetScheme(), mgr.GetRESTMapper(), &networkingv1alpha1.Network{}),
),
).
Complete(r)
}
7 changes: 5 additions & 2 deletions apinetlet/controllers/networkinterface_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,11 @@ func (r *NetworkInterfaceReconciler) SetupWithManager(mgr ctrl.Manager, apiNetCa
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.NetworkInterface{}),
apinetlethandler.EnqueueRequestForSource(r.Scheme(), r.RESTMapper(), &networkingv1alpha1.NetworkInterface{}),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.NetworkInterface{},
apinetlethandler.EnqueueRequestForSource(r.Scheme(), r.RESTMapper(), &networkingv1alpha1.NetworkInterface{}),
),
).
Owns(&ipamv1alpha1.Prefix{}).
Watches(
Expand Down
25 changes: 17 additions & 8 deletions apinetlet/controllers/networkpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
apinetletclient "github.com/ironcore-dev/ironcore-net/apinetlet/client"
apinetlethandler "github.com/ironcore-dev/ironcore-net/apinetlet/handler"
apinetv1alpha1ac "github.com/ironcore-dev/ironcore-net/client-go/applyconfigurations/core/v1alpha1"
"github.com/ironcore-dev/ironcore-net/client-go/ironcorenet"
ironcorenet "github.com/ironcore-dev/ironcore-net/client-go/ironcorenet/versioned"
apinetclient "github.com/ironcore-dev/ironcore-net/internal/client"

"github.com/ironcore-dev/controller-utils/clientutils"
Expand Down Expand Up @@ -576,17 +576,26 @@ func (r *NetworkPolicyReconciler) SetupWithManager(mgr ctrl.Manager, apiNetCache
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.NetworkPolicy{}),
apinetlethandler.EnqueueRequestForSource(r.Scheme(), r.RESTMapper(), &networkingv1alpha1.NetworkPolicy{}),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.NetworkPolicy{},
apinetlethandler.EnqueueRequestForSource(r.Scheme(), r.RESTMapper(), &networkingv1alpha1.NetworkPolicy{}),
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.Network{}),
r.enqueueByNetwork(),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.Network{},
r.enqueueByNetwork(),
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.NetworkInterface{}),
r.enqueueByNetworkInterface(),
builder.WithPredicates(r.networkInterfaceReadyPredicate()),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.NetworkInterface{},
r.enqueueByNetworkInterface(),
r.networkInterfaceReadyPredicate(),
),
).
Complete(r)
}
9 changes: 6 additions & 3 deletions apinetlet/controllers/virtualip_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
apinetletclient "github.com/ironcore-dev/ironcore-net/apinetlet/client"
"github.com/ironcore-dev/ironcore-net/apinetlet/handler"
apinetv1alpha1ac "github.com/ironcore-dev/ironcore-net/client-go/applyconfigurations/core/v1alpha1"
"github.com/ironcore-dev/ironcore-net/client-go/ironcorenet"
ironcorenet "github.com/ironcore-dev/ironcore-net/client-go/ironcorenet/versioned"

"github.com/ironcore-dev/controller-utils/clientutils"
commonv1alpha1 "github.com/ironcore-dev/ironcore/api/common/v1alpha1"
Expand Down Expand Up @@ -204,8 +204,11 @@ func (r *VirtualIPReconciler) SetupWithManager(mgr ctrl.Manager, apiNetCache cac
),
).
WatchesRawSource(
source.Kind(apiNetCache, &apinetv1alpha1.IP{}),
handler.EnqueueRequestForSource(r.Scheme(), mgr.GetRESTMapper(), &networkingv1alpha1.VirtualIP{}),
source.Kind[client.Object](
apiNetCache,
&apinetv1alpha1.IP{},
handler.EnqueueRequestForSource(r.Scheme(), mgr.GetRESTMapper(), &networkingv1alpha1.VirtualIP{}),
),
).
Complete(r)
}
2 changes: 1 addition & 1 deletion client-go/applyconfigurations/core/v1alpha1/daemonset.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.

2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion client-go/applyconfigurations/core/v1alpha1/ip.go

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

2 changes: 1 addition & 1 deletion 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