diff --git a/RELEASE.md b/RELEASE.md index 6d06ea266..2e89b61b0 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,6 @@ ## Release Note 🍻 -EMQX Operator 1.2.7-ecp.3 is released. +EMQX Operator 1.2.7-ecp.4 is released. ### Supported EMQX version @@ -10,4 +10,4 @@ EMQX Operator 1.2.7-ecp.3 is released. ### Fixes 🛠 -- Fixed the bug where the service port disappears when a node in the EMQX cluster crashes. +- Fixed the bug where the `resourceVersion` of the EMQX customer resource always changes. diff --git a/apis/apps/v1beta3/status_types.go b/apis/apps/v1beta3/status_types.go index ff0038965..46ff79af2 100644 --- a/apis/apps/v1beta3/status_types.go +++ b/apis/apps/v1beta3/status_types.go @@ -2,7 +2,6 @@ package v1beta3 import ( "sort" - "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -17,11 +16,8 @@ type Condition struct { Type ConditionType `json:"type"` // Status of the condition, one of True, False, Unknown. Status corev1.ConditionStatus `json:"status"` - // The last time this condition was updated. - LastUpdateTime string `json:"lastUpdateTime,omitempty"` - LastUpdateAt metav1.Time `json:"-"` // Last time the condition transitioned from one status to another. - LastTransitionTime string `json:"lastTransitionTime,omitempty"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` // The reason for the condition's last transition. Reason string `json:"reason,omitempty"` // A human readable message indicating details about the transition. @@ -36,7 +32,7 @@ const ( ConditionRunning ConditionType = "Running" ) -//+kubebuilder:object:generate=false +// +kubebuilder:object:generate=false type EmqxStatus interface { IsRunning() bool IsPluginInitialized() bool @@ -69,14 +65,10 @@ type Status struct { } func NewCondition(condType ConditionType, status corev1.ConditionStatus, reason, message string) *Condition { - now := metav1.Now() - nowString := now.Format(time.RFC3339) return &Condition{ Type: condType, Status: status, - LastUpdateTime: nowString, - LastUpdateAt: now, - LastTransitionTime: nowString, + LastTransitionTime: metav1.Now(), Reason: reason, Message: message, } @@ -109,17 +101,11 @@ func (s *Status) GetConditions() []Condition { func (s *Status) SetCondition(c Condition) { pos, cp := getCondition(s, c.Type) - if cp != nil && - cp.Status == c.Status && cp.Reason == c.Reason && cp.Message == c.Message { - now := metav1.Now() - nowString := now.Format(time.RFC3339) - s.Conditions[pos].LastUpdateAt = now - s.Conditions[pos].LastUpdateTime = nowString - s.sortConditions(s.Conditions) - return - } if cp != nil { + if cp.Status == c.Status && cp.Reason == c.Reason && cp.Message == c.Message { + return + } s.Conditions[pos] = c } else { s.Conditions = append(s.Conditions, c) @@ -138,7 +124,7 @@ func (s *Status) ClearCondition(t ConditionType) { func (s *Status) sortConditions(conditions []Condition) { sort.Slice(conditions, func(i, j int) bool { - return s.Conditions[j].LastUpdateAt.Before(&s.Conditions[i].LastUpdateAt) + return s.Conditions[j].LastTransitionTime.Before(&s.Conditions[i].LastTransitionTime) }) } diff --git a/apis/apps/v1beta3/zz_generated.deepcopy.go b/apis/apps/v1beta3/zz_generated.deepcopy.go index c94522e92..fdf94ef30 100644 --- a/apis/apps/v1beta3/zz_generated.deepcopy.go +++ b/apis/apps/v1beta3/zz_generated.deepcopy.go @@ -29,7 +29,7 @@ import ( // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Condition) DeepCopyInto(out *Condition) { *out = *in - in.LastUpdateAt.DeepCopyInto(&out.LastUpdateAt) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. diff --git a/config/crd/bases/apps.emqx.io_emqxbrokers.yaml b/config/crd/bases/apps.emqx.io_emqxbrokers.yaml index bd435ada4..9f0aedad0 100644 --- a/config/crd/bases/apps.emqx.io_emqxbrokers.yaml +++ b/config/crd/bases/apps.emqx.io_emqxbrokers.yaml @@ -6329,9 +6329,7 @@ spec: lastTransitionTime: description: Last time the condition transitioned from one status to another. - type: string - lastUpdateTime: - description: The last time this condition was updated. + format: date-time type: string message: description: A human readable message indicating details about diff --git a/config/crd/bases/apps.emqx.io_emqxenterprises.yaml b/config/crd/bases/apps.emqx.io_emqxenterprises.yaml index bf018ae01..2b251377d 100644 --- a/config/crd/bases/apps.emqx.io_emqxenterprises.yaml +++ b/config/crd/bases/apps.emqx.io_emqxenterprises.yaml @@ -6355,9 +6355,7 @@ spec: lastTransitionTime: description: Last time the condition transitioned from one status to another. - type: string - lastUpdateTime: - description: The last time this condition was updated. + format: date-time type: string message: description: A human readable message indicating details about diff --git a/deploy/charts/emqx-operator/Chart.yaml b/deploy/charts/emqx-operator/Chart.yaml index bee4f1ebe..a15a4bba2 100644 --- a/deploy/charts/emqx-operator/Chart.yaml +++ b/deploy/charts/emqx-operator/Chart.yaml @@ -15,9 +15,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.11-ecp.2 +version: 1.0.11-ecp.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 1.2.7-ecp.3 \ No newline at end of file +appVersion: 1.2.7-ecp.4 diff --git a/deploy/charts/emqx-operator/templates/crd-emqx-brokers.yaml b/deploy/charts/emqx-operator/templates/crd-emqx-brokers.yaml index ce9e3d465..a48f71737 100644 --- a/deploy/charts/emqx-operator/templates/crd-emqx-brokers.yaml +++ b/deploy/charts/emqx-operator/templates/crd-emqx-brokers.yaml @@ -6341,9 +6341,7 @@ spec: lastTransitionTime: description: Last time the condition transitioned from one status to another. - type: string - lastUpdateTime: - description: The last time this condition was updated. + format: date-time type: string message: description: A human readable message indicating details about diff --git a/deploy/charts/emqx-operator/templates/crd-emqx-enterprise.yaml b/deploy/charts/emqx-operator/templates/crd-emqx-enterprise.yaml index fdfbb7234..4e8e82f67 100644 --- a/deploy/charts/emqx-operator/templates/crd-emqx-enterprise.yaml +++ b/deploy/charts/emqx-operator/templates/crd-emqx-enterprise.yaml @@ -6367,9 +6367,7 @@ spec: lastTransitionTime: description: Last time the condition transitioned from one status to another. - type: string - lastUpdateTime: - description: The last time this condition was updated. + format: date-time type: string message: description: A human readable message indicating details about