Documentation
¶
Index ¶
- type AKSMachineClienter
- type MachineCache
- func (c *MachineCache) GetWithFallback(ctx context.Context, machineName string, useCache bool) (*armcontainerservice.Machine, error)
- func (c *MachineCache) Invalidate(machineName string)
- func (c *MachineCache) InvalidateAll()
- func (c *MachineCache) ListWithFallback(ctx context.Context, useCache bool) ([]*armcontainerservice.Machine, error)
- func (c *MachineCache) PollUntilDone(ctx context.Context, name string) (*armcontainerservice.ErrorDetail, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AKSMachineClienter ¶
type AKSMachineClienter interface {
NewListPager(resourceGroupName string, resourceName string, agentPoolName string, options *armcontainerservice.MachinesClientListOptions) *runtime.Pager[armcontainerservice.MachinesClientListResponse]
Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, machineName string, options *armcontainerservice.MachinesClientGetOptions) (armcontainerservice.MachinesClientGetResponse, error)
}
AKSMachineClienter provides operations for AKS machines.
type MachineCache ¶
type MachineCache struct {
// contains filtered or unexported fields
}
MachineCache caches AKS machine resources with TTL-based expiration.
func New ¶
func New(ctx context.Context, client AKSMachineClienter, clusterResourceGroup, clusterName, aksMachinesPoolName string, opts ...Option) *MachineCache
New creates a new cache instance with a background worker for updates. Updates to the cache are triggered when a stale cache is accessed.
func (*MachineCache) GetWithFallback ¶
func (c *MachineCache) GetWithFallback(ctx context.Context, machineName string, useCache bool) (*armcontainerservice.Machine, error)
GetWithFallback gets a machine. If useCache is true and the cache is fresh, it will attempt to return the machine from the cache. If the cache is stale or disabled, or if the machine is not found in the cache, it will fall back to calling the AKS API directly.
func (*MachineCache) Invalidate ¶
func (c *MachineCache) Invalidate(machineName string)
Invalidate removes a specific machine from the cache by name.
func (*MachineCache) InvalidateAll ¶
func (c *MachineCache) InvalidateAll()
InvalidateAll clears the entire cache, forcing the next access to fall through to the API.
func (*MachineCache) ListWithFallback ¶
func (c *MachineCache) ListWithFallback(ctx context.Context, useCache bool) ([]*armcontainerservice.Machine, error)
ListWithFallback lists all machines in the AKS machines pool. If useCache is true and the cache is fresh, it will attempt to return the list from the cache. If the cache is stale or disabled, it will fall back to calling the AKS API directly.
func (*MachineCache) PollUntilDone ¶
func (c *MachineCache) PollUntilDone(ctx context.Context, name string) (*armcontainerservice.ErrorDetail, error)
PollUntilDone polls for AKS machine provisioning completion using the cache. This polls indefinitely until the machine reaches a terminal state (Succeeded, Failed, or Deleting) or the context is canceled. If at any point the machine is not found, PollUntilDone will return an error.
type Option ¶
type Option func(opts) opts
Option is a functional option for configuring MachineCache.
func WithPollInterval ¶
WithPollInterval sets the interval for polling machine provisioning state when using the PollUntilDone helper.
func WithPollTimeout ¶
WithPollTimeout sets the maximum duration to wait for a machine to reach a terminal provisioning state before considering the poll to have timed out.