aks

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package aks implements the Azure Kubernetes Service (Microsoft.ContainerService) ARM REST API as a server.Handler. Real github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice clients configured with a custom endpoint hit this handler the same way they hit management.azure.com.

Wave 1 coverage (control plane only):

PUT    .../providers/Microsoft.ContainerService/managedClusters/{name}                                         — Create or update cluster
GET    .../providers/Microsoft.ContainerService/managedClusters/{name}                                         — Get cluster
PATCH  .../providers/Microsoft.ContainerService/managedClusters/{name}                                         — Update tags
DELETE .../providers/Microsoft.ContainerService/managedClusters/{name}                                         — Delete cluster (cascade)
GET    .../providers/Microsoft.ContainerService/managedClusters                                                — List in resource group
GET    /subscriptions/{s}/providers/Microsoft.ContainerService/managedClusters                                 — List in subscription
PUT    .../managedClusters/{name}/agentPools/{pool}                                                            — Create or update pool
GET    .../managedClusters/{name}/agentPools/{pool}                                                            — Get pool
DELETE .../managedClusters/{name}/agentPools/{pool}                                                            — Delete pool
GET    .../managedClusters/{name}/agentPools                                                                   — List pools
PUT    .../managedClusters/{name}/maintenanceConfigurations/{cfg}                                              — Upsert maintenance cfg
GET    .../managedClusters/{name}/maintenanceConfigurations/{cfg}                                              — Get maintenance cfg
DELETE .../managedClusters/{name}/maintenanceConfigurations/{cfg}                                              — Delete maintenance cfg
GET    .../managedClusters/{name}/maintenanceConfigurations                                                    — List maintenance cfgs
POST   .../managedClusters/{name}/listClusterAdminCredential                                                   — Stub kubeconfig
POST   .../managedClusters/{name}/listClusterUserCredential                                                    — Stub kubeconfig
POST   .../managedClusters/{name}/listClusterMonitoringUserCredential                                          — Stub kubeconfig
POST   .../managedClusters/{name}/rotateClusterCertificates                                                    — Cert rotation no-op

The Kubernetes data plane (Deployments / Services / Pods) is intentionally NOT served — that lands in Wave 2. The kubeconfig blobs we return point at https://AKS-DATAPLANE-NOT-IMPLEMENTED.cloudemu.local so a caller that tries to talk Kubernetes immediately fails with a clear sentinel.

Mutating ops return 200 OK with the resource body inline so the SDK's LRO poller terminates on the first response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	CreateOrUpdateCluster(ctx context.Context, input aks.ClusterInput) (*aks.ManagedCluster, error)
	GetCluster(ctx context.Context, rg, name string) (*aks.ManagedCluster, error)
	UpdateClusterTags(ctx context.Context, rg, name string, tags map[string]string) (*aks.ManagedCluster, error)
	DeleteCluster(ctx context.Context, rg, name string) error
	ListClustersByResourceGroup(ctx context.Context, rg string) ([]aks.ManagedCluster, error)
	ListClusters(ctx context.Context) ([]aks.ManagedCluster, error)
	RotateClusterCertificates(ctx context.Context, rg, name string) error

	CreateOrUpdateAgentPool(ctx context.Context, rg, cluster string, in aks.AgentPoolInput) (*aks.AgentPool, error)
	GetAgentPool(ctx context.Context, rg, cluster, pool string) (*aks.AgentPool, error)
	DeleteAgentPool(ctx context.Context, rg, cluster, pool string) error
	ListAgentPools(ctx context.Context, rg, cluster string) ([]aks.AgentPool, error)

	CreateOrUpdateMaintenanceConfig(
		ctx context.Context, rg, cluster, name string, props map[string]any,
	) (*aks.MaintenanceConfig, error)
	GetMaintenanceConfig(ctx context.Context, rg, cluster, name string) (*aks.MaintenanceConfig, error)
	DeleteMaintenanceConfig(ctx context.Context, rg, cluster, name string) error
	ListMaintenanceConfigs(ctx context.Context, rg, cluster string) ([]aks.MaintenanceConfig, error)

	Kubeconfig(rg, name string) []byte
}

Backend is the minimal AKS surface the handler needs. *aks.Mock satisfies it; tests can swap a fake by satisfying the same methods.

type Handler

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

Handler serves Microsoft.ContainerService ARM requests against an AKS Backend.

func New

func New(be Backend) *Handler

New returns an AKS handler backed by be.

func (*Handler) Matches

func (*Handler) Matches(r *http.Request) bool

Matches returns true for ARM Microsoft.ContainerService managedClusters paths. AKS uses a mix of "managedClusters" and "managedclusters" in URL templates across SDK operations, so the match is case-insensitive on the resource type.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP routes the request based on path shape and method.

Jump to

Keyboard shortcuts

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