Skip to content

gree/komputer

Repository files navigation

komputer

Note

このレポジトリは、Google Cloud Next Tokyo 2026 のカスタマーセッション「実践 FinOps の全手法 ー 大型ゲームタイトルのコスト大幅削減への道」のデモ用に作成されたものです。

This repository contains the demo used in the customer session "FinOps in Practice: A Complete Guide to Achieving Significant Cost Reductions for Large-Scale Game Titles" at Google Cloud Next Tokyo 2026.

komputer is a small CLI for comparing GCE spot machine prices and GKE capacity recommendation scores, then generating a GKE ComputeClass patch.

The current built-in spot SKU catalog is focused on asia-northeast1.

Prerequisites

  • Go 1.25 or newer
  • Google Cloud Application Default Credentials
  • A GCP project that can call the Cloud Billing Catalog API and Compute capacity recommendation API

Authenticate locally:

gcloud auth application-default login

List spot prices and capacity scores

go run . list-spot-prices \
  --project my-gcp-project \
  --region asia-northeast1 \
  --core-needs 100

This prints the spot unit prices followed by machine types sorted by price per core, including capacity recommendation data for the requested core count.

Constrain the capacity checks to specific zones:

go run . list-spot-prices \
  --project my-gcp-project \
  --region asia-northeast1 \
  --core-needs 100 \
  --zones asia-northeast1-a,asia-northeast1-b

Get one capacity recommendation

go run . capacity-recommendation n4-standard-32 \
  --project my-gcp-project \
  --region asia-northeast1 \
  --instance-count 4

Constrain the recommendation to specific zones:

go run . capacity-recommendation n4-standard-32 \
  --project my-gcp-project \
  --region asia-northeast1 \
  --instance-count 4 \
  --zones asia-northeast1-a,asia-northeast1-b

Generate a GKE ComputeClass patch

Generate priorities from all known machine types:

go run . gen-computeclass \
  --project my-gcp-project \
  --region asia-northeast1 \
  --name generated-spot \
  --core-needs 100 \
  --obtain-score-threshold 0.5 \
  --uptime-score-threshold 0.5 \
  > computeclass-patch.yaml

Limit the candidates and constrain capacity checks to specific zones:

go run . gen-computeclass \
  --project my-gcp-project \
  --region asia-northeast1 \
  --name generated-spot \
  --core-needs 128 \
  --candidates n4-standard-32,c4-standard-48,c3d-standard-60 \
  --zones asia-northeast1-a,asia-northeast1-b \
  --obtain-score-threshold 0.7 \
  --uptime-score-threshold 0.7 \
  > computeclass-patch.yaml

Example output:

apiVersion: cloud.google.com/v1
kind: ComputeClass
metadata:
  name: generated-spot
spec:
  priorities:
    - machineType: n4-standard-32
      spot: true
    - machineType: c4-standard-48
      spot: true

The generated manifest is intentionally minimal. It is meant to be combined with a base ComputeClass manifest by kustomize.

Run tests

GOCACHE=/private/tmp/komputer-go-build-cache go test ./...

Releases

No releases published

Packages

 
 
 

Contributors