Skip to content

feat(kubernetes): add core group with PVC + LoadBalancer Service [FIX-331] - #78

Merged
liamcervante merged 1 commit into
mainfrom
fix-331-add-persistent-storage-and-load-balancer-resources
Jul 7, 2026
Merged

feat(kubernetes): add core group with PVC + LoadBalancer Service [FIX-331]#78
liamcervante merged 1 commit into
mainfrom
fix-331-add-persistent-storage-and-load-balancer-resources

Conversation

@liamcervante

@liamcervante liamcervante commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

First PR of the FIX-331 stack (add persistent storage + load balancer resources to the Kubernetes plugin). This lands the tree representation in go-proto; the parser and pricing changes follow in infracost/parser and infracost/providers.

Adds a Kubernetes core/v1 API group alongside the existing apps and batch groups, holding the two cost-relevant non-workload kinds:

  • PersistentVolumeClaim — storage class + requested bytes (both price drivers, readable straight from the manifest) + annotations for cloud detection. The sizing lives in a shared StorageRequest type.
  • StatefulSet.VolumeClaimTemplates[]core.StorageRequest, since a StatefulSet provisions one volume per template per replica (cost = Σ templates × replicas). Kept on the StatefulSet rather than as standalone PVCs so the replica multiplier isn't lost.
  • Service — only type: LoadBalancer (the parser won't surface free ClusterIP/NodePort services); carries type, annotations (LB flavour + cloud signals) and ports.

Why a new group rather than extending workloads

PVCs and LoadBalancer Services aren't workloads (no containers/replicas), and — unlike per-workload compute — they map to discrete cloud resources (EBS/PD/Azure disk, ALB/NLB) provisioned outside the node pools. So pricing them is genuinely additive and doesn't double-count node-pool IaC.

Implementation notes

  • Wiring rides entirely on the existing reflective walker (collectResources) and proto converter (convert.go) — no shared-code changes. New structs embedding resource.Resource are auto-discovered; the embedded StorageRequest is flattened the same way workload.Workload is.
  • No hardcoded group/kind lists anywhere needed updating.

Testing

  • Extended TestKubernetesRoundTrip to cover a standalone PVC (embedded-field flattening + tags + annotations), a LoadBalancer Service (type/annotations/ports), and StatefulSet volumeClaimTemplates.
  • go build ./..., go vet, full go test ./..., and golangci-lint run all pass.

Technical docs

  • No technical docs needed (internal tree type additions; no user-facing surface yet).

@liamcervante
liamcervante requested a review from a team July 6, 2026 14:18
…-331]

Adds the Kubernetes core/v1 API group to the tree, holding the two
cost-relevant non-workload kinds:

* PersistentVolumeClaim — storage class + requested bytes + annotations.
  The backing StorageRequest is shared with StatefulSet
  volumeClaimTemplates (one volume per template per replica).
* Service — only type: LoadBalancer, with its type, annotations and
  ports retained for load-balancer pricing.

Both map to cloud spend provisioned outside the node pools, so pricing
them does not double-count node-pool IaC. Wiring rides entirely on the
existing reflective walker/converter; no shared-code changes needed.
@liamcervante
liamcervante force-pushed the fix-331-add-persistent-storage-and-load-balancer-resources branch from f8ee3ab to f65eda1 Compare July 6, 2026 14:29
@liamcervante
liamcervante merged commit 8bc9d12 into main Jul 7, 2026
3 checks passed
@liamcervante
liamcervante deleted the fix-331-add-persistent-storage-and-load-balancer-resources branch July 7, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants