This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 a1e5530  fix: Round meta.Time fields to second precision as they are 
marshalled in RFC3339 format
a1e5530 is described below

commit a1e55305ffc34873141c264174b831bb2b45b6ba
Author: Antonin Stefanutti <anto...@stefanutti.fr>
AuthorDate: Tue Oct 12 14:58:07 2021 +0200

    fix: Round meta.Time fields to second precision as they are marshalled in 
RFC3339 format
---
 pkg/apis/camel/v1/integration_types_support.go | 5 ++---
 pkg/controller/integration/initialize.go       | 3 ++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkg/apis/camel/v1/integration_types_support.go 
b/pkg/apis/camel/v1/integration_types_support.go
index 7e2e6f7..d3c8675 100644
--- a/pkg/apis/camel/v1/integration_types_support.go
+++ b/pkg/apis/camel/v1/integration_types_support.go
@@ -20,7 +20,6 @@ package v1
 import (
        "fmt"
        "strings"
-       "time"
 
        corev1 "k8s.io/api/core/v1"
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -351,12 +350,12 @@ func (in *IntegrationStatus) SetErrorCondition(condType 
IntegrationConditionType
 // reason then we are not going to update.
 func (in *IntegrationStatus) SetConditions(conditions ...IntegrationCondition) 
{
        // Round to second precision, as meta.Time fields are marshalled in 
RFC3339 format
-       now := metav1.NewTime(time.Now().Round(time.Second))
+       now := metav1.Now().Rfc3339Copy()
        for _, condition := range conditions {
                currentCond := in.GetCondition(condition.Type)
 
                if currentCond != nil && currentCond.Status == condition.Status 
&& currentCond.Reason == condition.Reason && currentCond.Message == 
condition.Message {
-                       return
+                       break
                }
 
                if condition.LastUpdateTime.IsZero() {
diff --git a/pkg/controller/integration/initialize.go 
b/pkg/controller/integration/initialize.go
index b55066a..8f72899 100644
--- a/pkg/controller/integration/initialize.go
+++ b/pkg/controller/integration/initialize.go
@@ -86,7 +86,8 @@ func (action *initializeAction) Handle(ctx context.Context, 
integration *v1.Inte
        integration.Status.Phase = v1.IntegrationPhaseBuildingKit
        integration.Status.Version = defaults.Version
        if timestamp := integration.Status.InitializationTimestamp; timestamp 
== nil || timestamp.IsZero() {
-               now := metav1.Now()
+               // Round to second precision, as meta.Time fields are 
marshalled in RFC3339 format
+               now := metav1.Now().Rfc3339Copy()
                integration.Status.InitializationTimestamp = &now
        }
 

Reply via email to