gke

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package gke emulates the GKE cluster admin API, backed by a real local Kubernetes cluster rather than a stub.

A stubbed GKE would answer "cluster created" and hand back a cluster that cannot run a pod — which is worse than nothing, because a deploy would then fail deep inside kubectl instead of at the honest boundary. So a created cluster is a real one: the runner starts an actual local Kubernetes (kind today, k3s/k3d could slot into the same seam), and get-credentials returns a kubeconfig that talks to it. The admin API is emulated; the cluster is not.

Index

Constants

View Source
const MaxBodyBytes = 4 << 20

MaxBodyBytes caps a JSON request body; the port is shared.

Variables

This section is empty.

Functions

This section is empty.

Types

type REST

type REST struct {
	// contains filtered or unexported fields
}

REST serves the GKE JSON API so `gcloud container clusters` works. The Go client speaks gRPC; gcloud speaks REST, over the same service.

func NewREST

func NewREST(s *Service) *REST

NewREST wires the routes gcloud drives.

func (*REST) Matches

func (a *REST) Matches(method, escapedPath string) bool

Matches reports whether a route here claims the request; /v1/ is shared.

func (*REST) ServeHTTP

func (a *REST) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Service

type Service struct {
	containerpb.UnimplementedClusterManagerServer
	// contains filtered or unexported fields
}

Service is the GKE cluster admin API over a real local-cluster runner.

func New

func New(kv store.Store, clk clock.Clock) *Service

New wires a service. runner defaults to kind; a test injects a fake.

func (*Service) CreateCluster

CreateCluster starts a real local cluster and returns the operation that tracks it. GKE is asynchronous: the cluster is PROVISIONING until the runner finishes, then RUNNING, and the caller polls the operation to learn when.

func (*Service) DeleteCluster

DeleteCluster tears down the real cluster and returns the tracking operation.

func (*Service) GetCluster

func (*Service) GetOperation

func (*Service) Sync

func (s *Service) Sync()

Sync waits for every in-flight cluster action (create/delete) to finish, so a test can drive an operation to completion deterministically.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL