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:
- type
type: object
type: array
observedGeneration:
description: ObservedGeneration is the most recent generation observed by the controller.
format: int64
type: integer
restart:
description: Restart contains the status of the restart of the graph deployment.
properties:
......
......@@ -110,6 +110,9 @@ const (
// DynamoGraphDeploymentStatus defines the observed state of DynamoGraphDeployment.
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.
// +kubebuilder:default=initializing
State DGDState `json:"state"`
......
......@@ -11369,6 +11369,10 @@ spec:
- type
type: object
type: array
observedGeneration:
description: ObservedGeneration is the most recent generation observed by the controller.
format: int64
type: integer
restart:
description: Restart contains the status of the restart of the graph deployment.
properties:
......
......@@ -136,6 +136,12 @@ func (r *DynamoGraphDeploymentReconciler) Reconcile(ctx context.Context, req ctr
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)
if updateErr != nil {
logger.Error(updateErr, "Unable to update the CRD status", "crd", req.NamespacedName, "state", state, "reason", reason, "message", message)
......
......@@ -645,6 +645,7 @@ _Appears in:_
| 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 /> |
| `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 /> |
......
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