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
- type REST
- type Service
- func (s *Service) CreateCluster(ctx context.Context, req *containerpb.CreateClusterRequest) (*containerpb.Operation, error)
- func (s *Service) DeleteCluster(ctx context.Context, req *containerpb.DeleteClusterRequest) (*containerpb.Operation, error)
- func (s *Service) GetCluster(ctx context.Context, req *containerpb.GetClusterRequest) (*containerpb.Cluster, error)
- func (s *Service) GetOperation(ctx context.Context, req *containerpb.GetOperationRequest) (*containerpb.Operation, error)
- func (s *Service) ListClusters(ctx context.Context, req *containerpb.ListClustersRequest) (*containerpb.ListClustersResponse, error)
- func (s *Service) Sync()
Constants ¶
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.
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 (*Service) CreateCluster ¶
func (s *Service) CreateCluster(ctx context.Context, req *containerpb.CreateClusterRequest) (*containerpb.Operation, error)
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 ¶
func (s *Service) DeleteCluster(ctx context.Context, req *containerpb.DeleteClusterRequest) (*containerpb.Operation, error)
DeleteCluster tears down the real cluster and returns the tracking operation.
func (*Service) GetCluster ¶
func (s *Service) GetCluster(ctx context.Context, req *containerpb.GetClusterRequest) (*containerpb.Cluster, error)
func (*Service) GetOperation ¶
func (s *Service) GetOperation(ctx context.Context, req *containerpb.GetOperationRequest) (*containerpb.Operation, error)
func (*Service) ListClusters ¶
func (s *Service) ListClusters(ctx context.Context, req *containerpb.ListClustersRequest) (*containerpb.ListClustersResponse, error)