FLPATH-3402: add 11 cost_management resource type schemas#1243
FLPATH-3402: add 11 cost_management resource type schemas#1243jordigilh wants to merge 3 commits intoproject-kessel:mainfrom
Conversation
Register 11 resource types for the cost_management reporter so that the Kessel Inventory API can accept ReportResource gRPC calls from Cost Management (Koku). Without these schemas, ReportResource calls for cost management resource types are rejected. Resource types: openshift_cluster, openshift_node, openshift_project, cost_model, settings, aws_account, aws_organizational_unit, azure_subscription_guid, gcp_account, gcp_project, integration. Each follows the same 4-file pattern as existing resource types (host/reporters/hbi, k8s_cluster/reporters/acm, etc.). Made-with: Cursor
|
Can one of the admins verify this patch? |
📝 WalkthroughWalkthroughAdds JSON Schema common representations and cost_management reporter schemas/configs for multiple resource types (AWS, Azure, GCP, OpenShift, cost_model, integration, settings); updates schema_cache.json and replaces a base64 payload in deploy/kessel-inventory-ephem.yaml. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@data/schema/resources/aws_account/config.yaml`:
- Around line 1-3: The new resource_type "aws_account" was added but
schema_cache.json wasn't updated; run the schema preloader and commit the
regenerated cache by executing the preload command (go run main.go
preload-schema) to rebuild schema_cache.json so it includes the aws_account
resource schema, then add and commit the updated schema_cache.json so the CI
verify-schema-tarball.yml check passes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8d67736b-6eaf-402a-8806-8963b6a3f86e
📒 Files selected for processing (44)
data/schema/resources/aws_account/common_representation.jsondata/schema/resources/aws_account/config.yamldata/schema/resources/aws_account/reporters/cost_management/aws_account.jsondata/schema/resources/aws_account/reporters/cost_management/config.yamldata/schema/resources/aws_organizational_unit/common_representation.jsondata/schema/resources/aws_organizational_unit/config.yamldata/schema/resources/aws_organizational_unit/reporters/cost_management/aws_organizational_unit.jsondata/schema/resources/aws_organizational_unit/reporters/cost_management/config.yamldata/schema/resources/azure_subscription_guid/common_representation.jsondata/schema/resources/azure_subscription_guid/config.yamldata/schema/resources/azure_subscription_guid/reporters/cost_management/azure_subscription_guid.jsondata/schema/resources/azure_subscription_guid/reporters/cost_management/config.yamldata/schema/resources/cost_model/common_representation.jsondata/schema/resources/cost_model/config.yamldata/schema/resources/cost_model/reporters/cost_management/config.yamldata/schema/resources/cost_model/reporters/cost_management/cost_model.jsondata/schema/resources/gcp_account/common_representation.jsondata/schema/resources/gcp_account/config.yamldata/schema/resources/gcp_account/reporters/cost_management/config.yamldata/schema/resources/gcp_account/reporters/cost_management/gcp_account.jsondata/schema/resources/gcp_project/common_representation.jsondata/schema/resources/gcp_project/config.yamldata/schema/resources/gcp_project/reporters/cost_management/config.yamldata/schema/resources/gcp_project/reporters/cost_management/gcp_project.jsondata/schema/resources/integration/common_representation.jsondata/schema/resources/integration/config.yamldata/schema/resources/integration/reporters/cost_management/config.yamldata/schema/resources/integration/reporters/cost_management/integration.jsondata/schema/resources/openshift_cluster/common_representation.jsondata/schema/resources/openshift_cluster/config.yamldata/schema/resources/openshift_cluster/reporters/cost_management/config.yamldata/schema/resources/openshift_cluster/reporters/cost_management/openshift_cluster.jsondata/schema/resources/openshift_node/common_representation.jsondata/schema/resources/openshift_node/config.yamldata/schema/resources/openshift_node/reporters/cost_management/config.yamldata/schema/resources/openshift_node/reporters/cost_management/openshift_node.jsondata/schema/resources/openshift_project/common_representation.jsondata/schema/resources/openshift_project/config.yamldata/schema/resources/openshift_project/reporters/cost_management/config.yamldata/schema/resources/openshift_project/reporters/cost_management/openshift_project.jsondata/schema/resources/settings/common_representation.jsondata/schema/resources/settings/config.yamldata/schema/resources/settings/reporters/cost_management/config.yamldata/schema/resources/settings/reporters/cost_management/settings.json
Run `go run main.go preload-schema` to include all 11 new cost_management resource types in the JSON schema cache. Required by the verify-schema-tarball CI workflow. Made-with: Cursor
|
Addressed in 42b8020 — ran |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Hey @jordigilh Looks like our workflow didnt add the comment on the schema tarball not generating! and that should generate the new resource tarball file |
Run `make build-schemas` to include the 11 new cost_management resource types in the schema tarball and update the ephemeral deployment config. Made-with: Cursor
|
Thanks @Adam0Brien — done in bc42814. Ran |
|
Marking this as draft to prevent any accidental merge. |
Summary
Register 11 resource types for the
cost_managementreporter so that the Kessel Inventory API can acceptReportResourcegRPC calls from Cost Management (Koku).Why this is needed
The Kessel Inventory API validates every
ReportResourcegRPC call against resource type schemas defined indata/schema/resources/. The validation flow is:ReportResource(resource_type=X, reporter_type=Y, ...)data/schema/resources/X/reporters/Y/config.yamlCost Management (Koku) needs to report 11 resource types to the Inventory API as part of its Kessel/ReBAC integration for on-prem authorization. These resource types represent the entities that Koku manages and for which it needs to track authorization relationships (via SpiceDB tuples). Without these schemas registered, Koku cannot participate in the Kessel resource lifecycle — it cannot report, update, or delete resources through the Inventory API.
Currently, only 4 resource types exist in the upstream schema (
host,k8s_cluster,k8s_policy,notifications_integration). None cover Cost Management's domain.What this PR adds
44 new files — 11 resource type directories, each containing 4 files following the identical pattern established by existing resource types (
host/reporters/hbi/,k8s_cluster/reporters/acm/, etc.):<type>/config.yamlresource_typeandresource_reporters: [cost_management]<type>/common_representation.jsonworkspace_id(same ashost)<type>/reporters/cost_management/config.yamlreporter_name,namespace)<type>/reporters/cost_management/<type>.jsonResource types and what they represent
openshift_clusteropenshift_nodeopenshift_projectcost_modelsettingsaws_accountaws_organizational_unitazure_subscription_guidgcp_accountgcp_projectintegrationSchema details
common_representation.jsonrequiresworkspace_id(type: string) — identical to the existinghostresource type schema. This field links the resource to an authorization workspace."properties": {}, "required": []) because Cost Management does not attach reporter-specific metadata beyond what the common representation provides. This matches the pattern used by other reporters with simple payloads.cost_management, following the convention where reporter name matches the service namespace.Example:
openshift_cluster(representative of all 11)openshift_cluster/config.yaml:openshift_cluster/common_representation.json:{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "workspace_id": { "type": "string" } }, "required": ["workspace_id"] }openshift_cluster/reporters/cost_management/config.yaml:openshift_cluster/reporters/cost_management/openshift_cluster.json:{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": {}, "required": [] }All 11 resource types follow this exact pattern, differing only in the
resource_typename.Validation
These schemas have been validated end-to-end on an on-prem deployment using local copies bundled in the ros-helm-chart
kessel-resource-schemasConfigMap. Koku successfully callsReportResource,DeleteResource, andStreamedListObjectsfor all 11 resource types. This PR upstreams them so they are available in the canonical Inventory API definitions.Related PRs
JIRA
FLPATH-3402
Made with Cursor
Summary by CodeRabbit