Skip to content

Commit b9fef2e

Browse files
authored
Merge pull request #857 from SchSeba/bump_controller_runtime_0.20.2
Bump controller-runtime and kubernetes
2 parents 1d8e37a + 5fce07b commit b9fef2e

27 files changed

+324
-710
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
uses: actions/checkout@v2
100100
- name: run lint checks
101101
run: make lint
102-
102+
103103
shellcheck:
104104
name: Shellcheck
105105
runs-on: ubuntu-latest
@@ -192,7 +192,7 @@ jobs:
192192
- name: Check out code into the Go module directory
193193
uses: actions/checkout@v2
194194

195-
- name: Set up Go 1.22
195+
- name: Set up Go 1.23
196196
uses: actions/setup-go@v3
197197
with:
198198
go-version: 1.23.x

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,5 @@ tags
8484
.idea/
8585
# test-environment files
8686
registry-login.conf
87+
# go telemetry
88+
.config/

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ issues:
107107
- doc/
108108
- bindata/
109109
- pkg/client
110-
# Excluding configuration per-path, per-linter, per-text and per-source
111110
exclude-rules:
112111
- path: _test\.go
113112
linters:

config/crd/bases/sriovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,13 @@ spec:
8383
items:
8484
type: string
8585
type: array
86+
x-kubernetes-list-type: atomic
8687
required:
8788
- key
8889
- operator
8990
type: object
9091
type: array
92+
x-kubernetes-list-type: atomic
9193
matchLabels:
9294
additionalProperties:
9395
type: string

controllers/drain_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,14 @@ func (dr *DrainReconcile) ensureAnnotationExists(ctx context.Context, object cli
190190
// SetupWithManager sets up the controller with the Manager.
191191
func (dr *DrainReconcile) SetupWithManager(mgr ctrl.Manager) error {
192192
createUpdateEnqueue := handler.Funcs{
193-
CreateFunc: func(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface) {
194-
q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
193+
CreateFunc: func(c context.Context, e event.TypedCreateEvent[client.Object], w workqueue.TypedRateLimitingInterface[reconcile.Request]) {
194+
w.Add(reconcile.Request{NamespacedName: types.NamespacedName{
195195
Namespace: vars.Namespace,
196196
Name: e.Object.GetName(),
197197
}})
198198
},
199-
UpdateFunc: func(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) {
200-
q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
199+
UpdateFunc: func(ctx context.Context, e event.TypedUpdateEvent[client.Object], w workqueue.TypedRateLimitingInterface[reconcile.Request]) {
200+
w.Add(reconcile.Request{NamespacedName: types.NamespacedName{
201201
Namespace: vars.Namespace,
202202
Name: e.ObjectNew.GetName(),
203203
}})

controllers/drain_controller_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"k8s.io/utils/pointer"
1818
"sigs.k8s.io/controller-runtime/pkg/client"
1919

20-
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
20+
mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
2121

2222
sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
2323
constants "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
@@ -90,8 +90,9 @@ var _ = Describe("Drain Controller", Ordered, func() {
9090
})
9191

9292
BeforeEach(func() {
93-
Expect(k8sClient.DeleteAllOf(context.Background(), &corev1.Node{})).ToNot(HaveOccurred())
94-
Expect(k8sClient.DeleteAllOf(context.Background(), &sriovnetworkv1.SriovNetworkNodeState{}, client.InNamespace(vars.Namespace))).ToNot(HaveOccurred())
93+
Expect(k8sClient.DeleteAllOf(context.Background(), &corev1.Node{}, &client.DeleteAllOfOptions{DeleteOptions: client.DeleteOptions{GracePeriodSeconds: pointer.Int64(0)}})).ToNot(HaveOccurred())
94+
Expect(k8sClient.DeleteAllOf(context.Background(), &sriovnetworkv1.SriovNetworkNodeState{}, client.InNamespace(vars.Namespace), &client.DeleteAllOfOptions{DeleteOptions: client.DeleteOptions{GracePeriodSeconds: pointer.Int64(0)}})).ToNot(HaveOccurred())
95+
Expect(k8sClient.DeleteAllOf(context.Background(), &corev1.Pod{}, client.InNamespace(testNamespace), &client.DeleteAllOfOptions{DeleteOptions: client.DeleteOptions{GracePeriodSeconds: pointer.Int64(0)}})).ToNot(HaveOccurred())
9596

9697
poolConfig := &sriovnetworkv1.SriovNetworkPoolConfig{}
9798
poolConfig.SetNamespace(testNamespace)

controllers/generic_network_controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/vars"
4141
)
4242

43-
type networkCRInstance interface {
43+
type NetworkCRInstance interface {
4444
client.Object
4545
// renders NetAttDef from the network instance
4646
RenderNetAttDef() (*uns.Unstructured, error)
@@ -53,7 +53,7 @@ type networkController interface {
5353
reconcile.Reconciler
5454
// GetObject should return CR type which implements networkCRInstance
5555
// interface
56-
GetObject() networkCRInstance
56+
GetObject() NetworkCRInstance
5757
// should return CR list type
5858
GetObjectList() client.ObjectList
5959
// should return name of the controller
@@ -207,7 +207,7 @@ func (r *genericNetworkReconciler) SetupWithManager(mgr ctrl.Manager) error {
207207
Complete(r.controller)
208208
}
209209

210-
func (r *genericNetworkReconciler) namespaceHandlerCreate(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface) {
210+
func (r *genericNetworkReconciler) namespaceHandlerCreate(ctx context.Context, e event.TypedCreateEvent[client.Object], w workqueue.TypedRateLimitingInterface[reconcile.Request]) {
211211
networkList := r.controller.GetObjectList()
212212
err := r.List(ctx,
213213
networkList,
@@ -227,7 +227,7 @@ func (r *genericNetworkReconciler) namespaceHandlerCreate(ctx context.Context, e
227227
unsList.SetUnstructuredContent(unsContent)
228228
_ = unsList.EachListItem(func(o runtime.Object) error {
229229
unsObj := o.(*uns.Unstructured)
230-
q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
230+
w.Add(reconcile.Request{NamespacedName: types.NamespacedName{
231231
Namespace: unsObj.GetNamespace(),
232232
Name: unsObj.GetName(),
233233
}})
@@ -236,7 +236,7 @@ func (r *genericNetworkReconciler) namespaceHandlerCreate(ctx context.Context, e
236236
}
237237

238238
// deleteNetAttDef deletes the generated net-att-def CR
239-
func (r *genericNetworkReconciler) deleteNetAttDef(ctx context.Context, cr networkCRInstance) error {
239+
func (r *genericNetworkReconciler) deleteNetAttDef(ctx context.Context, cr NetworkCRInstance) error {
240240
// Fetch the NetworkAttachmentDefinition instance
241241
namespace := cr.NetworkNamespace()
242242
if namespace == "" {

controllers/ovsnetwork_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (r *OVSNetworkReconciler) Name() string {
4848
}
4949

5050
// return empty instance of the OVSNetwork CR
51-
func (r *OVSNetworkReconciler) GetObject() networkCRInstance {
51+
func (r *OVSNetworkReconciler) GetObject() NetworkCRInstance {
5252
return &sriovnetworkv1.OVSNetwork{}
5353
}
5454

controllers/sriovibnetwork_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (r *SriovIBNetworkReconciler) Name() string {
4848
}
4949

5050
// return empty instance of the SriovIBNetwork CR
51-
func (r *SriovIBNetworkReconciler) GetObject() networkCRInstance {
51+
func (r *SriovIBNetworkReconciler) GetObject() NetworkCRInstance {
5252
return &sriovnetworkv1.SriovIBNetwork{}
5353
}
5454

controllers/sriovnetwork_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (r *SriovNetworkReconciler) Name() string {
4848
}
4949

5050
// return empty instance of the SriovIBNetwork CR
51-
func (r *SriovNetworkReconciler) GetObject() networkCRInstance {
51+
func (r *SriovNetworkReconciler) GetObject() NetworkCRInstance {
5252
return &sriovnetworkv1.SriovNetwork{}
5353
}
5454

0 commit comments

Comments
 (0)