-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add status.Conditions - ready with count of reflected clusters #17
Conversation
if inventoryRefs != nil { | ||
logger.Info("reconciled clusters", "count", len(inventoryRefs)) | ||
clustersv1alpha1.SetAutomatedClusterDiscoveryReadiness(clusterDiscovery, clusterDiscovery.Status.Inventory, metav1.ConditionTrue, clustersv1alpha1.ReconciliationSucceededReason, | ||
fmt.Sprintf("%d resources found", len(inventoryRefs))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "resources created" as thats what were doing, or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we actually just reflect the number of clusters?
And make it %d clusters discovered
?
|
||
if err = r.patchStatus(ctx, req, clusterDiscovery.Status); err != nil { | ||
return ctrl.Result{}, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! So with the repetition here it might be time to pull out the generation stuff into a reconcileResources
function as we have in gitopssets, and then only patch the status once for err and once for success etc
// ObservedGeneration is the last observed generation of the | ||
// object. | ||
// +optional | ||
ObservedGeneration int64 `json:"observedGeneration,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bug I need to fix in GitOpsSets, the ObservedGeneration should default to -1
You'll need to change it like this:
Status AutomatedClusterDiscoveryStatus `json:"status,omitempty"` |
Spec AutomatedClusterDiscoverySpec `json:"spec,omitempty"`
// +kubebuilder:default={"observedGeneration":-1}
Status AutomatedClusterDiscoveryStatus `json:"status,omitempty"`
Closes: weaveworks/weave-gitops-enterprise#3515
PR to add readiness status for reflected clusters, it also includes messages for success/failure and a count of created resources. This allows users to easily check if a cluster is ready through the UI and
kubectl
.