From 5d452498884e132645d4bd0ebb80127addfbd869 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Wed, 30 Oct 2024 18:01:51 +0100 Subject: [PATCH] Add observedGeneration to remote nodes --- api/v1/ytsaurus_types.go | 4 +++- config/crd/bases/cluster.ytsaurus.tech_remotedatanodes.yaml | 5 +++++ config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml | 5 +++++ .../crd/bases/cluster.ytsaurus.tech_remotetabletnodes.yaml | 5 +++++ controllers/remotedatanodes_sync.go | 1 + controllers/remoteexecnodes_sync.go | 1 + controllers/remotetabletnodes_sync.go | 1 + docs/api.md | 1 + .../crds/remotedatanodes.cluster.ytsaurus.tech.yaml | 5 +++++ .../crds/remoteexecnodes.cluster.ytsaurus.tech.yaml | 5 +++++ .../crds/remotetabletnodes.cluster.ytsaurus.tech.yaml | 5 +++++ 11 files changed, 37 insertions(+), 1 deletion(-) diff --git a/api/v1/ytsaurus_types.go b/api/v1/ytsaurus_types.go index d42e43e0..986f0064 100644 --- a/api/v1/ytsaurus_types.go +++ b/api/v1/ytsaurus_types.go @@ -605,7 +605,9 @@ const ( // CommonRemoteNodeStatus is a set of fields shared between `Remote*NodesStatus`. // It is inlined in these specs. type CommonRemoteNodeStatus struct { - ReleaseStatus RemoteNodeReleaseStatus `json:"releaseStatus,omitempty"` + // Reflects resource generation which was used for updating status. + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + ReleaseStatus RemoteNodeReleaseStatus `json:"releaseStatus,omitempty"` } // YtsaurusSpec defines the desired state of Ytsaurus diff --git a/config/crd/bases/cluster.ytsaurus.tech_remotedatanodes.yaml b/config/crd/bases/cluster.ytsaurus.tech_remotedatanodes.yaml index 6e4d580d..6fa8b407 100644 --- a/config/crd/bases/cluster.ytsaurus.tech_remotedatanodes.yaml +++ b/config/crd/bases/cluster.ytsaurus.tech_remotedatanodes.yaml @@ -2507,6 +2507,11 @@ spec: status: description: RemoteDataNodesStatus defines the observed state of RemoteDataNodes properties: + observedGeneration: + description: Reflects resource generation which was used for updating + status. + format: int64 + type: integer releaseStatus: type: string type: object diff --git a/config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml b/config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml index 16c970c0..201f55f2 100644 --- a/config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml +++ b/config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml @@ -2700,6 +2700,11 @@ spec: status: description: RemoteExecNodesStatus defines the observed state of RemoteExecNodes properties: + observedGeneration: + description: Reflects resource generation which was used for updating + status. + format: int64 + type: integer releaseStatus: type: string type: object diff --git a/config/crd/bases/cluster.ytsaurus.tech_remotetabletnodes.yaml b/config/crd/bases/cluster.ytsaurus.tech_remotetabletnodes.yaml index 69174826..e63c2abc 100644 --- a/config/crd/bases/cluster.ytsaurus.tech_remotetabletnodes.yaml +++ b/config/crd/bases/cluster.ytsaurus.tech_remotetabletnodes.yaml @@ -2507,6 +2507,11 @@ spec: status: description: RemoteTabletNodesStatus defines the observed state of RemoteTabletNodes properties: + observedGeneration: + description: Reflects resource generation which was used for updating + status. + format: int64 + type: integer releaseStatus: type: string type: object diff --git a/controllers/remotedatanodes_sync.go b/controllers/remotedatanodes_sync.go index 7716f1bd..877a812d 100644 --- a/controllers/remotedatanodes_sync.go +++ b/controllers/remotedatanodes_sync.go @@ -56,6 +56,7 @@ func (r *RemoteDataNodesReconciler) Sync( resource.Status.ReleaseStatus = ytv1.RemoteNodeReleaseStatusRunning requeue = false } + resource.Status.ObservedGeneration = resource.Generation logger.Info("Setting status for remote data nodes", "status", resource.Status.ReleaseStatus) err = r.Client.Status().Update(ctx, resource) diff --git a/controllers/remoteexecnodes_sync.go b/controllers/remoteexecnodes_sync.go index 5343faa8..41a70428 100644 --- a/controllers/remoteexecnodes_sync.go +++ b/controllers/remoteexecnodes_sync.go @@ -56,6 +56,7 @@ func (r *RemoteExecNodesReconciler) Sync( resource.Status.ReleaseStatus = ytv1.RemoteNodeReleaseStatusRunning requeue = false } + resource.Status.ObservedGeneration = resource.Generation logger.Info("Setting status for remote exec nodes", "status", resource.Status.ReleaseStatus) err = r.Client.Status().Update(ctx, resource) diff --git a/controllers/remotetabletnodes_sync.go b/controllers/remotetabletnodes_sync.go index 0b306350..6c5793ce 100644 --- a/controllers/remotetabletnodes_sync.go +++ b/controllers/remotetabletnodes_sync.go @@ -56,6 +56,7 @@ func (r *RemoteTabletNodesReconciler) Sync( resource.Status.ReleaseStatus = ytv1.RemoteNodeReleaseStatusRunning requeue = false } + resource.Status.ObservedGeneration = resource.Generation logger.Info("Setting status for remote tablet nodes", "status", resource.Status.ReleaseStatus) err = r.Client.Status().Update(ctx, resource) diff --git a/docs/api.md b/docs/api.md index f0e4e3f1..8611e090 100644 --- a/docs/api.md +++ b/docs/api.md @@ -289,6 +289,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | +| `observedGeneration` _integer_ | Reflects resource generation which was used for updating status. | | | | `releaseStatus` _[RemoteNodeReleaseStatus](#remotenodereleasestatus)_ | | | | diff --git a/ytop-chart/templates/crds/remotedatanodes.cluster.ytsaurus.tech.yaml b/ytop-chart/templates/crds/remotedatanodes.cluster.ytsaurus.tech.yaml index 87b57790..0b84548e 100644 --- a/ytop-chart/templates/crds/remotedatanodes.cluster.ytsaurus.tech.yaml +++ b/ytop-chart/templates/crds/remotedatanodes.cluster.ytsaurus.tech.yaml @@ -2518,6 +2518,11 @@ spec: status: description: RemoteDataNodesStatus defines the observed state of RemoteDataNodes properties: + observedGeneration: + description: Reflects resource generation which was used for updating + status. + format: int64 + type: integer releaseStatus: type: string type: object diff --git a/ytop-chart/templates/crds/remoteexecnodes.cluster.ytsaurus.tech.yaml b/ytop-chart/templates/crds/remoteexecnodes.cluster.ytsaurus.tech.yaml index 1bc06a27..9ed0c401 100644 --- a/ytop-chart/templates/crds/remoteexecnodes.cluster.ytsaurus.tech.yaml +++ b/ytop-chart/templates/crds/remoteexecnodes.cluster.ytsaurus.tech.yaml @@ -2711,6 +2711,11 @@ spec: status: description: RemoteExecNodesStatus defines the observed state of RemoteExecNodes properties: + observedGeneration: + description: Reflects resource generation which was used for updating + status. + format: int64 + type: integer releaseStatus: type: string type: object diff --git a/ytop-chart/templates/crds/remotetabletnodes.cluster.ytsaurus.tech.yaml b/ytop-chart/templates/crds/remotetabletnodes.cluster.ytsaurus.tech.yaml index 6ec76255..7a3531cb 100644 --- a/ytop-chart/templates/crds/remotetabletnodes.cluster.ytsaurus.tech.yaml +++ b/ytop-chart/templates/crds/remotetabletnodes.cluster.ytsaurus.tech.yaml @@ -2518,6 +2518,11 @@ spec: status: description: RemoteTabletNodesStatus defines the observed state of RemoteTabletNodes properties: + observedGeneration: + description: Reflects resource generation which was used for updating + status. + format: int64 + type: integer releaseStatus: type: string type: object