cluster

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddonInfo

type AddonInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Status  string `json:"status"`
	Health  string `json:"health,omitempty"`
}

AddonInfo contains EKS add-on information

type Cache

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

Cache provides thread-safe caching with TTL

func NewCache

func NewCache(defaultTTL time.Duration) *Cache

NewCache creates a new cache instance

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all items from the cache

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes a value from the cache

func (*Cache) Get

func (c *Cache) Get(key string) (interface{}, bool)

Get retrieves a value from the cache

func (*Cache) Set

func (c *Cache) Set(key string, value interface{}, ttl time.Duration)

Set stores a value in the cache with specified TTL

func (*Cache) SetDefault

func (c *Cache) SetDefault(key string, value interface{})

SetDefault stores a value in the cache with default TTL

func (*Cache) Stats

func (c *Cache) Stats() map[string]interface{}

Stats returns cache statistics

type CacheItem

type CacheItem struct {
	Value     interface{}
	ExpiresAt time.Time
}

CacheItem represents a cached item with expiration

type ClusterComparison

type ClusterComparison struct {
	Clusters    []ClusterDetails  `json:"clusters"`
	Differences []Difference      `json:"differences"`
	Summary     ComparisonSummary `json:"summary"`
}

ClusterComparison contains results of comparing multiple clusters

type ClusterDetails

type ClusterDetails struct {
	// Basic cluster info
	Name            string    `json:"name"`
	Status          string    `json:"status"`
	Version         string    `json:"version"`
	PlatformVersion string    `json:"platformVersion"`
	Endpoint        string    `json:"endpoint"`
	CreatedAt       time.Time `json:"createdAt"`
	Region          string    `json:"region"`

	// Health information (integration with existing health framework)
	Health *health.HealthSummary `json:"health,omitempty"`

	// Networking details
	Networking NetworkingInfo `json:"networking"`

	// Security configuration
	Security SecurityInfo `json:"security"`

	// Add-ons and nodegroups
	Addons     []AddonInfo        `json:"addons"`
	Nodegroups []NodegroupSummary `json:"nodegroups"`

	// Operational metadata
	Tags map[string]string `json:"tags"`
}

ClusterDetails contains comprehensive cluster information

type ClusterSummary

type ClusterSummary struct {
	Name      string                `json:"name"`
	Status    string                `json:"status"`
	Version   string                `json:"version"`
	Region    string                `json:"region"`
	Health    *health.HealthSummary `json:"health,omitempty"`
	NodeCount NodeCountInfo         `json:"nodeCount"`
	CreatedAt time.Time             `json:"createdAt"`
	Tags      map[string]string     `json:"tags,omitempty"`
}

ClusterSummary is used for list operations

type CompareOptions

type CompareOptions struct {
	ShowDifferencesOnly bool     `json:"showDifferencesOnly"`
	Include             []string `json:"include"` // networking, security, addons, versions
	Format              string   `json:"format"`
}

CompareOptions controls cluster comparison behavior

type ComparisonSummary

type ComparisonSummary struct {
	TotalDifferences      int  `json:"totalDifferences"`
	CriticalDifferences   int  `json:"criticalDifferences"`
	WarningDifferences    int  `json:"warningDifferences"`
	InfoDifferences       int  `json:"infoDifferences"`
	ClustersAreEquivalent bool `json:"clustersAreEquivalent"`
}

ComparisonSummary provides overview of cluster comparison

type DescribeOptions

type DescribeOptions struct {
	ShowHealth    bool `json:"showHealth"`
	ShowSecurity  bool `json:"showSecurity"`
	ShowCosts     bool `json:"showCosts"`
	IncludeAddons bool `json:"includeAddons"`
	Detailed      bool `json:"detailed"`
}

DescribeOptions controls what information to include in describe operations

type Difference

type Difference struct {
	Field       string      `json:"field"`
	Description string      `json:"description"`
	Values      []ValuePair `json:"values"`
	Severity    string      `json:"severity"` // info, warning, critical
}

Difference represents a configuration difference between clusters

type EKSAPI added in v0.2.1

type EKSAPI interface {
	ListClusters(ctx context.Context, params *eks.ListClustersInput, optFns ...func(*eks.Options)) (*eks.ListClustersOutput, error)
	DescribeCluster(ctx context.Context, params *eks.DescribeClusterInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterOutput, error)
	ListNodegroups(ctx context.Context, params *eks.ListNodegroupsInput, optFns ...func(*eks.Options)) (*eks.ListNodegroupsOutput, error)
	DescribeNodegroup(ctx context.Context, params *eks.DescribeNodegroupInput, optFns ...func(*eks.Options)) (*eks.DescribeNodegroupOutput, error)
	ListAddons(ctx context.Context, params *eks.ListAddonsInput, optFns ...func(*eks.Options)) (*eks.ListAddonsOutput, error)
	DescribeAddon(ctx context.Context, params *eks.DescribeAddonInput, optFns ...func(*eks.Options)) (*eks.DescribeAddonOutput, error)
}

