Fix import docs, add WorkloadRule docs, cover import lifecycle w/ test - #58
Fix import docs, add WorkloadRule docs, cover import lifecycle w/ test#58Rupam-It wants to merge 3 commits into
Conversation
| | `autoGenerate` | `boolean` | When `true`, the engine fills all rule fields from observed usage; manual field overrides below are ignored. | | ||
| | `cpuRule` | `ResourceRuleConfigArgs` | CPU vertical scaling rule. | | ||
| | `memoryRule` | `ResourceRuleConfigArgs` | Memory vertical scaling rule. | | ||
| | `gpuRule` | `ResourceRuleConfigArgs` | GPU vertical scaling rule (units: GPU millicores). | |
There was a problem hiding this comment.
💡 Quality: Contradictory GPU unit description in workload_rule.md
In docs/resources/workload_rule.md the gpuRule row states units are "GPU millicores" (line 100), while the ResourceRuleConfigArgs.minRequest row says "bytes for memory/GPU" (line 133). These two statements contradict each other for GPU. Pick the correct unit and make both rows agree so users don't misconfigure GPU requests.
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 resolved / 1 findingsFixes broken 💡 Quality: Contradictory GPU unit description in workload_rule.md📄 docs/resources/workload_rule.md:100 📄 docs/resources/workload_rule.md:133 In docs/resources/workload_rule.md the 🤖 Prompt for agentsWas this helpful? React with 👍 / 👎 | Gitar |
Summary
pulumi importexample — all five used the wrongtoken format (
devzero:index/x:X) instead of the actual registered token(
devzero:resources:X, per schema.json/generated SDKs), so everydocumented import command in the repo would have failed.
cluster.md's stale claim thattokenauto-rotates on import/update —the provider deliberately stopped doing that (see
TestCluster_Update_DoesNotRotateToken) since it was silently invalidatinga live in-cluster agent's credential on unrelated updates.
docs/resources/workload_rule.md, which didn't exist — includes animport note on how
autoGenerateis inferred fromcurrent_sourceonevery
Read, not stored as its own field.TestImport_*for all six resource types (Cluster, NodePolicy,NodePolicyTarget, WorkloadPolicy, WorkloadPolicyTarget, WorkloadRule),
simulating the actual
pulumi importcode path —Read()called with abare ID and zero-value Inputs/State against a resource seeded directly
into the backend (as if created outside Pulumi). Each test asserts full
attribute hydration, a clean/idempotent plan (
Diff()for WorkloadRule,fixed-point
Read()for the rest), and that a post-importUpdate()reaches the backend.
UpdateWorkloadRecommendationPolicyhandler tofakeBackend—WorkloadPolicy.Update()had no test coverage against ituntil now.
Test plan
go build ./...go vet ./...go test ./...(all packages pass, including the newTestImport_*)pulumi import→pulumi preview→ edit →pulumi up) against a real DevZero environment for at least oneresource of each type — not run in this PR, follow-up