Repository navigation
feat: enhance insights with service context and custom priority scripting and rework health score - #4514
Conversation
…ting - Add service info to GraphQL 'insights' query for better context. - Introduce `start_insight` and `await_insight` to reuse service insights in cluster evidence generation. - Add CustomInsightPriority CRD to define priority scripts for failing objects in deployments. - Implement sandboxed Python evaluation engine for priority scripting. - Update cluster insights UI to display associated service information. - Add tracing to `GetFailingRoots` in ProfiledStore. - Update insight tests to reflect new service associations.
Soffi AI SummaryThis PR significantly enhances the cluster insight system by introducing customizable, script-driven priority scoring for failing Kubernetes resources, improving insight context propagation, and refining health scoring logic throughout the deployment operator. CustomInsightPriority CRD & Scripting Engine: A new Insight Adoption Between Cluster and Service Components: A Health & Priority Scoring Improvements: A Observability & Operations: Prometheus metrics are added for the new insight priority evaluation pipeline. Tracing is added to Updated: 2026-10-15 10:49 UTC |
[High impact] The PR appears safe to merge; no new blocking issue remains. SummaryThis PR connects cluster insights to managing services, shares component diagnoses, adds Python priority scripts, and reworks cluster health scoring.
Reviews (8) · Last reviewed commit: "feat: add CronJob last success tracking ..." · Reviewed by Greptile |
…-evaluate-and-implement-heuristic-detection-for-insight
- Add `Generation` field to track script changes in `Evaluator` and `Registry`. - Improve `GetPriorityAnnotation` to retrieve normalized priority annotations for components. - Implement retry logic for failing or restarting synchronizers in `Supervisor`. - Add dedicated test cases for `Evaluator`, `Registry`, and `Supervisor` enhancements. - Update role-based access control (RBAC) to include `custominsightpriorities`. - Introduce `rootState` function for enriched priority annotations. - Refactor `isRootKind` and `replicas` with targeted workload handling constants. - Extend API docs with `CustomInsightPriority` and related schema details.
- Document `CustomInsightPriority` CRD for managing priority of failing objects in cluster insights. - Include `CustomInsightPrioritySpec`, `InsightTarget`, and `InsightEvaluation` schema details. - Define `InsightEngine` and enumerate supported scripting languages. - Extend API reference with validation rules and usage contexts for new fields.
- Eliminate reusing service insights for failing components to streamline logic. - Remove `with_insight` query and related service insight functions in `ServiceComponent`. - Adjust `Cluster.generate/1` to always generate insights independently without reusing service ones. - Simplify GraphQL resolver for `insight` to use a direct dataloader approach. - Update documentation to reflect changes in service-managed workload insights. - Remove associated tests for reused service insights and redundant query handling.
- Add `service_id` column in `cluster_insight_components` for improved service association. - Update migration script to include the new column.
- Add `Memoizer.adopt/1` to allow cluster and service components to share fresh insights for the same Kubernetes object. - Update `Memoizer.generate/1` to incorporate adoption logic. - Add query helpers `for_cluster/2`, `for_object/2`, and `with_insight/1` to `ClusterInsightComponent` and `ServiceComponent`. - Ensure stale insights are detached to prevent overwriting by unrelated components. - Add extensive tests for adopting, detaching, and retaining insights between cluster and service components.
- Update `Memoizer.adopt/1` to ensure cluster components consistently adopt fresh insights from service components. - Add `ServiceComponentIdentities` GraphQL query for accessing service-component relationships. - Introduce `ClusterInsightComponentCard` and `ClusterInsightComponentParts` for modular UI handling. - Update cluster insights UI with service-specific navigation and board/list view toggles. - Refactor tests to validate insight adoption behavior and UI updates.
- Update `failingSinceUpsert` to account for unique component `uid` and reset failing times appropriately for replacements. - Add logic in `Memoizer.adopt/1` to handle forced insight refresh, bypassing peer adoption. - Refine insights memoization check to ensure proper regeneration logic.
- Eliminate unnecessary `console.log` statements for cleaner code.
- Remove redundant clause for forced insights in `Memoizer.adopt/1`. - Ensure forced insights are detached rather than overwritten during adoption. - Update condition to properly link shared insights when fresh.
- Enhance `GetResourceHealth` to support HPA conditions from `autoscaling/v2` and `autoscaling/v2beta2`. - Add logic to prioritize `Degraded` status over `Healthy` in `checkConditions`. - Update `health_test.go` with new test cases for various HPA condition scenarios: - `Degraded` status for failed metrics or unreadable scale targets. - `Healthy` status for valid metrics and scaling. - `Progressing` status when no conditions are known yet. - Improve condition handling for clarity and accurate health evaluation.
- Add test case to ensure failing time is reset for replacements with the same name but a different UID. - Verify failing time for the replaced component is not inherited and starts fresh.
- Replace `ScoreHigh` and `ScoreCritical` with `ScoreCore` for essential cluster components. - Adjust scoring logic to cap third-party workloads below `ThresholdHigh` (max `MEDIUM`). - Update classification criteria for core components to prioritize based on criticality and replica counts. - Modify tests to align with new scoring logic and ensure apps are capped appropriately. - Improve documentation/comments to clarify differences between core and non-core component scoring.
- Update tests to cover critical priority scenarios for core DaemonSets and clarify remarks on replica-based criticality. - Ensure core workloads like `aws-node` are marked as `CRITICAL` when fully down. - Adjust comments for insight priority logic to distinguish core criticality from third-party workloads. - Expand documentation to clarify that only workloads with replicas can achieve `CRITICAL` priority independently.
…-evaluate-and-implement-heuristic-detection-for-insight
… logic - Add `last_success` column to database schema to track last successful CronJob run. - Update `failingRoots` query to exclude failures older than the last success. - Extend `Extract` function to compute `LastSuccessfulTime` from CronJob status. - Add `nullableUnix` and `sqlUnix` helpers for handling nullable Unix timestamps in database. - Introduce tests for failure evaluation considering previous CronJob successes. - Increment schema version to 4 to reflect CronJob changes.
- Replace `nullableUnix`, `nullableInt`, and `sqlUnix` helpers with generic `nullablePtr` and `sqlPtr` functions for consistency. - Set default `last_success` column value in database schema to `0` for clearer handling of unknown timestamps. - Refactor component classification logic to use `new()` for better pointer handling. - Remove redundant nullable-criticality logic in SQL queries and directly reference facts with default values. - Simplify SQL rendering logic in insert queries by standardizing the use of new helpers.
- Correct variadic argument handling in `SaveComponentAttributes` for `ProfiledStore` and `ProfiledStoreLocal` by appending `...` to `args`. - Add unit test to verify `CronJob` bulk save retains `lastSuccessfulTime` and excludes old failed jobs.
The agent's insight priority came from a fuzzy name match (
concert-managerranked likecert-manager), and the health score scaled with pod count and was diluted by healthy objects. A fully down third-party StatefulSet could zero a cluster. Neither could be customised, and managed failures were hidden from the list.What changes
Priority is computed by fixed rules, never by an LLM
system-*priority class, system namespaces (incl.plrl-console,plrl-deploy-operator), nodesHIGH, mostly down isCRITICALMEDIUM: partial isLOW, total outage isMEDIUMHealth score
LOW2,MEDIUM8,HIGH25,CRITICAL50),LOWcapped at 10,MEDIUMat 30.Customisation
deployments.plural.sh/insight-priorityannotation (LOWtoCRITICAL,IGNORE).CustomInsightPriorityCRD with sandboxed Python scripts (timeouts, redacted errors, precedence,Overlappingcondition).Lifecycle
--insight-grace-period, default 10m) so flapping workloads keep their component and insight.Console
service_idoncluster_insight_componentsandserviceIdin the GraphQL input. Managed components are listed with their service.Also fixed on the way
Healthybefore reachingFailedGetResourceMetric.successfulJobsHistoryLimit: 0kept reading as failing from an old failed Job.SaveComponentAttributes.Rollout notes
serviceIdbefore agents start sending it.CustomInsightPriorityCRD and theextraArgspassthrough invalues.yaml.liquidship with the chart inpluralsh/deployment-operator. An agent without the CRD starts without the feature and logs it.insight-priority.mddescribes the model, the annotation and the CRD.Testing
insights,store,insightprioritypackages).CustomInsightPriority, compatibility), all passing.Report
REPORT.md
Test Plan
Test environment: https://console.plrl-dev-aws.onplural.sh/
Checklist
Plural Flow: console