Documentation
¶
Overview ¶
Package aks provides an in-memory mock of Microsoft.ContainerService (Azure Kubernetes Service) — control-plane only.
Wave 1 scope: ManagedClusters + AgentPools + MaintenanceConfigurations CRUD and credential listing. The Kubernetes data-plane API (Deployments, Pods, Services, …) is intentionally NOT modeled here; that is deferred to Wave 2. The mock returns a stub kubeconfig pointing at a sentinel host so callers can detect that the data plane is not implemented.
Index ¶
- func AgentPoolResourceID(subscription, rg, cluster, pool string) string
- func ClusterResourceID(subscription, rg, name string) string
- func MaintenanceConfigResourceID(subscription, rg, cluster, name string) string
- type AgentPool
- type AgentPoolInput
- type ClusterInput
- type MaintenanceConfig
- type ManagedCluster
- type Mock
- func (m *Mock) CreateOrUpdateAgentPool(_ context.Context, rg, cluster string, in AgentPoolInput) (*AgentPool, error)
- func (m *Mock) CreateOrUpdateCluster(_ context.Context, input ClusterInput) (*ManagedCluster, error)
- func (m *Mock) CreateOrUpdateMaintenanceConfig(_ context.Context, rg, cluster, name string, props map[string]any) (*MaintenanceConfig, error)
- func (m *Mock) DeleteAgentPool(_ context.Context, rg, cluster, pool string) error
- func (m *Mock) DeleteCluster(_ context.Context, rg, name string) error
- func (m *Mock) DeleteMaintenanceConfig(_ context.Context, rg, cluster, name string) error
- func (m *Mock) GetAgentPool(_ context.Context, rg, cluster, pool string) (*AgentPool, error)
- func (m *Mock) GetCluster(_ context.Context, rg, name string) (*ManagedCluster, error)
- func (m *Mock) GetMaintenanceConfig(_ context.Context, rg, cluster, name string) (*MaintenanceConfig, error)
- func (m *Mock) ListAgentPools(_ context.Context, rg, cluster string) ([]AgentPool, error)
- func (m *Mock) ListClusters(_ context.Context) ([]ManagedCluster, error)
- func (m *Mock) ListClustersByResourceGroup(_ context.Context, rg string) ([]ManagedCluster, error)
- func (m *Mock) ListMaintenanceConfigs(_ context.Context, rg, cluster string) ([]MaintenanceConfig, error)
- func (m *Mock) RotateClusterCertificates(_ context.Context, rg, name string) error
- func (m *Mock) SetMonitoring(mon mondriver.Monitoring)
- func (*Mock) StubKubeconfig(rg, name string) []byte
- func (m *Mock) UpdateClusterTags(_ context.Context, rg, name string, tags map[string]string) (*ManagedCluster, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentPoolResourceID ¶
AgentPoolResourceID constructs the canonical ARM resource ID for an agent pool nested under a managed cluster.
func ClusterResourceID ¶
ClusterResourceID constructs the canonical ARM resource ID for a managed cluster.
func MaintenanceConfigResourceID ¶
MaintenanceConfigResourceID constructs the canonical ARM resource ID for a maintenance configuration nested under a managed cluster.
Types ¶
type AgentPool ¶
type AgentPool struct {
Name string
ClusterName string
ResourceGroup string
Count int32
VMSize string
OSDiskSizeGB int32
OSType string
Mode string
OrchestratorVer string
ProvisioningState string
NodeLabels map[string]string
NodeTaints []string
CreatedAt time.Time
UpdatedAt time.Time
}
AgentPool is a node pool attached to a managed cluster.
type AgentPoolInput ¶
type AgentPoolInput struct {
Name string
Count int32
VMSize string
OSDiskSizeGB int32
OSType string
Mode string
OrchestratorVer string
NodeLabels map[string]string
NodeTaints []string
}
AgentPoolInput captures the mutable fields of an AgentPool CreateOrUpdate.
type ClusterInput ¶
type ClusterInput struct {
Subscription string
ResourceGroup string
Name string
Location string
KubernetesVersion string
DNSPrefix string
NodeResourceGroup string
Tags map[string]string
// AgentPools may be nil for an empty cluster; otherwise these are the
// pools shipped inline at create time (system pool typically).
AgentPools []AgentPoolInput
}
ClusterInput captures the mutable fields of a CreateOrUpdate call.
type MaintenanceConfig ¶
type MaintenanceConfig struct {
Name string
ClusterName string
ResourceGroup string
Properties map[string]any
CreatedAt time.Time
UpdatedAt time.Time
}
MaintenanceConfig is a maintenance window attached to a managed cluster.
type ManagedCluster ¶
type ManagedCluster struct {
Name string
ResourceGroup string
Location string
KubernetesVersion string
DNSPrefix string
FQDN string
NodeResourceGroup string
ProvisioningState string
PowerState string
Tags map[string]string
AgentPoolNames []string
CreatedAt time.Time
UpdatedAt time.Time
}
ManagedCluster is the in-memory representation of an AKS cluster.
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock is the in-memory AKS implementation.
func (*Mock) CreateOrUpdateAgentPool ¶
func (m *Mock) CreateOrUpdateAgentPool( _ context.Context, rg, cluster string, in AgentPoolInput, ) (*AgentPool, error)
CreateOrUpdateAgentPool creates or replaces an agent pool on a cluster.
func (*Mock) CreateOrUpdateCluster ¶
func (m *Mock) CreateOrUpdateCluster(_ context.Context, input ClusterInput) (*ManagedCluster, error)
CreateOrUpdateCluster creates a new managed cluster or updates an existing one. The semantics mirror Azure ARM PUT: full replace, idempotent on no-op.
func (*Mock) CreateOrUpdateMaintenanceConfig ¶
func (m *Mock) CreateOrUpdateMaintenanceConfig( _ context.Context, rg, cluster, name string, props map[string]any, ) (*MaintenanceConfig, error)
CreateOrUpdateMaintenanceConfig creates or replaces a maintenance config.
func (*Mock) DeleteAgentPool ¶
DeleteAgentPool removes an agent pool.
func (*Mock) DeleteCluster ¶
DeleteCluster removes a managed cluster and all its sub-resources.
func (*Mock) DeleteMaintenanceConfig ¶
DeleteMaintenanceConfig removes a maintenance config.
func (*Mock) GetAgentPool ¶
GetAgentPool returns an agent pool by name.
func (*Mock) GetCluster ¶
GetCluster returns a managed cluster by name within a resource group.
func (*Mock) GetMaintenanceConfig ¶
func (m *Mock) GetMaintenanceConfig(_ context.Context, rg, cluster, name string) (*MaintenanceConfig, error)
GetMaintenanceConfig returns a maintenance config by name.
func (*Mock) ListAgentPools ¶
ListAgentPools returns all pools attached to a cluster.
func (*Mock) ListClusters ¶
func (m *Mock) ListClusters(_ context.Context) ([]ManagedCluster, error)
ListClusters returns all managed clusters across all resource groups.
func (*Mock) ListClustersByResourceGroup ¶
ListClustersByResourceGroup returns all clusters in a resource group.
func (*Mock) ListMaintenanceConfigs ¶
func (m *Mock) ListMaintenanceConfigs(_ context.Context, rg, cluster string) ([]MaintenanceConfig, error)
ListMaintenanceConfigs returns all maintenance configs on a cluster.
func (*Mock) RotateClusterCertificates ¶
RotateClusterCertificates is a stub that simply marks the cluster updated. Real Azure rotates control-plane certs asynchronously; the mock surface is sufficient for the SDK round-trip.
func (*Mock) SetMonitoring ¶
func (m *Mock) SetMonitoring(mon mondriver.Monitoring)
SetMonitoring wires an Azure-Monitor-style backend for auto-metric emission.
func (*Mock) StubKubeconfig ¶
StubKubeconfig returns a stub kubeconfig blob pointing at the "data-plane not implemented" sentinel host. Wave 2 will replace this with a real cloudemu-served Kubernetes API endpoint.
The output is deterministic: callers in tests can match on the sentinel host to confirm the data plane is intentionally unimplemented. The receiver is kept (unused) so the method satisfies the server-side Backend interface alongside the rest of the AKS surface.
func (*Mock) UpdateClusterTags ¶
func (m *Mock) UpdateClusterTags(_ context.Context, rg, name string, tags map[string]string) (*ManagedCluster, error)
UpdateClusterTags replaces the tags on a managed cluster (PATCH semantics).