Documentation
¶
Index ¶
- type BaseService
- func (s *BaseService) GetAddress() string
- func (s *BaseService) GetContainerName() string
- func (s *BaseService) GetHostname() string
- func (s *BaseService) GetName() string
- func (s *BaseService) Initialize() error
- func (s *BaseService) SetAddress(address string) error
- func (s *BaseService) SetName(name string)
- func (s *BaseService) SupportsWildcard() bool
- func (s *BaseService) WriteConfig() error
- type DNSService
- type GitLivereloadService
- type LocalstackService
- type MockService
- func (m *MockService) GetAddress() string
- func (m *MockService) GetComposeConfig() (*types.Config, error)
- func (m *MockService) GetHostname() string
- func (m *MockService) GetName() string
- func (m *MockService) Initialize() error
- func (m *MockService) SetAddress(address string) error
- func (m *MockService) SetName(name string)
- func (m *MockService) SupportsWildcard() bool
- func (m *MockService) WriteConfig() error
- type RegistryService
- type Service
- type Shims
- type TalosService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseService ¶
type BaseService struct {
// contains filtered or unexported fields
}
BaseService is a base implementation of the Service interface
func NewBaseService ¶ added in v0.5.7
func NewBaseService(injector di.Injector) *BaseService
NewBaseService is a constructor for BaseService
func (*BaseService) GetAddress ¶
func (s *BaseService) GetAddress() string
GetAddress returns the current address of the service
func (*BaseService) GetContainerName ¶ added in v0.5.7
func (s *BaseService) GetContainerName() string
GetContainerName returns the container name with the "windsor-" prefix and without the DNS domain
func (*BaseService) GetHostname ¶ added in v0.3.0
func (s *BaseService) GetHostname() string
GetHostname returns the hostname for the service with the configured TLD
func (*BaseService) GetName ¶
func (s *BaseService) GetName() string
GetName returns the current name of the service
func (*BaseService) Initialize ¶
func (s *BaseService) Initialize() error
func (*BaseService) SetAddress ¶
func (s *BaseService) SetAddress(address string) error
SetAddress sets the address if it is a valid IPv4 address
func (*BaseService) SetName ¶
func (s *BaseService) SetName(name string)
SetName sets the name of the service
func (*BaseService) SupportsWildcard ¶ added in v0.5.7
func (s *BaseService) SupportsWildcard() bool
SupportsWildcard returns whether the service supports wildcard DNS entries
func (*BaseService) WriteConfig ¶
func (s *BaseService) WriteConfig() error
WriteConfig is a no-op for the Service interface
type DNSService ¶
type DNSService struct {
BaseService
// contains filtered or unexported fields
}
DNSService handles DNS configuration
func NewDNSService ¶
func NewDNSService(injector di.Injector) *DNSService
NewDNSService creates a new DNSService
func (*DNSService) GetComposeConfig ¶
func (s *DNSService) GetComposeConfig() (*types.Config, error)
GetComposeConfig sets up CoreDNS with context and domain, configures ports if localhost.
func (*DNSService) Initialize ¶
func (s *DNSService) Initialize() error
Initialize sets up DNSService by resolving dependencies via DI.
func (*DNSService) SetAddress ¶
func (s *DNSService) SetAddress(address string) error
SetAddress updates DNS address in config and calls BaseService's SetAddress.
func (*DNSService) WriteConfig ¶
func (s *DNSService) WriteConfig() error
WriteConfig generates a Corefile by collecting the project root directory, top-level domain (TLD), and IP addresses. It adds DNS entries for each service, ensuring that each service's hostname resolves to its IP address. For localhost environments, it uses a specific DNS template to handle local DNS resolution and sets up forwarding rules to direct DNS queries to the appropriate addresses. The Corefile is saved in the .windsor directory, which is used by CoreDNS to manage DNS queries for the project.
type GitLivereloadService ¶
type GitLivereloadService struct {
BaseService
}
GitLivereloadService is a service struct that provides various utility functions
func NewGitLivereloadService ¶
func NewGitLivereloadService(injector di.Injector) *GitLivereloadService
NewGitLivereloadService is a constructor for GitLivereloadService
func (*GitLivereloadService) GetComposeConfig ¶
func (s *GitLivereloadService) GetComposeConfig() (*types.Config, error)
GetComposeConfig returns the top-level compose configuration including a list of container data for docker-compose.
type LocalstackService ¶
type LocalstackService struct {
BaseService
}
LocalstackService is a service struct that provides Localstack-specific utility functions
func NewLocalstackService ¶
func NewLocalstackService(injector di.Injector) *LocalstackService
NewLocalstackService is a constructor for LocalstackService
func (*LocalstackService) GetComposeConfig ¶
func (s *LocalstackService) GetComposeConfig() (*types.Config, error)
GetComposeConfig returns the top-level compose configuration including a list of container data for docker-compose.
func (*LocalstackService) SupportsWildcard ¶ added in v0.5.7
func (s *LocalstackService) SupportsWildcard() bool
SupportsWildcard returns whether the service supports wildcard DNS entries
type MockService ¶
type MockService struct {
BaseService
GetComposeConfigFunc func() (*types.Config, error)
WriteConfigFunc func() error
SetAddressFunc func(address string) error
GetAddressFunc func() string
InitializeFunc func() error
SetNameFunc func(name string)
GetNameFunc func() string
GetHostnameFunc func() string
SupportsWildcardFunc func() bool
}
MockService is a mock implementation of the Service interface
func NewMockService ¶
func NewMockService() *MockService
NewMockService is a constructor for MockService
func (*MockService) GetAddress ¶
func (m *MockService) GetAddress() string
GetAddress calls the mock GetAddressFunc if it is set, otherwise returns an empty string
func (*MockService) GetComposeConfig ¶
func (m *MockService) GetComposeConfig() (*types.Config, error)
GetComposeConfig calls the mock GetComposeConfigFunc if it is set, otherwise returns nil
func (*MockService) GetHostname ¶ added in v0.3.0
func (m *MockService) GetHostname() string
GetHostname calls the mock GetHostnameFunc if it is set, otherwise returns an empty string
func (*MockService) GetName ¶
func (m *MockService) GetName() string
GetName calls the mock GetNameFunc if it is set, otherwise returns the stored name
func (*MockService) Initialize ¶
func (m *MockService) Initialize() error
Initialize calls the mock InitializeFunc if it is set, otherwise returns nil
func (*MockService) SetAddress ¶
func (m *MockService) SetAddress(address string) error
SetAddress calls the mock SetAddressFunc if it is set, otherwise returns nil
func (*MockService) SetName ¶
func (m *MockService) SetName(name string)
SetName calls the mock SetNameFunc if it is set
func (*MockService) SupportsWildcard ¶ added in v0.5.7
func (m *MockService) SupportsWildcard() bool
SupportsWildcard calls the mock SupportsWildcardFunc if it is set, otherwise returns false
func (*MockService) WriteConfig ¶
func (m *MockService) WriteConfig() error
WriteConfig calls the mock WriteConfigFunc if it is set, otherwise returns nil
type RegistryService ¶
type RegistryService struct {
BaseService
// contains filtered or unexported fields
}
RegistryService is a service struct that provides Registry-specific utility functions
func NewRegistryService ¶
func NewRegistryService(injector di.Injector) *RegistryService
NewRegistryService is a constructor for RegistryService
func (*RegistryService) GetComposeConfig ¶
func (s *RegistryService) GetComposeConfig() (*types.Config, error)
GetComposeConfig returns a Docker Compose configuration for the registry matching s.name. It retrieves the context configuration, finds the registry, and generates a service config. If no matching registry is found, it returns an error.
func (*RegistryService) GetHostname ¶ added in v0.3.0
func (s *RegistryService) GetHostname() string
GetHostname returns the hostname for the registry service, removing the last domain part
func (*RegistryService) SetAddress ¶
func (s *RegistryService) SetAddress(address string) error
SetAddress configures the registry's address, forms a hostname, and updates the registry config. It assigns the "registry_url" and the default host port for the first non-remote registry, storing it as "localRegistry".
type Service ¶
type Service interface {
GetComposeConfig() (*types.Config, error)
WriteConfig() error
SetAddress(address string) error
GetAddress() string
SetName(name string)
GetName() string
Initialize() error
SupportsWildcard() bool
GetHostname() string
}
Service is an interface that defines methods for retrieving environment variables and can be implemented for individual providers.
type Shims ¶ added in v0.5.7
type Shims struct {
Getwd func() (string, error)
Glob func(pattern string) (matches []string, err error)
WriteFile func(filename string, data []byte, perm os.FileMode) error
Stat func(name string) (os.FileInfo, error)
Mkdir func(path string, perm os.FileMode) error
MkdirAll func(path string, perm os.FileMode) error
Rename func(oldpath, newpath string) error
YamlMarshal func(in interface{}) ([]byte, error)
YamlUnmarshal func(in []byte, out interface{}) error
JsonUnmarshal func(data []byte, v interface{}) error
UserHomeDir func() (string, error)
}
Shims provides mockable wrappers around system and runtime functions
type TalosService ¶ added in v0.4.0
type TalosService struct {
BaseService
// contains filtered or unexported fields
}
func NewTalosService ¶ added in v0.4.0
func NewTalosService(injector di.Injector, mode string) *TalosService
NewTalosService is a constructor for TalosService
func (*TalosService) GetComposeConfig ¶ added in v0.4.0
func (s *TalosService) GetComposeConfig() (*types.Config, error)
GetComposeConfig creates a Docker Compose configuration for Talos services. It dynamically retrieves CPU and RAM settings based on whether the node is a worker or part of the control plane. The function identifies endpoint ports for service communication and ensures that all necessary volume directories are defined. It configures the container with the appropriate image (prioritizing node-specific, then group-specific, then cluster-wide, and finally default image settings), environment variables, security options, and volume mounts. The service name is constructed using the node name, and port mappings are set up, including both default and node-specific ports. The resulting configuration provides comprehensive service and volume specifications for deployment.
func (*TalosService) SetAddress ¶ added in v0.4.0
func (s *TalosService) SetAddress(address string) error
SetAddress configures the Talos service's hostname and endpoint using the provided address. It assigns the default API port to the leader controlplane or a unique port if the address is not local. For other nodes, it assigns unique API ports starting from 50001, incrementing for each node. A mutex is used to safely manage concurrent access to the port allocation. Node ports are configured based on the cluster configuration, ensuring no conflicts.