feat: platform audit budget/compliance cross-refs + fix CR API group#10
Merged
Conversation
…I group Completes the Platform-tenant auditor with the budget + compliance cross-resource checks, and corrects the custom-resource API group that slices #8/#9 hardcoded wrong. ─── Bug fix (affects the already-merged auditor) ─── The Platform and Tenant CRs live in the platform.nanohype.dev API group and BudgetPolicy in governance.nanohype.dev — NOT agents.stxkxs.io, which the auditor's platformGVR hardcoded. Against a real cluster, `platform audit` listed zero Platforms (the GVR matched nothing). Corrected platformGVR and added the tenant + budget GVRs. The earlier unit tests passed only because their fixtures used the same wrong group; the fixtures now use the real groups, so they actually exercise the shipping GVR. ─── Budget + compliance cross-references ─── - internal/platform: auditBudgetCompliance runs for every Platform (spec consistency, independent of phase) and reports: - spec.budget.name empty or pointing at a BudgetPolicy that doesn't exist (BUDGET_POLICY_MISSING) - a SOC2 platform whose referenced BudgetPolicy has killSwitchEnabled=false (KILL_SWITCH_DISABLED) - a Platform less strict than its owning Tenant — Tenant requires soc2/hipaa but the Platform doesn't (COMPLIANCE_WEAKER_THAN_TENANT) - spec.tenant pointing at a Tenant CR that doesn't exist (TENANT_MISSING) BudgetPolicy is looked up in the Platform's namespace; the Tenant CR is cluster-scoped. Reuses the dynamic client already threaded through Audit. - internal/cloud: the four new finding types; SARIF rules extended. ─── Tests ─── - audit_test.go: fixtures corrected to the real API groups and given a matching BudgetPolicy + Tenant; new cases cover budget-missing, kill-switch-disabled, and compliance-weaker-than-tenant (10 tests total). No new dependency. Verification: go build ./..., go test ./..., go vet ./..., and golangci-lint v2.12.2 (uncapped) all pass. This completes Phase 2: the Platform auditor now spans the cluster, AWS IRSA, and budget/compliance sides of the eks-agent-platform contract. Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See the commit message for full detail. Final slice of the Platform-tenant auditor — and a bug fix for #8/#9.
The Platform/Tenant CRs are in the
platform.nanohype.devgroup and BudgetPolicy ingovernance.nanohype.dev— notagents.stxkxs.io, which the merged auditor hardcoded in its GVR. On a real clusterplatform auditwould have listed zero Platforms. FixedplatformGVR(+ added tenant/budget GVRs); fixtures corrected so they actually exercise the shipping GVR.Summary
spec.budget.nameresolves to a BudgetPolicy (in the Platform's namespace); SOC2 platforms requirekillSwitchEnabled; the Platform's compliance is ≥ its owning (cluster-scoped) Tenant. New findings:BUDGET_POLICY_MISSING,KILL_SWITCH_DISABLED,COMPLIANCE_WEAKER_THAN_TENANT,TENANT_MISSING.Audit; no AWS, no new dependency.Verification
go build,go test ./...,go vet, golangci-lint v2.12.2 (uncapped) all pass.This completes Phase 2 — the Platform auditor now covers the cluster, AWS IRSA, and budget/compliance sides of the contract.