EKSAPI abstracts the subset of EKS client methods used by this service for easier testing

type EndpointAccessInfo

type EndpointAccessInfo struct {
	PrivateAccess bool     `json:"privateAccess"`
	PublicAccess  bool     `json:"publicAccess"`
	PublicCidrs   []string `json:"publicCidrs,omitempty"`
}

EndpointAccessInfo describes cluster endpoint configuration

type ListOptions

type ListOptions struct {
	Regions        []string          `json:"regions"`
	ShowHealth     bool              `json:"showHealth"`
	ShowCosts      bool              `json:"showCosts"`
	Filters        map[string]string `json:"filters"`
	AllRegions     bool              `json:"allRegions"`
	MaxConcurrency int               `json:"maxConcurrency"`
}

ListOptions controls cluster listing behavior

type NetworkingInfo

type NetworkingInfo struct {
	VpcId            string             `json:"vpcId"`
	VpcCidr          string             `json:"vpcCidr,omitempty"`
	SubnetIds        []string           `json:"subnetIds"`
	SecurityGroupIds []string           `json:"securityGroupIds"`
	EndpointAccess   EndpointAccessInfo `json:"endpointAccess"`
}

NetworkingInfo contains VPC and networking details

type NodeCountInfo

type NodeCountInfo struct {
	Ready int32 `json:"ready"`
	Total int32 `json:"total"`
}

NodeCountInfo aggregates node information across nodegroups

type NodegroupSummary

type NodegroupSummary struct {
	Name         string `json:"name"`
	Status       string `json:"status"`
	InstanceType string `json:"instanceType"`
	DesiredSize  int32  `json:"desiredSize"`
	ReadyNodes   int32  `json:"readyNodes"`
}

NodegroupSummary contains basic nodegroup information

type SecurityInfo

type SecurityInfo struct {
	EncryptionEnabled  bool     `json:"encryptionEnabled"`
	KmsKeyArn          string   `json:"kmsKeyArn,omitempty"`
	ServiceRoleArn     string   `json:"serviceRoleArn"`
	LoggingEnabled     []string `json:"loggingEnabled"`
	DeletionProtection bool     `json:"deletionProtection"`
}

SecurityInfo contains cluster security configuration

type Service

type Service interface {
	// Single cluster operations
	Describe(ctx context.Context, name string, options DescribeOptions) (*ClusterDetails, error)
	GetHealth(ctx context.Context, name string) (*health.HealthSummary, error)

	// Multi-cluster operations
	List(ctx context.Context, options ListOptions) ([]ClusterSummary, error)
	ListAllRegions(ctx context.Context, options ListOptions) ([]ClusterSummary, error)

	// Comparison operations
	Compare(ctx context.Context, clusterNames []string, options CompareOptions) (*ClusterComparison, error)
}

Service defines the interface for cluster operations

type ServiceImpl

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

ServiceImpl implements the cluster service

func NewService

func NewService(awsConfig aws.Config, healthChecker *health.HealthChecker, logger *slog.Logger) *ServiceImpl

NewService creates a new cluster service instance

func (*ServiceImpl) Compare

func (s *ServiceImpl) Compare(ctx context.Context, clusterNames []string, options CompareOptions) (*ClusterComparison, error)

Compare provides side-by-side cluster comparison

func (*ServiceImpl) Describe

func (s *ServiceImpl) Describe(ctx context.Context, name string, options DescribeOptions) (*ClusterDetails, error)

Describe provides comprehensive cluster information

func (*ServiceImpl) GetHealth

func (s *ServiceImpl) GetHealth(ctx context.Context, name string) (*health.HealthSummary, error)

GetHealth gets health status for a specific cluster

func (*ServiceImpl) List

func (s *ServiceImpl) List(ctx context.Context, options ListOptions) ([]ClusterSummary, error)

List provides fast cluster listing with optional health information

func (*ServiceImpl) ListAllRegions

func (s *ServiceImpl) ListAllRegions(ctx context.Context, options ListOptions) ([]ClusterSummary, error)

ListAllRegions lists clusters across all EKS-supported regions

type ValuePair

type ValuePair struct {
	ClusterName string      `json:"clusterName"`
	Value       interface{} `json:"value"`
}

ValuePair represents different values for the same field

Jump to

Keyboard shortcuts

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