Unverified Commit 61889a14 authored by Thomas Montfort's avatar Thomas Montfort Committed by GitHub
Browse files

feat(operator): add observedGeneration to DGD status (#6398)

parent 6a3f2002
...@@ -11369,6 +11369,10 @@ spec: ...@@ -11369,6 +11369,10 @@ spec:
- type - type
type: object type: object
type: array type: array
observedGeneration:
description: ObservedGeneration is the most recent generation observed by the controller.
format: int64
type: integer
restart: restart:
description: Restart contains the status of the restart of the graph deployment. description: Restart contains the status of the restart of the graph deployment.
properties: properties:
......
...@@ -110,6 +110,9 @@ const ( ...@@ -110,6 +110,9 @@ const (
// DynamoGraphDeploymentStatus defines the observed state of DynamoGraphDeployment. // DynamoGraphDeploymentStatus defines the observed state of DynamoGraphDeployment.
type DynamoGraphDeploymentStatus struct { type DynamoGraphDeploymentStatus struct {
// ObservedGeneration is the most recent generation observed by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// State is a high-level textual status of the graph deployment lifecycle. // State is a high-level textual status of the graph deployment lifecycle.
// +kubebuilder:default=initializing // +kubebuilder:default=initializing
State DGDState `json:"state"` State DGDState `json:"state"`
......
...@@ -11369,6 +11369,10 @@ spec: ...@@ -11369,6 +11369,10 @@ spec:
- type - type
type: object type: object
type: array type: array
observedGeneration:
description: ObservedGeneration is the most recent generation observed by the controller.
format: int64
type: integer
restart: restart:
description: Restart contains the status of the restart of the graph deployment. description: Restart contains the status of the restart of the graph deployment.
properties: properties:
......
...@@ -136,6 +136,12 @@ func (r *DynamoGraphDeploymentReconciler) Reconcile(ctx context.Context, req ctr ...@@ -136,6 +136,12 @@ func (r *DynamoGraphDeploymentReconciler) Reconcile(ctx context.Context, req ctr
LastTransitionTime: metav1.Now(), LastTransitionTime: metav1.Now(),
}) })
// Only set ObservedGeneration when reconciliation succeeded (no error),
// so it accurately reflects the last successfully processed generation.
if err == nil {
dynamoDeployment.Status.ObservedGeneration = dynamoDeployment.Generation
}
updateErr := r.Status().Update(ctx, dynamoDeployment) updateErr := r.Status().Update(ctx, dynamoDeployment)
if updateErr != nil { if updateErr != nil {
logger.Error(updateErr, "Unable to update the CRD status", "crd", req.NamespacedName, "state", state, "reason", reason, "message", message) logger.Error(updateErr, "Unable to update the CRD status", "crd", req.NamespacedName, "state", state, "reason", reason, "message", message)
......
...@@ -645,6 +645,7 @@ _Appears in:_ ...@@ -645,6 +645,7 @@ _Appears in:_
| Field | Description | Default | Validation | | Field | Description | Default | Validation |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `observedGeneration` _integer_ | ObservedGeneration is the most recent generation observed by the controller. | | Optional: \{\} <br /> |
| `state` _[DGDState](#dgdstate)_ | State is a high-level textual status of the graph deployment lifecycle. | initializing | Enum: [initializing pending successful failed] <br /> | | `state` _[DGDState](#dgdstate)_ | State is a high-level textual status of the graph deployment lifecycle. | initializing | Enum: [initializing pending successful failed] <br /> |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#condition-v1-meta) array_ | Conditions contains the latest observed conditions of the graph deployment.<br />The slice is merged by type on patch updates. | | | | `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#condition-v1-meta) array_ | Conditions contains the latest observed conditions of the graph deployment.<br />The slice is merged by type on patch updates. | | |
| `services` _object (keys:string, values:[ServiceReplicaStatus](#servicereplicastatus))_ | Services contains per-service replica status information.<br />The map key is the service name from spec.services. | | Optional: \{\} <br /> | | `services` _object (keys:string, values:[ServiceReplicaStatus](#servicereplicastatus))_ | Services contains per-service replica status information.<br />The map key is the service name from spec.services. | | Optional: \{\} <br /> |
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment