Skip to content
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

feat: metrics aggregate #269

Merged
merged 10 commits into from
Sep 26, 2024
Merged

feat: metrics aggregate #269

merged 10 commits into from
Sep 26, 2024

Conversation

zreigz
Copy link
Member

@zreigz zreigz commented Sep 17, 2024

  • Implement a controller to reconcile a metrics aggregate.
  • Create DebounceReconciler as a wrapper that fulfills the controller-runtime interface. It can be use for every controller to delay requests.

@zreigz zreigz changed the title vip: metrics aggregate wip: metrics aggregate Sep 17, 2024
@zreigz zreigz changed the title wip: metrics aggregate feat: metrics aggregate Sep 19, 2024
@github-actions github-actions bot added size/XXL and removed size/XL labels Sep 20, 2024
@github-actions github-actions bot added size/XL and removed size/XXL labels Sep 20, 2024
Copy link
Member

@michaeljguarino michaeljguarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments but makes sense overall

// +kubebuilder:validation:Required
Spec MetricsAggregateSpec `json:"spec"`

// Status of the IngressReplica
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment for IngressReplica here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

type MetricsAggregateSpec struct {
Nodes int `json:"nodes"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these fields optional? Feels like this should probably be the status struct tbh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved to status

fraction = float64(metrics.Spec.MemoryTotalBytes) / float64(metrics.Spec.MemoryAvailableBytes) * 100
metrics.Spec.MemoryUsedPercentage = int64(fraction)

return ctrl.Result{}, reterr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you be requeueing to update on an interval

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@michaeljguarino
Copy link
Member

Another thing we should do is have the agent insert a default metrics aggregate resource on boot (if it doesn't exist). I'm not sure we'll be able to do it in the helm chart smoothly, because of annoying CRD application/validation stuff, but it would be nice to have zero-config guarantees its there so the console server can query it.

Can just name the default one as global or something.

@zreigz
Copy link
Member Author

zreigz commented Sep 23, 2024

Another thing we should do is have the agent insert a default metrics aggregate resource on boot (if it doesn't exist). I'm not sure we'll be able to do it in the helm chart smoothly, because of annoying CRD application/validation stuff, but it would be nice to have zero-config guarantees its there so the console server can query it.

Can just name the default one as global or something.

The DebounceReconciler first time sends empty requests when there is no CRD object. I have added initGlobalMetricsAggregate method in the Reconcile to discover it and create the global MetricsAggregate object

@github-actions github-actions bot added size/XXL and removed size/XL labels Sep 23, 2024
Copy link
Member

@michaeljguarino michaeljguarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, why is the lint action failing though?

@zreigz
Copy link
Member Author

zreigz commented Sep 23, 2024

Expects to bump the chart version

@zreigz
Copy link
Member Author

zreigz commented Sep 24, 2024

chart

it's a chart linter that expects to update the version, we do this only for releases

@zreigz
Copy link
Member Author

zreigz commented Sep 26, 2024

@michaeljguarino can we merge this?

@zreigz zreigz merged commit 22f31a5 into main Sep 26, 2024
30 of 31 checks passed
@zreigz zreigz deleted the metrics-aggregate branch September 26, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants