Documentation
¶
Index ¶
- Constants
- func CreateNewElection(k8sClient kubernetes.Interface, config ElectionConfig) (*leaderelection.LeaderElector, error)
- func RunController(k8sClient kubernetes.Interface, config ControllerConfig, done <-chan struct{}) error
- type Action
- type ActionType
- type AdapterCloudscaleClient
- func (adapter *AdapterCloudscaleClient) CreateFloatingIp(ctx context.Context, serverId string) (FloatingIp, error)
- func (adapter *AdapterCloudscaleClient) DeleteFloatingIp(ctx context.Context, ip string) error
- func (adapter *AdapterCloudscaleClient) GetFloatingIp(ctx context.Context, ip string) (FloatingIp, error)
- func (adapter *AdapterCloudscaleClient) GetServerId() (string, string, error)
- func (adapter *AdapterCloudscaleClient) GetServerIdForNode(ctx context.Context, name string) (string, error)
- func (adapter *AdapterCloudscaleClient) GetServerNameForServerId(ctx context.Context, serverId string) (string, error)
- func (adapter *AdapterCloudscaleClient) ListFloatingIps(ctx context.Context) ([]FloatingIp, error)
- func (adapter *AdapterCloudscaleClient) UpdateFloatingIp(ctx context.Context, ip string, serverId string) (FloatingIp, error)
- type CloudscaleClient
- type ControllerConfig
- type DefaultRetryManager
- func (m *DefaultRetryManager) IsAffectedByRetry(svc *v1.Service, actionType ActionType, wasDeleted bool) bool
- func (m *DefaultRetryManager) IsEndpointsAffectedByRetry(namespace string, name string) bool
- func (m *DefaultRetryManager) Start()
- func (m *DefaultRetryManager) Stop()
- func (m *DefaultRetryManager) SubmitForUpdate(svc *v1.Service, actionType ActionType, wasDeleted bool)
- type ElectionConfig
- type EventProcessor
- func (processor *EventProcessor) CreateIp(svc *v1.Service) error
- func (processor *EventProcessor) DeleteIp(svc *v1.Service, wasDeleted bool) error
- func (processor *EventProcessor) ReAttach(namespace string, name string) (*v1.Service, error)
- func (processor *EventProcessor) VerifyIp(svc *v1.Service) error
- type FloatingIp
- type FloatingIpInformation
- type HashMapRepository
- func (repo *HashMapRepository) Clear()
- func (repo *HashMapRepository) DeleteFloatingIp(ip string)
- func (repo *HashMapRepository) DeleteService(namespace string, name string)
- func (repo *HashMapRepository) GetFloatingIp(ip string) (FloatingIpInformation, bool)
- func (repo *HashMapRepository) GetFloatingIpForService(namespace string, name string) (FloatingIpInformation, bool)
- func (repo *HashMapRepository) GetService(namespace string, name string) bool
- func (repo *HashMapRepository) PutFloatingIp(serviceNamespace string, serviceName string, ip string, serverName string) FloatingIpInformation
- func (repo *HashMapRepository) PutService(namespace string, name string)
- type Repository
- type RetryEntry
- type RetryManager
- type ServiceWatcher
- type WatchResult
Constants ¶
View Source
const ControllerAnnotation = "linkyard.ch/slb-controller-id"
View Source
const ExistingIpAnnotation = "linkyard.ch/existing-floating-ip"
Variables ¶
This section is empty.
Functions ¶
func CreateNewElection ¶
func CreateNewElection(k8sClient kubernetes.Interface, config ElectionConfig) (*leaderelection.LeaderElector, error)
func RunController ¶
func RunController(k8sClient kubernetes.Interface, config ControllerConfig, done <-chan struct{}) error
Types ¶
type Action ¶
type Action struct {
ActionType ActionType
Service *v1.Service
}
type ActionType ¶
type ActionType string
const ( CreateIp ActionType = "CreateIp" DeleteIp ActionType = "DeleteIp" Ignore ActionType = "Ignore" VerifyIp ActionType = "VerifyIp" )
type AdapterCloudscaleClient ¶
type AdapterCloudscaleClient struct {
// contains filtered or unexported fields
}
func NewCloudscaleClient ¶
func NewCloudscaleClient(token string, ipLimit int) (*AdapterCloudscaleClient, error)
func (*AdapterCloudscaleClient) CreateFloatingIp ¶
func (adapter *AdapterCloudscaleClient) CreateFloatingIp(ctx context.Context, serverId string) (FloatingIp, error)
func (*AdapterCloudscaleClient) DeleteFloatingIp ¶
func (adapter *AdapterCloudscaleClient) DeleteFloatingIp(ctx context.Context, ip string) error
func (*AdapterCloudscaleClient) GetFloatingIp ¶
func (adapter *AdapterCloudscaleClient) GetFloatingIp(ctx context.Context, ip string) (FloatingIp, error)
func (*AdapterCloudscaleClient) GetServerId ¶
func (adapter *AdapterCloudscaleClient) GetServerId() (string, string, error)
func (*AdapterCloudscaleClient) GetServerIdForNode ¶
func (*AdapterCloudscaleClient) GetServerNameForServerId ¶
func (*AdapterCloudscaleClient) ListFloatingIps ¶
func (adapter *AdapterCloudscaleClient) ListFloatingIps(ctx context.Context) ([]FloatingIp, error)
func (*AdapterCloudscaleClient) UpdateFloatingIp ¶
func (adapter *AdapterCloudscaleClient) UpdateFloatingIp(ctx context.Context, ip string, serverId string) (FloatingIp, error)
type CloudscaleClient ¶
type CloudscaleClient interface {
// returns the ID and name of the server this client is running on
GetServerId() (string, string, error)
// returns the ID of the server with the given name
GetServerIdForNode(ctx context.Context, name string) (string, error)
// returns the name of the server with the given id
GetServerNameForServerId(ctx context.Context, id string) (string, error)
// creates a new floating IP attached to the given server
CreateFloatingIp(ctx context.Context, serverId string) (FloatingIp, error)
// returns all floating IPs in the cloudscale.ch account
ListFloatingIps(ctx context.Context) ([]FloatingIp, error)
// returns the floating IP with the given IP address
GetFloatingIp(ctx context.Context, ip string) (FloatingIp, error)
// updates the floating IP to point to the given server
UpdateFloatingIp(ctx context.Context, ip string, serverId string) (FloatingIp, error)
// deletes the floating IP
DeleteFloatingIp(ctx context.Context, ip string) error
}
an adapter to the cloudscale api / upstream go client to make unit testing easier
type ControllerConfig ¶
type DefaultRetryManager ¶
type DefaultRetryManager struct {
// contains filtered or unexported fields
}
func NewRetryManager ¶
func NewRetryManager(processor *EventProcessor, repository Repository) *DefaultRetryManager
func (*DefaultRetryManager) IsAffectedByRetry ¶
func (m *DefaultRetryManager) IsAffectedByRetry(svc *v1.Service, actionType ActionType, wasDeleted bool) bool
func (*DefaultRetryManager) IsEndpointsAffectedByRetry ¶
func (m *DefaultRetryManager) IsEndpointsAffectedByRetry(namespace string, name string) bool
func (*DefaultRetryManager) Start ¶
func (m *DefaultRetryManager) Start()
func (*DefaultRetryManager) Stop ¶
func (m *DefaultRetryManager) Stop()
func (*DefaultRetryManager) SubmitForUpdate ¶
func (m *DefaultRetryManager) SubmitForUpdate(svc *v1.Service, actionType ActionType, wasDeleted bool)
type ElectionConfig ¶
type ElectionConfig struct {
Hostname string
ConfigMapNamespace string
ConfigMapName string
TTL time.Duration
ElectionId string
Callbacks leaderelection.LeaderCallbacks
}
type EventProcessor ¶
type EventProcessor struct {
Repository Repository
// contains filtered or unexported fields
}
func NewEventProcessor ¶
func NewEventProcessor(client CloudscaleClient, k8sClient kubernetes.Interface, serverId string, serverName string, ctx context.Context, repository Repository) *EventProcessor
func (*EventProcessor) CreateIp ¶
func (processor *EventProcessor) CreateIp(svc *v1.Service) error
func (*EventProcessor) DeleteIp ¶
func (processor *EventProcessor) DeleteIp(svc *v1.Service, wasDeleted bool) error
func (*EventProcessor) ReAttach ¶
func (processor *EventProcessor) ReAttach(namespace string, name string) (*v1.Service, error)
func (*EventProcessor) VerifyIp ¶
func (processor *EventProcessor) VerifyIp(svc *v1.Service) error
type FloatingIp ¶
type FloatingIpInformation ¶
type HashMapRepository ¶
type HashMapRepository struct {
// contains filtered or unexported fields
}
func (*HashMapRepository) Clear ¶
func (repo *HashMapRepository) Clear()
func (*HashMapRepository) DeleteFloatingIp ¶
func (repo *HashMapRepository) DeleteFloatingIp(ip string)
func (*HashMapRepository) DeleteService ¶
func (repo *HashMapRepository) DeleteService(namespace string, name string)
func (*HashMapRepository) GetFloatingIp ¶
func (repo *HashMapRepository) GetFloatingIp(ip string) (FloatingIpInformation, bool)
func (*HashMapRepository) GetFloatingIpForService ¶
func (repo *HashMapRepository) GetFloatingIpForService(namespace string, name string) (FloatingIpInformation, bool)
func (*HashMapRepository) GetService ¶
func (repo *HashMapRepository) GetService(namespace string, name string) bool
func (*HashMapRepository) PutFloatingIp ¶
func (repo *HashMapRepository) PutFloatingIp(serviceNamespace string, serviceName string, ip string, serverName string) FloatingIpInformation
func (*HashMapRepository) PutService ¶
func (repo *HashMapRepository) PutService(namespace string, name string)
type Repository ¶
type Repository interface {
Clear()
GetService(namespace string, name string) bool
PutService(namespace string, name string)
DeleteService(namespace string, name string)
GetFloatingIpForService(namespace string, name string) (FloatingIpInformation, bool)
GetFloatingIp(ip string) (FloatingIpInformation, bool)
PutFloatingIp(serviceNamespace string, serviceName string, ip string, serverName string) FloatingIpInformation
DeleteFloatingIp(ip string)
}
func NewRepository ¶
func NewRepository() Repository
type RetryEntry ¶
type RetryEntry struct {
Service *v1.Service
ActionType ActionType
WasDeleted bool
BlockedUntil time.Time
Retries int
}
type RetryManager ¶
type RetryManager interface {
IsEndpointsAffectedByRetry(namespace string, name string) bool
IsAffectedByRetry(svc *v1.Service, actionType ActionType, wasDeleted bool) bool
SubmitForUpdate(svc *v1.Service, actionType ActionType, wasDeleted bool)
Start()
Stop()
}
type ServiceWatcher ¶
type ServiceWatcher struct {
Repository Repository
// contains filtered or unexported fields
}
func (ServiceWatcher) Watch ¶
func (s ServiceWatcher) Watch(controllerId string, servicesChannel <-chan watch.Event, endpointsChannel <-chan watch.Event, done <-chan struct{}, outputChannel chan WatchResult)
type WatchResult ¶
Click to show internal directories.
Click to hide internal directories.