Skip to content

Commit

Permalink
Upgrade k8s to v0.30.4 and controller-runtime to v0.18.5
Browse files Browse the repository at this point in the history
- Refactor code to handle breaking changes
- Run make generate to regenerate code
- Update import paths for compatibility
  • Loading branch information
sujeet01 committed Nov 11, 2024
1 parent 09b0c53 commit c4d133a
Show file tree
Hide file tree
Showing 117 changed files with 1,169 additions and 898 deletions.
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.

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/natgateway.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/nattable.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/network.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/networkid.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.

Loading

0 comments on commit c4d133a

Please sign in to comment.