This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new a530521b0 chore(dependencies): ctrl runtime 0.23.1
a530521b0 is described below
commit a530521b039810b0b11375ab98e2d28d4ec9242d
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Tue Feb 10 08:29:53 2026 +0100
chore(dependencies): ctrl runtime 0.23.1
---
go.mod | 4 +-
go.sum | 12 +--
helm/camel-k/templates/rbacs-descoped.yaml | 1 +
helm/camel-k/templates/rbacs-namespaced.yaml | 1 +
pkg/client/apply.go | 6 +-
pkg/controller/build/action.go | 6 +-
pkg/controller/build/build_controller.go | 6 +-
pkg/controller/catalog/catalog_controller.go | 6 +-
.../integration/integration_controller.go | 6 +-
.../integrationkit/integrationkit_controller.go | 6 +-
.../integrationplatform_controller.go | 6 +-
pkg/controller/pipe/pipe_controller.go | 6 +-
pkg/event/injectable.go | 4 +-
pkg/event/manager.go | 85 +++++++++++++---------
pkg/internal/fakeStatusWriter.go | 5 ++
.../descoped/operator-cluster-role-events.yaml | 2 +
.../rbac/namespaced/operator-role-events.yaml | 2 +
17 files changed, 97 insertions(+), 67 deletions(-)
diff --git a/go.mod b/go.mod
index 0addffe83..51548a55c 100644
--- a/go.mod
+++ b/go.mod
@@ -50,7 +50,7 @@ require (
knative.dev/eventing v0.48.0
knative.dev/pkg v0.0.0-20260120122510-4a022ed9999a
knative.dev/serving v0.48.1
- sigs.k8s.io/controller-runtime v0.22.4
+ sigs.k8s.io/controller-runtime v0.23.1
sigs.k8s.io/structured-merge-diff/v6 v6.3.2
)
@@ -138,7 +138,7 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
- k8s.io/apiextensions-apiserver v0.34.3 // indirect
+ k8s.io/apiextensions-apiserver v0.35.0 // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
knative.dev/networking v0.0.0-20260120131110-a7cdca238a0d // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
diff --git a/go.sum b/go.sum
index 6e5850084..97bfce98b 100644
--- a/go.sum
+++ b/go.sum
@@ -446,12 +446,12 @@ gopkg.in/yaml.v3 v3.0.1
h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.35.0 h1:iBAU5LTyBI9vw3L5glmat1njFK34srdLmktWwLTprlY=
k8s.io/api v0.35.0/go.mod h1:AQ0SNTzm4ZAczM03QH42c7l3bih1TbAXYo0DkF8ktnA=
-k8s.io/apiextensions-apiserver v0.34.3
h1:p10fGlkDY09eWKOTeUSioxwLukJnm+KuDZdrW71y40g=
-k8s.io/apiextensions-apiserver v0.34.3/go.mod
h1:aujxvqGFRdb/cmXYfcRTeppN7S2XV/t7WMEc64zB5A0=
+k8s.io/apiextensions-apiserver v0.35.0
h1:3xHk2rTOdWXXJM+RDQZJvdx0yEOgC0FgQ1PlJatA5T4=
+k8s.io/apiextensions-apiserver v0.35.0/go.mod
h1:E1Ahk9SADaLQ4qtzYFkwUqusXTcaV2uw3l14aqpL2LU=
k8s.io/apimachinery v0.35.0 h1:Z2L3IHvPVv/MJ7xRxHEtk6GoJElaAqDCCU0S6ncYok8=
k8s.io/apimachinery v0.35.0/go.mod
h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns=
-k8s.io/apiserver v0.34.3 h1:uGH1qpDvSiYG4HVFqc6A3L4CKiX+aBWDrrsxHYK0Bdo=
-k8s.io/apiserver v0.34.3/go.mod h1:QPnnahMO5C2m3lm6fPW3+JmyQbvHZQ8uudAu/493P2w=
+k8s.io/apiserver v0.35.0 h1:CUGo5o+7hW9GcAEF3x3usT3fX4f9r8xmgQeCBDaOgX4=
+k8s.io/apiserver v0.35.0/go.mod h1:QUy1U4+PrzbJaM3XGu2tQ7U9A4udRRo5cyxkFX0GEds=
k8s.io/cli-runtime v0.35.0 h1:PEJtYS/Zr4p20PfZSLCbY6YvaoLrfByd6THQzPworUE=
k8s.io/cli-runtime v0.35.0/go.mod
h1:VBRvHzosVAoVdP3XwUQn1Oqkvaa8facnokNkD7jOTMY=
k8s.io/client-go v0.35.0 h1:IAW0ifFbfQQwQmga0UdoH0yvdqrbwMdq9vIFEhRpxBE=
@@ -473,8 +473,8 @@ knative.dev/pkg v0.0.0-20260120122510-4a022ed9999a
h1:9f29OTA7w/iVIX6PS6yveVVzNb
knative.dev/pkg v0.0.0-20260120122510-4a022ed9999a/go.mod
h1:Tz3GoxcNC5vH3Zo//cW3mnHL474u+Y1wbsUIZ11p8No=
knative.dev/serving v0.48.1 h1:Tm8s/KbtnGp/8srGa+r4ETyO+2+8FhG6qX/NPeRyTJo=
knative.dev/serving v0.48.1/go.mod
h1:GvDc19mU7RIzYjx9a3MCX16LAVIL6RPD+QBgBu4NSKI=
-sigs.k8s.io/controller-runtime v0.22.4
h1:GEjV7KV3TY8e+tJ2LCTxUTanW4z/FmNB7l327UfMq9A=
-sigs.k8s.io/controller-runtime v0.22.4/go.mod
h1:+QX1XUpTXN4mLoblf4tqr5CQcyHPAki2HLXqQMY6vh8=
+sigs.k8s.io/controller-runtime v0.23.1
h1:TjJSM80Nf43Mg21+RCy3J70aj/W6KyvDtOlpKf+PupE=
+sigs.k8s.io/controller-runtime v0.23.1/go.mod
h1:B6COOxKptp+YaUT5q4l6LqUJTRpizbgf9KSRNdQGns0=
sigs.k8s.io/gateway-api v1.1.0 h1:DsLDXCi6jR+Xz8/xd0Z1PYl2Pn0TyaFMOPPZIj4inDM=
sigs.k8s.io/gateway-api v1.1.0/go.mod
h1:ZH4lHrL2sDi0FHZ9jjneb8kKnGzFWyrTya35sWUTrRs=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730
h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
diff --git a/helm/camel-k/templates/rbacs-descoped.yaml
b/helm/camel-k/templates/rbacs-descoped.yaml
index a6b783931..66fd8d427 100644
--- a/helm/camel-k/templates/rbacs-descoped.yaml
+++ b/helm/camel-k/templates/rbacs-descoped.yaml
@@ -213,6 +213,7 @@ metadata:
rules:
- apiGroups:
- ""
+ - events.k8s.io
resources:
- events
verbs:
diff --git a/helm/camel-k/templates/rbacs-namespaced.yaml
b/helm/camel-k/templates/rbacs-namespaced.yaml
index c16ff383c..6395d14a6 100644
--- a/helm/camel-k/templates/rbacs-namespaced.yaml
+++ b/helm/camel-k/templates/rbacs-namespaced.yaml
@@ -208,6 +208,7 @@ metadata:
rules:
- apiGroups:
- ""
+ - events.k8s.io
resources:
- events
verbs:
diff --git a/pkg/client/apply.go b/pkg/client/apply.go
index ddf0c6b8b..7353fcb74 100644
--- a/pkg/client/apply.go
+++ b/pkg/client/apply.go
@@ -85,7 +85,11 @@ func (a *ServerOrClientSideApplier) serverSideApply(ctx
context.Context, resourc
if err != nil {
return err
}
- if err = a.Client.Patch(ctx, target, ctrl.Apply, ctrl.ForceOwnership,
ctrl.FieldOwner("camel-k-operator")); err != nil {
+ data, err := json.Marshal(target.Object)
+ if err != nil {
+ return err
+ }
+ if err = a.Client.Patch(ctx, target,
ctrl.RawPatch(types.ApplyPatchType, data), ctrl.ForceOwnership,
ctrl.FieldOwner("camel-k-operator")); err != nil {
return fmt.Errorf("error during apply resource: %s/%s: %w",
resource.GetNamespace(), resource.GetName(), err)
}
diff --git a/pkg/controller/build/action.go b/pkg/controller/build/action.go
index 65df81c6c..1db565837 100644
--- a/pkg/controller/build/action.go
+++ b/pkg/controller/build/action.go
@@ -20,7 +20,7 @@ package build
import (
"context"
- "k8s.io/client-go/tools/record"
+ "k8s.io/client-go/tools/events"
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/client"
@@ -47,7 +47,7 @@ type Action interface {
type baseAction struct {
client client.Client
L log.Logger
- recorder record.EventRecorder
+ recorder events.EventRecorder
}
func (action *baseAction) InjectClient(client client.Client) {
@@ -58,6 +58,6 @@ func (action *baseAction) InjectLogger(log log.Logger) {
action.L = log
}
-func (action *baseAction) InjectRecorder(recorder record.EventRecorder) {
+func (action *baseAction) InjectRecorder(recorder events.EventRecorder) {
action.recorder = recorder
}
diff --git a/pkg/controller/build/build_controller.go
b/pkg/controller/build/build_controller.go
index e7f075c1c..ca0b4bc46 100644
--- a/pkg/controller/build/build_controller.go
+++ b/pkg/controller/build/build_controller.go
@@ -26,7 +26,6 @@ import (
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/tools/record"
"sigs.k8s.io/controller-runtime/pkg/builder"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
@@ -39,6 +38,7 @@ import (
camelevent "github.com/apache/camel-k/v2/pkg/event"
"github.com/apache/camel-k/v2/pkg/platform"
"github.com/apache/camel-k/v2/pkg/util/monitoring"
+ "k8s.io/client-go/tools/events"
)
const (
@@ -58,7 +58,7 @@ func newReconciler(mgr manager.Manager, c client.Client)
reconcile.Reconciler {
client: c,
reader: mgr.GetAPIReader(),
scheme: mgr.GetScheme(),
- recorder:
mgr.GetEventRecorderFor("camel-k-build-controller"),
+ recorder:
mgr.GetEventRecorder("camel-k-build-controller"),
},
schema.GroupVersionKind{
Group: v1.SchemeGroupVersion.Group,
@@ -104,7 +104,7 @@ type reconcileBuild struct {
// like in the builds scheduling critical section
reader ctrl.Reader
scheme *runtime.Scheme
- recorder record.EventRecorder
+ recorder events.EventRecorder
}
// Reconcile reads that state of the cluster for a Build object and makes
changes based on the state read
diff --git a/pkg/controller/catalog/catalog_controller.go
b/pkg/controller/catalog/catalog_controller.go
index 7aa14ec39..3d2477b9c 100644
--- a/pkg/controller/catalog/catalog_controller.go
+++ b/pkg/controller/catalog/catalog_controller.go
@@ -25,7 +25,7 @@ import (
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/tools/record"
+ "k8s.io/client-go/tools/events"
"sigs.k8s.io/controller-runtime/pkg/builder"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
@@ -56,7 +56,7 @@ func newReconciler(mgr manager.Manager, c client.Client)
reconcile.Reconciler {
&reconcileCatalog{
client: c,
scheme: mgr.GetScheme(),
- recorder:
mgr.GetEventRecorderFor("camel-k-catalog-controller"),
+ recorder:
mgr.GetEventRecorder("camel-k-catalog-controller"),
},
schema.GroupVersionKind{
Group: v1.SchemeGroupVersion.Group,
@@ -106,7 +106,7 @@ type reconcileCatalog struct {
// that reads objects from the cache and writes to the API server
client client.Client
scheme *runtime.Scheme
- recorder record.EventRecorder
+ recorder events.EventRecorder
}
// Reconcile reads that state of the cluster for a catalog object and makes
changes based
diff --git a/pkg/controller/integration/integration_controller.go
b/pkg/controller/integration/integration_controller.go
index 49cd378c2..56f9115b6 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -31,7 +31,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
- "k8s.io/client-go/tools/record"
+ "k8s.io/client-go/tools/events"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/builder"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
@@ -78,7 +78,7 @@ func newReconciler(mgr manager.Manager, c client.Client)
reconcile.Reconciler {
&reconcileIntegration{
client: c,
scheme: mgr.GetScheme(),
- recorder:
mgr.GetEventRecorderFor("camel-k-integration-controller"),
+ recorder:
mgr.GetEventRecorder("camel-k-integration-controller"),
},
schema.GroupVersionKind{
Group: v1.SchemeGroupVersion.Group,
@@ -455,7 +455,7 @@ type reconcileIntegration struct {
// that reads objects from the cache and writes to the API server
client client.Client
scheme *runtime.Scheme
- recorder record.EventRecorder
+ recorder events.EventRecorder
}
// Reconcile reads that state of the cluster for an Integration object and
makes changes based on the state read
diff --git a/pkg/controller/integrationkit/integrationkit_controller.go
b/pkg/controller/integrationkit/integrationkit_controller.go
index 74d566c49..2d603c12b 100644
--- a/pkg/controller/integrationkit/integrationkit_controller.go
+++ b/pkg/controller/integrationkit/integrationkit_controller.go
@@ -25,7 +25,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
- "k8s.io/client-go/tools/record"
+ "k8s.io/client-go/tools/events"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
@@ -59,7 +59,7 @@ func newReconciler(mgr manager.Manager, c client.Client)
reconcile.Reconciler {
&reconcileIntegrationKit{
client: c,
scheme: mgr.GetScheme(),
- recorder:
mgr.GetEventRecorderFor("camel-k-integration-kit-controller"),
+ recorder:
mgr.GetEventRecorder("camel-k-integration-kit-controller"),
},
schema.GroupVersionKind{
Group: v1.SchemeGroupVersion.Group,
@@ -182,7 +182,7 @@ type reconcileIntegrationKit struct {
// that reads objects from the cache and writes to the API server
client client.Client
scheme *runtime.Scheme
- recorder record.EventRecorder
+ recorder events.EventRecorder
}
// Reconcile reads that state of the cluster for a IntegrationKit object and
makes changes based on the state read
diff --git
a/pkg/controller/integrationplatform/integrationplatform_controller.go
b/pkg/controller/integrationplatform/integrationplatform_controller.go
index ac8525320..27fef840e 100644
--- a/pkg/controller/integrationplatform/integrationplatform_controller.go
+++ b/pkg/controller/integrationplatform/integrationplatform_controller.go
@@ -23,7 +23,7 @@ import (
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/tools/record"
+ "k8s.io/client-go/tools/events"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
@@ -52,7 +52,7 @@ func newReconciler(mgr manager.Manager, c client.Client)
reconcile.Reconciler {
client: c,
reader: mgr.GetAPIReader(),
scheme: mgr.GetScheme(),
- recorder:
mgr.GetEventRecorderFor("camel-k-integration-platform-controller"),
+ recorder:
mgr.GetEventRecorder("camel-k-integration-platform-controller"),
},
schema.GroupVersionKind{
Group: v1.SchemeGroupVersion.Group,
@@ -106,7 +106,7 @@ type reconcileIntegrationPlatform struct {
// Non-caching client
reader ctrl.Reader
scheme *runtime.Scheme
- recorder record.EventRecorder
+ recorder events.EventRecorder
}
// Reconcile reads that state of the cluster for a IntegrationPlatform object
and makes changes based
diff --git a/pkg/controller/pipe/pipe_controller.go
b/pkg/controller/pipe/pipe_controller.go
index f124f54ed..731a3cfd1 100644
--- a/pkg/controller/pipe/pipe_controller.go
+++ b/pkg/controller/pipe/pipe_controller.go
@@ -23,7 +23,7 @@ import (
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/tools/record"
+ "k8s.io/client-go/tools/events"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
@@ -55,7 +55,7 @@ func newReconciler(mgr manager.Manager, c client.Client)
reconcile.Reconciler {
&ReconcilePipe{
client: c,
scheme: mgr.GetScheme(),
- recorder:
mgr.GetEventRecorderFor("camel-k-pipe-controller"),
+ recorder:
mgr.GetEventRecorder("camel-k-pipe-controller"),
},
schema.GroupVersionKind{
Group: v1.SchemeGroupVersion.Group,
@@ -134,7 +134,7 @@ type ReconcilePipe struct {
// that reads objects from the cache and writes to the API server
client client.Client
scheme *runtime.Scheme
- recorder record.EventRecorder
+ recorder events.EventRecorder
}
// Reconcile reads that state of the cluster for a Pipe object and makes
changes based
diff --git a/pkg/event/injectable.go b/pkg/event/injectable.go
index c1b3ee33f..929b9491c 100644
--- a/pkg/event/injectable.go
+++ b/pkg/event/injectable.go
@@ -17,8 +17,8 @@ limitations under the License.
package event
-import "k8s.io/client-go/tools/record"
+import "k8s.io/client-go/tools/events"
type Injectable interface {
- InjectRecorder(recorder record.EventRecorder)
+ InjectRecorder(recorder events.EventRecorder)
}
diff --git a/pkg/event/manager.go b/pkg/event/manager.go
index cc81c2dca..633e383bb 100644
--- a/pkg/event/manager.go
+++ b/pkg/event/manager.go
@@ -23,7 +23,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
- "k8s.io/client-go/tools/record"
+ "k8s.io/client-go/tools/events"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
@@ -88,7 +88,7 @@ const (
)
// NotifyIntegrationError automatically generates error events when the
integration reconcile cycle phase has an error.
-func NotifyIntegrationError(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.Integration, err error) {
+func NotifyIntegrationError(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.Integration, err error) {
it := old
if newResource != nil {
it = newResource
@@ -96,11 +96,11 @@ func NotifyIntegrationError(ctx context.Context, c
client.Client, recorder recor
if it == nil {
return
}
- recorder.Eventf(it, corev1.EventTypeWarning, ReasonIntegrationError,
"Cannot reconcile Integration %s: %v", it.Name, err)
+ recorder.Eventf(it, nil, corev1.EventTypeWarning,
ReasonIntegrationError, "Cannot reconcile Integration %s: %v", it.Name, err)
}
// NotifyIntegrationUpdated automatically generates events when the
integration changes.
-func NotifyIntegrationUpdated(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.Integration) {
+func NotifyIntegrationUpdated(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.Integration) {
if newResource == nil {
return
}
@@ -111,13 +111,15 @@ func NotifyIntegrationUpdated(ctx context.Context, c
client.Client, recorder rec
oldConditions = old.Status.GetConditions()
}
if newResource.Status.Phase != v1.IntegrationPhaseNone {
- notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(), "Integration", newResource.Name,
ReasonIntegrationConditionChanged)
+ notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(),
+ "Integration", newResource.Name,
ReasonIntegrationConditionChanged)
}
- notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase), "Integration", newResource.Name,
ReasonIntegrationPhaseUpdated, "")
+ notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase),
+ "Integration", newResource.Name, ReasonIntegrationPhaseUpdated,
"")
}
// NotifyIntegrationKitUpdated automatically generates events when an
integration kit changes.
-func NotifyIntegrationKitUpdated(ctx context.Context, c client.Client,
recorder record.EventRecorder, old, newResource *v1.IntegrationKit) {
+func NotifyIntegrationKitUpdated(ctx context.Context, c client.Client,
recorder events.EventRecorder, old, newResource *v1.IntegrationKit) {
if newResource == nil {
return
}
@@ -128,13 +130,15 @@ func NotifyIntegrationKitUpdated(ctx context.Context, c
client.Client, recorder
oldConditions = old.Status.GetConditions()
}
if newResource.Status.Phase != v1.IntegrationKitPhaseNone {
- notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(), "Integration Kit", newResource.Name,
ReasonIntegrationKitConditionChanged)
+ notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(),
+ "Integration Kit", newResource.Name,
ReasonIntegrationKitConditionChanged)
}
- notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase), "Integration Kit", newResource.Name,
ReasonIntegrationKitPhaseUpdated, "")
+ notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase),
+ "Integration Kit", newResource.Name,
ReasonIntegrationKitPhaseUpdated, "")
}
// NotifyIntegrationKitError automatically generates error events when the
integration kit reconcile cycle phase has an error.
-func NotifyIntegrationKitError(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.IntegrationKit, err error) {
+func NotifyIntegrationKitError(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.IntegrationKit, err error) {
kit := old
if newResource != nil {
kit = newResource
@@ -142,11 +146,11 @@ func NotifyIntegrationKitError(ctx context.Context, c
client.Client, recorder re
if kit == nil {
return
}
- recorder.Eventf(kit, corev1.EventTypeWarning,
ReasonIntegrationKitError, "Cannot reconcile Integration Kit %s: %v", kit.Name,
err)
+ recorder.Eventf(kit, nil, corev1.EventTypeWarning,
ReasonIntegrationKitError, "Cannot reconcile Integration Kit %s: %v", kit.Name,
err)
}
// NotifyIntegrationPlatformUpdated automatically generates events when an
integration platform changes.
-func NotifyIntegrationPlatformUpdated(ctx context.Context, c client.Client,
recorder record.EventRecorder, old, newResource *v1.IntegrationPlatform) {
+func NotifyIntegrationPlatformUpdated(ctx context.Context, c client.Client,
recorder events.EventRecorder, old, newResource *v1.IntegrationPlatform) {
if newResource == nil {
return
}
@@ -157,13 +161,15 @@ func NotifyIntegrationPlatformUpdated(ctx
context.Context, c client.Client, reco
oldConditions = old.Status.GetConditions()
}
if newResource.Status.Phase != v1.IntegrationPlatformPhaseNone {
- notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(), "Integration Platform", newResource.Name,
ReasonIntegrationPlatformConditionChanged)
+ notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(),
+ "Integration Platform", newResource.Name,
ReasonIntegrationPlatformConditionChanged)
}
- notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase), "Integration Platform", newResource.Name,
ReasonIntegrationPlatformPhaseUpdated, "")
+ notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase),
+ "Integration Platform", newResource.Name,
ReasonIntegrationPlatformPhaseUpdated, "")
}
// NotifyIntegrationPlatformError automatically generates error events when
the integration Platform reconcile cycle phase has an error.
-func NotifyIntegrationPlatformError(ctx context.Context, c client.Client,
recorder record.EventRecorder, old, newResource *v1.IntegrationPlatform, err
error) {
+func NotifyIntegrationPlatformError(ctx context.Context, c client.Client,
recorder events.EventRecorder, old, newResource *v1.IntegrationPlatform, err
error) {
p := old
if newResource != nil {
p = newResource
@@ -171,11 +177,11 @@ func NotifyIntegrationPlatformError(ctx context.Context,
c client.Client, record
if p == nil {
return
}
- recorder.Eventf(p, corev1.EventTypeWarning,
ReasonIntegrationPlatformError, "Cannot reconcile Integration Platform %s: %v",
p.Name, err)
+ recorder.Eventf(p, nil, corev1.EventTypeWarning,
ReasonIntegrationPlatformError, "Cannot reconcile Integration Platform %s: %v",
p.Name, err)
}
// NotifyCamelCatalogUpdated automatically generates events when a
CamelCatalog changes.
-func NotifyCamelCatalogUpdated(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.CamelCatalog) {
+func NotifyCamelCatalogUpdated(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.CamelCatalog) {
if newResource == nil {
return
}
@@ -186,13 +192,15 @@ func NotifyCamelCatalogUpdated(ctx context.Context, c
client.Client, recorder re
oldConditions = old.Status.GetConditions()
}
if newResource.Status.Phase != v1.CamelCatalogPhaseNone {
- notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(), "CamelCatalog", newResource.Name,
ReasonKameletConditionChanged)
+ notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(),
+ "CamelCatalog", newResource.Name,
ReasonKameletConditionChanged)
}
- notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase), "CamelCatalog", newResource.Name,
ReasonKameletPhaseUpdated, "")
+ notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase),
+ "CamelCatalog", newResource.Name, ReasonKameletPhaseUpdated, "")
}
// NotifyCamelCatalogError automatically generates error events when the
CamelCatalog reconcile cycle phase has an error.
-func NotifyCamelCatalogError(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.CamelCatalog, err error) {
+func NotifyCamelCatalogError(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.CamelCatalog, err error) {
k := old
if newResource != nil {
k = newResource
@@ -200,11 +208,11 @@ func NotifyCamelCatalogError(ctx context.Context, c
client.Client, recorder reco
if k == nil {
return
}
- recorder.Eventf(k, corev1.EventTypeWarning, ReasonKameletError, "Cannot
reconcile CamelCatalog %s: %v", k.Name, err)
+ recorder.Eventf(k, nil, corev1.EventTypeWarning, ReasonKameletError,
"Cannot reconcile CamelCatalog %s: %v", k.Name, err)
}
// NotifyPipeUpdated automatically generates events when a Pipe changes.
-func NotifyPipeUpdated(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.Pipe) {
+func NotifyPipeUpdated(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.Pipe) {
if newResource == nil {
return
}
@@ -215,13 +223,15 @@ func NotifyPipeUpdated(ctx context.Context, c
client.Client, recorder record.Eve
oldConditions = old.Status.GetConditions()
}
if newResource.Status.Phase != v1.PipePhaseNone {
- notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(), "Pipe", newResource.Name,
ReasonPipeConditionChanged)
+ notifyIfConditionUpdated(recorder, newResource, oldConditions,
newResource.Status.GetConditions(),
+ "Pipe", newResource.Name, ReasonPipeConditionChanged)
}
- notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase), "Pipe", newResource.Name,
ReasonPipePhaseUpdated, "")
+ notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase,
string(newResource.Status.Phase),
+ "Pipe", newResource.Name, ReasonPipePhaseUpdated, "")
}
// NotifyPipeError automatically generates error events when the binding
reconcile cycle phase has an error.
-func NotifyPipeError(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.Pipe, err error) {
+func NotifyPipeError(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.Pipe, err error) {
k := old
if newResource != nil {
k = newResource
@@ -229,11 +239,11 @@ func NotifyPipeError(ctx context.Context, c
client.Client, recorder record.Event
if k == nil {
return
}
- recorder.Eventf(k, corev1.EventTypeWarning, ReasonKameletError, "Cannot
reconcile Pipe %s: %v", k.Name, err)
+ recorder.Eventf(k, nil, corev1.EventTypeWarning, ReasonKameletError,
"Cannot reconcile Pipe %s: %v", k.Name, err)
}
// NotifyBuildUpdated automatically generates events when a build changes.
-func NotifyBuildUpdated(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.Build) {
+func NotifyBuildUpdated(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.Build) {
if newResource == nil {
return
}
@@ -256,7 +266,7 @@ func NotifyBuildUpdated(ctx context.Context, c
client.Client, recorder record.Ev
}
// NotifyBuildError automatically generates error events when the build
reconcile cycle phase has an error.
-func NotifyBuildError(ctx context.Context, c client.Client, recorder
record.EventRecorder, old, newResource *v1.Build, err error) {
+func NotifyBuildError(ctx context.Context, c client.Client, recorder
events.EventRecorder, old, newResource *v1.Build, err error) {
p := old
if newResource != nil {
p = newResource
@@ -264,11 +274,12 @@ func NotifyBuildError(ctx context.Context, c
client.Client, recorder record.Even
if p == nil {
return
}
- recorder.Eventf(p, corev1.EventTypeWarning, ReasonBuildError, "Cannot
reconcile Build %s: %v", p.Name, err)
+ recorder.Eventf(p, nil, corev1.EventTypeWarning, ReasonBuildError,
"Cannot reconcile Build %s: %v", p.Name, err)
}
//nolint:lll
-func notifyIfPhaseUpdated(ctx context.Context, c client.Client, recorder
record.EventRecorder, newResource ctrl.Object, oldPhase, newPhase string,
resourceType, name, reason, info string) {
+func notifyIfPhaseUpdated(ctx context.Context, c client.Client, recorder
events.EventRecorder,
+ newResource ctrl.Object, oldPhase, newPhase string, resourceType, name,
reason, info string) {
if oldPhase == newPhase {
return
}
@@ -278,25 +289,29 @@ func notifyIfPhaseUpdated(ctx context.Context, c
client.Client, recorder record.
if phase == "" {
phase = "[none]"
}
- recorder.Eventf(newResource, corev1.EventTypeNormal, reason, "%s %q in
phase %q%s", resourceType, name, phase, info)
+ recorder.Eventf(newResource, nil, corev1.EventTypeNormal, reason, "%s
%q in phase %q%s", resourceType, name, phase, info)
if creatorRef, creator := getCreatorObject(ctx, c, newResource);
creatorRef != nil && creator != nil {
if namespace := newResource.GetNamespace(); namespace ==
creatorRef.Namespace {
- recorder.Eventf(creator, corev1.EventTypeNormal,
ReasonRelatedObjectChanged, "%s %q, created by %s %q, changed phase to %q%s",
resourceType, name, creatorRef.Kind, creatorRef.Name, phase, info)
+ recorder.Eventf(creator, nil, corev1.EventTypeNormal,
ReasonRelatedObjectChanged,
+ "%s %q, created by %s %q, changed phase to
%q%s", resourceType, name, creatorRef.Kind, creatorRef.Name, phase, info)
} else {
- recorder.Eventf(creator, corev1.EventTypeNormal,
ReasonRelatedObjectChanged, "%s \"%s/%s\", created by %s %q, changed phase to
%q%s", resourceType, namespace, name, creatorRef.Kind, creatorRef.Name, phase,
info)
+ recorder.Eventf(creator, nil, corev1.EventTypeNormal,
ReasonRelatedObjectChanged,
+ "%s \"%s/%s\", created by %s %q, changed phase
to %q%s", resourceType, namespace, name, creatorRef.Kind, creatorRef.Name,
phase, info)
}
}
}
-func notifyIfConditionUpdated(recorder record.EventRecorder, newResource
runtime.Object, oldConditions, newConditions []v1.ResourceCondition,
resourceType, name, reason string) {
+func notifyIfConditionUpdated(recorder events.EventRecorder, newResource
runtime.Object, oldConditions,
+ newConditions []v1.ResourceCondition, resourceType, name, reason
string) {
// Update information about changes in conditions
for _, cond := range getCommonChangedConditions(oldConditions,
newConditions) {
tail := ""
if cond.GetMessage() != "" {
tail = ": " + cond.GetMessage()
}
- recorder.Eventf(newResource, corev1.EventTypeNormal, reason,
"Condition %q is %q for %s %s%s", cond.GetType(), cond.GetStatus(),
resourceType, name, tail)
+ recorder.Eventf(newResource, nil, corev1.EventTypeNormal,
reason, "Condition %q is %q for %s %s%s",
+ cond.GetType(), cond.GetStatus(), resourceType, name,
tail)
}
}
diff --git a/pkg/internal/fakeStatusWriter.go b/pkg/internal/fakeStatusWriter.go
index 792efa816..080143f5c 100644
--- a/pkg/internal/fakeStatusWriter.go
+++ b/pkg/internal/fakeStatusWriter.go
@@ -20,6 +20,7 @@ package internal
import (
"context"
+ "k8s.io/apimachinery/pkg/runtime"
controller "sigs.k8s.io/controller-runtime/pkg/client"
)
@@ -37,3 +38,7 @@ func (c *FakeStatusWriter) Create(ctx context.Context, obj
controller.Object, su
func (c *FakeStatusWriter) Update(ctx context.Context, obj controller.Object,
opts ...controller.SubResourceUpdateOption) error {
return nil
}
+
+func (c *FakeStatusWriter) Apply(ctx context.Context, conf
runtime.ApplyConfiguration, opts ...controller.SubResourceApplyOption) error {
+ return nil
+}
diff --git
a/pkg/resources/config/rbac/descoped/operator-cluster-role-events.yaml
b/pkg/resources/config/rbac/descoped/operator-cluster-role-events.yaml
index 1dfd24b01..21bd4eaa9 100644
--- a/pkg/resources/config/rbac/descoped/operator-cluster-role-events.yaml
+++ b/pkg/resources/config/rbac/descoped/operator-cluster-role-events.yaml
@@ -23,7 +23,9 @@ metadata:
app: "camel-k"
rules:
- apiGroups:
+ # Deprecated: this legacy group is replaced by events.k8s.io from version
2.10.0 onward
- ""
+ - "events.k8s.io"
resources:
- events
verbs:
diff --git a/pkg/resources/config/rbac/namespaced/operator-role-events.yaml
b/pkg/resources/config/rbac/namespaced/operator-role-events.yaml
index d109b734d..41068234d 100644
--- a/pkg/resources/config/rbac/namespaced/operator-role-events.yaml
+++ b/pkg/resources/config/rbac/namespaced/operator-role-events.yaml
@@ -23,7 +23,9 @@ metadata:
app: "camel-k"
rules:
- apiGroups:
+ # Deprecated: this legacy group is replaced by events.k8s.io from version
2.10.0 onward
- ""
+ - "events.k8s.io"
resources:
- events
verbs: