astefanutti commented on code in PR #3218:
URL: https://github.com/apache/camel-k/pull/3218#discussion_r853822760


##########
pkg/controller/kameletbinding/kamelet_binding_controller.go:
##########
@@ -214,6 +214,8 @@ func (r *ReconcileKameletBinding) Reconcile(ctx 
context.Context, request reconci
                        break
                }
        }
+       // Update the metadata.Generation to avoid conflicts with other clients 
updating the resource at the same time we are reconciling it.
+       target.Status.ObservedGeneration = instance.Generation

Review Comment:
   This must be added just before line 195.



##########
pkg/controller/kamelet/kamelet_controller.go:
##########
@@ -200,6 +200,9 @@ func (r *reconcileKamelet) Reconcile(ctx context.Context, 
request reconcile.Requ
                break
        }
 
+       // Update the metadata.generation to avoid conflicts with other 
reconcile operations
+       target.Status.ObservedGeneration = instance.GetGeneration()

Review Comment:
   This must be added just before:
   
   ```
   if err := r.client.Status().Patch(ctx, target, ctrl.MergeFrom(&instance)); 
err != nil {
   ```
   
   Line 181.



##########
pkg/controller/integrationkit/integrationkit_controller.go:
##########
@@ -303,6 +303,7 @@ func (r *reconcileIntegrationKit) Reconcile(ctx 
context.Context, request reconci
 
 func (r *reconcileIntegrationKit) update(ctx context.Context, base 
*v1.IntegrationKit, target *v1.IntegrationKit) (reconcile.Result, error) {
        dgst, err := digest.ComputeForIntegrationKit(target)
+       target.Status.ObservedGeneration = base.Generation

Review Comment:
   This is better moved after line 311.



##########
pkg/apis/camel/v1/integrationkit_types.go:
##########
@@ -67,6 +67,8 @@ type IntegrationKitSpec struct {
 
 // IntegrationKitStatus defines the observed state of IntegrationKit
 type IntegrationKitStatus struct {
+       // ObservedGeneration is the last generation change we observed. This 
is used to determine if we need to refresh the status of the integration kit.

Review Comment:
   ```suggestion
        // ObservedGeneration is the most recent generation observed for this 
IntegrationKit.
   ```



##########
pkg/controller/integrationplatform/integrationplatform_controller.go:
##########
@@ -173,6 +173,9 @@ func (r *reconcileIntegrationPlatform) Reconcile(ctx 
context.Context, request re
        target := instance.DeepCopy()
        targetLog := rlog.ForIntegrationPlatform(target)
 
+       // Update the metadata.generation to avoid conflicts with other 
reconcile operations
+       target.Status.ObservedGeneration = instance.Generation

Review Comment:
   I'd recommend to add it just before line 195.



##########
pkg/apis/camel/v1alpha1/kamelet_binding_types.go:
##########
@@ -94,6 +94,8 @@ type EndpointProperties struct {
 
 // KameletBindingStatus specify the status of a binding
 type KameletBindingStatus struct {
+       // ObservedGeneration is the generation observed by the KameletBinding 
controller.

Review Comment:
   ```suggestion
        // ObservedGeneration is the most recent generation observed for this 
KameletBinding.
   ```



##########
pkg/apis/camel/v1/integration_types.go:
##########
@@ -85,6 +85,9 @@ type IntegrationSpec struct {
 
 // IntegrationStatus defines the observed state of Integration
 type IntegrationStatus struct {
+       // ObservedGeneration is the most recent generation observed for this 
Integration.

Review Comment:
   ```suggestion
        // ObservedGeneration is the most recent generation observed for this 
Integration.
   ```



##########
pkg/controller/integration/integration_controller.go:
##########
@@ -338,6 +338,7 @@ func (r *reconcileIntegration) Reconcile(ctx 
context.Context, request reconcile.
 }
 
 func (r *reconcileIntegration) update(ctx context.Context, base 
*v1.Integration, target *v1.Integration) (reconcile.Result, error) {
+       target.Status.ObservedGeneration = base.Generation

Review Comment:
   I'd suggest to move it after line 347.



##########
pkg/apis/camel/v1/build_types.go:
##########
@@ -146,6 +146,8 @@ type S2iTask struct {
 
 // BuildStatus defines the observed state of Build
 type BuildStatus struct {
+       //ObservedGeneration is the most recent generation observed for this 
Build.

Review Comment:
   ```suggestion
        // ObservedGeneration is the most recent generation observed for this 
Build.
   ```



##########
pkg/apis/camel/v1/integrationplatform_types.go:
##########
@@ -52,7 +52,8 @@ type IntegrationPlatformResourcesSpec struct {
 // IntegrationPlatformStatus defines the observed state of IntegrationPlatform
 type IntegrationPlatformStatus struct {
        IntegrationPlatformSpec `json:",inline"`
-
+       // ObservedGeneration is the most recent generation observed by the 
controller. It corresponds to the controller's `metadata.generation` and is 
updated on mutation by the API Server.

Review Comment:
   ```suggestion
        // ObservedGeneration is the most recent generation observed for this 
IntegrationPlatform.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to