Skip to content

Commit bafa485

Browse files
chore(deps): bump reconciler.io/runtime from 0.23.0 to 0.25.1 (#461)
* chore(deps): bump reconciler.io/runtime from 0.23.0 to 0.25.1 Bumps [reconciler.io/runtime](https://github.com/reconcilerio/runtime) from 0.23.0 to 0.25.1. - [Release notes](https://github.com/reconcilerio/runtime/releases) - [Commits](reconcilerio/runtime@v0.23.0...v0.25.1) --- updated-dependencies: - dependency-name: reconciler.io/runtime dependency-version: 0.25.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Adapt to reconciler.io/runtime v0.25.1 breaking API changes Migrate to controller-runtime v0.23 typed webhook interfaces and update RBAC for new events.k8s.io Event recorder API. Changes: - Update NewWebhookManagedBy to pass resource as second argument instead of chaining .For() - Migrate MavenArtifactDefaulter to admission.Defaulter[*MavenArtifact] - Migrate MavenArtifactValidator to admission.Validator[*MavenArtifact] - Remove manual runtime.Object type assertions in webhook handlers - Add events.k8s.io API group to RBAC annotations for new Event API - Regenerate config/rbac/role.yaml with events.k8s.io permissions - Update test expectation for RequeueAfter behavior change when status updates occur (per reconcilerio/runtime#653) * Regenerate dist/source-controller.yaml with events.k8s.io RBAC Update the distribution manifest to include events.k8s.io API group permissions required by reconciler.io/runtime v0.25.x Event recorder. --------- Signed-off-by: Rashed Kamal <rashed.kamal@broadcom.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rashed Kamal <rashed.kamal@broadcom.com>
1 parent 933ee34 commit bafa485

12 files changed

Lines changed: 66 additions & 83 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ coverage.txt
3030

3131
# OS specific files
3232
.DS_Store
33+
.cursor

apis/source/v1alpha1/mavenartifact_defaults.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,17 @@ package v1alpha1
1919
import (
2020
"context"
2121

22-
"k8s.io/apimachinery/pkg/runtime"
23-
"sigs.k8s.io/controller-runtime/pkg/webhook"
22+
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2423
)
2524

2625
// +kubebuilder:webhook:path=/mutate-source-apps-tanzu-vmware-com-v1alpha1-mavenartifact,mutating=true,failurePolicy=fail,sideEffects=none,admissionReviewVersions=v1beta1,groups=source.apps.tanzu.vmware.com,resources=mavenartifacts,verbs=create;update,versions=v1alpha1,name=mavenartifacts.source.apps.tanzu.vmware.com
2726

2827
type MavenArtifactDefaulter struct{}
2928

30-
var _ webhook.CustomDefaulter = &MavenArtifactDefaulter{}
29+
var _ admission.Defaulter[*MavenArtifact] = &MavenArtifactDefaulter{}
3130

32-
// Default implements webhook.Defaulter so a webhook will be registered for the type
33-
func (c *MavenArtifactDefaulter) Default(ctx context.Context, obj runtime.Object) error {
34-
mavenArtifact := obj.(*MavenArtifact)
35-
return mavenArtifact.Spec.Default()
31+
func (*MavenArtifactDefaulter) Default(ctx context.Context, obj *MavenArtifact) error {
32+
return obj.Spec.Default()
3633
}
3734

3835
func (s *MavenArtifactSpec) Default() error {

apis/source/v1alpha1/mavenartifact_validation.go

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,27 @@ import (
2323
"strings"
2424

2525
"k8s.io/apimachinery/pkg/api/validation"
26-
"k8s.io/apimachinery/pkg/runtime"
2726
"k8s.io/apimachinery/pkg/util/validation/field"
2827

29-
"sigs.k8s.io/controller-runtime/pkg/webhook"
3028
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3129
)
3230

3331
// +kubebuilder:webhook:path=/validate-source-apps-tanzu-vmware-com-v1alpha1-mavenartifact,mutating=false,failurePolicy=fail,sideEffects=none,admissionReviewVersions=v1beta1,groups=source.apps.tanzu.vmware.com,resources=mavenartifacts,verbs=create;update,versions=v1alpha1,name=mavenartifacts.source.apps.tanzu.vmware.com
3432

3533
type MavenArtifactValidator struct{}
3634

37-
var _ webhook.CustomValidator = &MavenArtifactValidator{}
35+
var _ admission.Validator[*MavenArtifact] = &MavenArtifactValidator{}
3836

39-
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
40-
func (v *MavenArtifactValidator) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
41-
mavenArtifact, ok := obj.(*MavenArtifact)
42-
if !ok {
43-
return nil, fmt.Errorf("expected a MavenArtifact but got a %T", obj)
44-
}
45-
return nil, mavenArtifact.validate().ToAggregate()
37+
func (*MavenArtifactValidator) ValidateCreate(ctx context.Context, obj *MavenArtifact) (admission.Warnings, error) {
38+
return nil, obj.validate().ToAggregate()
4639
}
4740

48-
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
49-
func (v *MavenArtifactValidator) ValidateUpdate(ctx context.Context, old runtime.Object, new runtime.Object) (admission.Warnings, error) {
50-
mavenArtifact, ok := new.(*MavenArtifact)
51-
if !ok {
52-
return nil, fmt.Errorf("expected a MavenArtifact but got a %T", new)
53-
}
41+
func (*MavenArtifactValidator) ValidateUpdate(ctx context.Context, old *MavenArtifact, obj *MavenArtifact) (admission.Warnings, error) {
5442
// TODO check for immutable fields
55-
return nil, mavenArtifact.validate().ToAggregate()
43+
return nil, obj.validate().ToAggregate()
5644
}
5745

58-
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
59-
func (v *MavenArtifactValidator) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
46+
func (*MavenArtifactValidator) ValidateDelete(ctx context.Context, obj *MavenArtifact) (admission.Warnings, error) {
6047
return nil, nil
6148
}
6249

apis/source/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/rbac/role.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@ rules:
77
- apiGroups:
88
- ""
99
resources:
10-
- events
10+
- secrets
11+
- serviceaccounts
1112
verbs:
12-
- create
13-
- delete
1413
- get
1514
- list
16-
- patch
17-
- update
1815
- watch
1916
- apiGroups:
2017
- ""
18+
- events.k8s.io
2119
resources:
22-
- secrets
23-
- serviceaccounts
20+
- events
2421
verbs:
22+
- create
23+
- delete
2524
- get
2625
- list
26+
- patch
27+
- update
2728
- watch
2829
- apiGroups:
2930
- source.apps.tanzu.vmware.com

controllers/imagerepository_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import (
5252
//+kubebuilder:rbac:groups=source.apps.tanzu.vmware.com,resources=imagerepositories,verbs=get;list;watch;create;update;patch;delete
5353
//+kubebuilder:rbac:groups=source.apps.tanzu.vmware.com,resources=imagerepositories/status,verbs=get;update;patch
5454
//+kubebuilder:rbac:groups=source.apps.tanzu.vmware.com,resources=imagerepositories/finalizers,verbs=update
55-
//+kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch;delete
55+
//+kubebuilder:rbac:groups=core;events.k8s.io,resources=events,verbs=get;list;watch;create;update;patch;delete
5656

5757
// ImageRepositoryReconciler reconciles a ImageRepository object
5858
func ImageRepositoryReconciler(c reconcilers.Config, httpRootDir, httpHost string, now func() metav1.Time, certs []Cert) *reconcilers.ResourceReconciler[*sourcev1alpha1.ImageRepository] {

controllers/mavenartifact_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (ac *artifactCache) toString() string {
8181
//+kubebuilder:rbac:groups=source.apps.tanzu.vmware.com,resources=mavenartifacts,verbs=get;list;watch;create;update;patch;delete
8282
//+kubebuilder:rbac:groups=source.apps.tanzu.vmware.com,resources=mavenartifacts/status,verbs=get;update;patch
8383
//+kubebuilder:rbac:groups=source.apps.tanzu.vmware.com,resources=mavenartifacts/finalizers,verbs=update
84-
//+kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch;delete
84+
//+kubebuilder:rbac:groups=core;events.k8s.io,resources=events,verbs=get;list;watch;create;update;patch;delete
8585

8686
func MavenArtifactReconciler(c reconcilers.Config, httpRootDir, httpHost string, now func() metav1.Time, certs []Cert) *reconcilers.ResourceReconciler[*sourcev1alpha1.MavenArtifact] {
8787
return &reconcilers.ResourceReconciler[*sourcev1alpha1.MavenArtifact]{

controllers/mavenartifact_controller_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,9 +1898,7 @@ func TestMavenArtifactReconciler(t *testing.T) {
18981898
ExpectTracks: []rtesting.TrackRequest{
18991899
rtesting.NewTrackRequest(certSecret, parent, scheme),
19001900
},
1901-
ExpectedResult: reconcile.Result{
1902-
RequeueAfter: 5 * time.Minute,
1903-
},
1901+
ExpectedResult: reconcile.Result{},
19041902
},
19051903
"skip download": {
19061904
Request: request,

dist/source-controller.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,23 +513,24 @@ rules:
513513
- apiGroups:
514514
- ""
515515
resources:
516-
- events
516+
- secrets
517+
- serviceaccounts
517518
verbs:
518-
- create
519-
- delete
520519
- get
521520
- list
522-
- patch
523-
- update
524521
- watch
525522
- apiGroups:
526523
- ""
524+
- events.k8s.io
527525
resources:
528-
- secrets
529-
- serviceaccounts
526+
- events
530527
verbs:
528+
- create
529+
- delete
531530
- get
532531
- list
532+
- patch
533+
- update
533534
- watch
534535
- apiGroups:
535536
- source.apps.tanzu.vmware.com

go.mod

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ require (
1313
k8s.io/apimachinery v0.35.1
1414
k8s.io/client-go v0.35.1
1515
reconciler.io/dies v0.18.0
16-
reconciler.io/runtime v0.23.0
17-
sigs.k8s.io/controller-runtime v0.21.0
16+
reconciler.io/runtime v0.25.1
17+
sigs.k8s.io/controller-runtime v0.23.1
1818
sigs.k8s.io/yaml v1.6.0
1919
)
2020

@@ -101,15 +101,15 @@ require (
101101
go.uber.org/multierr v1.11.0 // indirect
102102
go.yaml.in/yaml/v2 v2.4.3 // indirect
103103
go.yaml.in/yaml/v3 v3.0.4 // indirect
104-
golang.org/x/crypto v0.45.0 // indirect
105-
golang.org/x/net v0.47.0 // indirect
104+
golang.org/x/crypto v0.47.0 // indirect
105+
golang.org/x/net v0.49.0 // indirect
106106
golang.org/x/oauth2 v0.30.0 // indirect
107-
golang.org/x/sync v0.18.0 // indirect
108-
golang.org/x/sys v0.38.0 // indirect
109-
golang.org/x/term v0.37.0 // indirect
110-
golang.org/x/text v0.31.0 // indirect
107+
golang.org/x/sync v0.19.0 // indirect
108+
golang.org/x/sys v0.40.0 // indirect
109+
golang.org/x/term v0.39.0 // indirect
110+
golang.org/x/text v0.33.0 // indirect
111111
golang.org/x/time v0.9.0 // indirect
112-
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
112+
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
113113
gomodules.xyz/jsonpatch/v3 v3.0.1 // indirect
114114
gomodules.xyz/orderedmap v0.1.0 // indirect
115115
google.golang.org/protobuf v1.36.8 // indirect
@@ -123,5 +123,5 @@ require (
123123
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
124124
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
125125
sigs.k8s.io/randfill v1.0.0 // indirect
126-
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
126+
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
127127
)

0 commit comments

Comments
 (0)