Documentation
¶
Overview ¶
Package compute provides infrastructure provider implementations. DigitalOcean provider for creating and managing DigitalOcean droplets https://github.com/digitalocean/godo/blob/main/droplets.go#L18
Index ¶
- func NewDOClient(token string) computeTypes.DOClient
- type AnsibleConfigurator
- func (a *AnsibleConfigurator) ConfigureHost(ctx context.Context, host string, sshKeyPath string) error
- func (a *AnsibleConfigurator) ConfigureHosts(ctx context.Context, hosts []string, sshKeyPath string) error
- func (a *AnsibleConfigurator) CreateInventory(instance *types.InstanceRequest, talisSSHKeyPath string) (string, error)
- func (a *AnsibleConfigurator) RunAnsiblePlaybook(inventoryPath string) error
- type DefaultDOClient
- func (c *DefaultDOClient) ConfigureProvider(_ interface{}) error
- func (c *DefaultDOClient) CreateInstance(ctx context.Context, config *talisTypes.InstanceRequest) error
- func (c *DefaultDOClient) DeleteInstance(ctx context.Context, dropletID int) error
- func (c *DefaultDOClient) Droplets() computeTypes.DropletService
- func (c *DefaultDOClient) GetEnvironmentVars() map[string]string
- func (c *DefaultDOClient) Keys() computeTypes.KeyService
- func (c *DefaultDOClient) Storage() computeTypes.StorageService
- func (c *DefaultDOClient) ValidateCredentials() error
- type DefaultDropletService
- func (s *DefaultDropletService) Create(ctx context.Context, createRequest *godo.DropletCreateRequest) (*godo.Droplet, *godo.Response, error)
- func (s *DefaultDropletService) Delete(ctx context.Context, dropletID int) (*godo.Response, error)
- func (s *DefaultDropletService) Get(ctx context.Context, dropletID int) (*godo.Droplet, *godo.Response, error)
- func (s *DefaultDropletService) List(ctx context.Context, opt *godo.ListOptions) ([]godo.Droplet, *godo.Response, error)
- type DefaultKeyService
- type DefaultStorageService
- func (s *DefaultStorageService) AttachVolume(ctx context.Context, volumeID string, dropletID int) (*godo.Response, error)
- func (s *DefaultStorageService) CreateVolume(ctx context.Context, request *godo.VolumeCreateRequest) (*godo.Volume, *godo.Response, error)
- func (s *DefaultStorageService) DeleteVolume(ctx context.Context, id string) (*godo.Response, error)
- func (s *DefaultStorageService) DetachVolume(ctx context.Context, volumeID string, dropletID int) (*godo.Response, error)
- func (s *DefaultStorageService) GetVolume(ctx context.Context, id string) (*godo.Volume, *godo.Response, error)
- func (s *DefaultStorageService) GetVolumeAction(ctx context.Context, volumeID string, actionID int) (*godo.Action, *godo.Response, error)
- func (s *DefaultStorageService) ListVolumes(ctx context.Context, opt *godo.ListVolumeParams) ([]godo.Volume, *godo.Response, error)
- type DigitalOceanProvider
- func (p *DigitalOceanProvider) ConfigureProvider(_ interface{}) error
- func (p *DigitalOceanProvider) CreateInstance(ctx context.Context, config *talisTypes.InstanceRequest) error
- func (p *DigitalOceanProvider) DeleteInstance(ctx context.Context, dropletID int) error
- func (p *DigitalOceanProvider) GetEnvironmentVars() map[string]string
- func (p *DigitalOceanProvider) SetClient(client computeTypes.DOClient)
- func (p *DigitalOceanProvider) ValidateCredentials() error
- type Provider
- type Provisioner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDOClient ¶
func NewDOClient(token string) computeTypes.DOClient
NewDOClient creates a new DigitalOcean client
Types ¶
type AnsibleConfigurator ¶
type AnsibleConfigurator struct {
// contains filtered or unexported fields
}
AnsibleConfigurator implements the Provisioner interface
func NewAnsibleConfigurator ¶
func NewAnsibleConfigurator(jobID string) *AnsibleConfigurator
NewAnsibleConfigurator creates a new Ansible configurator
func (*AnsibleConfigurator) ConfigureHost ¶
func (a *AnsibleConfigurator) ConfigureHost(ctx context.Context, host string, sshKeyPath string) error
ConfigureHost implements the Provisioner interface
NOTE: this isn't a create name since all it is really doing is ensuring SSH readiness
func (*AnsibleConfigurator) ConfigureHosts ¶
func (a *AnsibleConfigurator) ConfigureHosts(ctx context.Context, hosts []string, sshKeyPath string) error
ConfigureHosts ensures SSH readiness for multiple hosts in parallel. It no longer creates the inventory or runs the playbook.
NOTE: this isn't a create name since all it is really doing is ensuring SSH readiness
func (*AnsibleConfigurator) CreateInventory ¶
func (a *AnsibleConfigurator) CreateInventory(instance *types.InstanceRequest, talisSSHKeyPath string) (string, error)
CreateInventory creates the inventory file directly from InstanceRequest and returns the inventory path file
func (*AnsibleConfigurator) RunAnsiblePlaybook ¶
func (a *AnsibleConfigurator) RunAnsiblePlaybook(inventoryPath string) error
RunAnsiblePlaybook runs the Ansible playbook for all instances in parallel
type DefaultDOClient ¶
type DefaultDOClient struct {
// contains filtered or unexported fields
}
DefaultDOClient is the default implementation of DOClient
func (*DefaultDOClient) ConfigureProvider ¶
func (c *DefaultDOClient) ConfigureProvider(_ interface{}) error
ConfigureProvider configures the provider with the given stack
func (*DefaultDOClient) CreateInstance ¶
func (c *DefaultDOClient) CreateInstance(ctx context.Context, config *talisTypes.InstanceRequest) error
CreateInstance creates a new instance
func (*DefaultDOClient) DeleteInstance ¶
func (c *DefaultDOClient) DeleteInstance(ctx context.Context, dropletID int) error
DeleteInstance deletes an instance
func (*DefaultDOClient) Droplets ¶
func (c *DefaultDOClient) Droplets() computeTypes.DropletService
Droplets returns the droplet service
func (*DefaultDOClient) GetEnvironmentVars ¶
func (c *DefaultDOClient) GetEnvironmentVars() map[string]string
GetEnvironmentVars returns the environment variables needed for the provider
func (*DefaultDOClient) Keys ¶
func (c *DefaultDOClient) Keys() computeTypes.KeyService
Keys returns the key service
func (*DefaultDOClient) Storage ¶
func (c *DefaultDOClient) Storage() computeTypes.StorageService
Storage returns the storage service
func (*DefaultDOClient) ValidateCredentials ¶
func (c *DefaultDOClient) ValidateCredentials() error
ValidateCredentials validates the provider credentials
type DefaultDropletService ¶
type DefaultDropletService struct {
// contains filtered or unexported fields
}
DefaultDropletService adapts godo.DropletService to our DropletService interface
func (*DefaultDropletService) Create ¶
func (s *DefaultDropletService) Create(ctx context.Context, createRequest *godo.DropletCreateRequest) (*godo.Droplet, *godo.Response, error)
Create creates a new droplet
type DefaultKeyService ¶
type DefaultKeyService struct {
// contains filtered or unexported fields
}
DefaultKeyService adapts godo.KeyService to our KeyService interface
type DefaultStorageService ¶
type DefaultStorageService struct {
// contains filtered or unexported fields
}
DefaultStorageService adapts godo.StorageService to our StorageService interface
func (*DefaultStorageService) AttachVolume ¶
func (s *DefaultStorageService) AttachVolume(ctx context.Context, volumeID string, dropletID int) (*godo.Response, error)
AttachVolume attaches a block storage volume to a droplet and waits for completion. The operation is considered complete when the volume is successfully attached or when it fails after maximum retries.
func (*DefaultStorageService) CreateVolume ¶
func (s *DefaultStorageService) CreateVolume(ctx context.Context, request *godo.VolumeCreateRequest) (*godo.Volume, *godo.Response, error)
CreateVolume creates a new volume
func (*DefaultStorageService) DeleteVolume ¶
func (s *DefaultStorageService) DeleteVolume(ctx context.Context, id string) (*godo.Response, error)
DeleteVolume deletes a volume
func (*DefaultStorageService) DetachVolume ¶
func (s *DefaultStorageService) DetachVolume(ctx context.Context, volumeID string, dropletID int) (*godo.Response, error)
DetachVolume detaches a block storage volume from a droplet and waits for completion. The operation is considered complete when the volume is successfully detached or when it fails after maximum retries.
func (*DefaultStorageService) GetVolume ¶
func (s *DefaultStorageService) GetVolume(ctx context.Context, id string) (*godo.Volume, *godo.Response, error)
GetVolume gets a volume
func (*DefaultStorageService) GetVolumeAction ¶
func (s *DefaultStorageService) GetVolumeAction(ctx context.Context, volumeID string, actionID int) (*godo.Action, *godo.Response, error)
GetVolumeAction gets a volume action
func (*DefaultStorageService) ListVolumes ¶
func (s *DefaultStorageService) ListVolumes(ctx context.Context, opt *godo.ListVolumeParams) ([]godo.Volume, *godo.Response, error)
ListVolumes lists all volumes
type DigitalOceanProvider ¶
type DigitalOceanProvider struct {
// contains filtered or unexported fields
}
DigitalOceanProvider implements the ComputeProvider interface
func NewDigitalOceanProvider ¶
func NewDigitalOceanProvider() (*DigitalOceanProvider, error)
NewDigitalOceanProvider creates a new DigitalOcean provider instance
func (*DigitalOceanProvider) ConfigureProvider ¶
func (p *DigitalOceanProvider) ConfigureProvider(_ interface{}) error
ConfigureProvider is a no-op since we're not using Pulumi anymore
func (*DigitalOceanProvider) CreateInstance ¶
func (p *DigitalOceanProvider) CreateInstance( ctx context.Context, config *talisTypes.InstanceRequest, ) error
CreateInstance creates a new DigitalOcean droplet
func (*DigitalOceanProvider) DeleteInstance ¶
func (p *DigitalOceanProvider) DeleteInstance(ctx context.Context, dropletID int) error
DeleteInstance deletes a DigitalOcean droplet and its associated volumes
func (*DigitalOceanProvider) GetEnvironmentVars ¶
func (p *DigitalOceanProvider) GetEnvironmentVars() map[string]string
GetEnvironmentVars returns the environment variables needed for the provider
func (*DigitalOceanProvider) SetClient ¶
func (p *DigitalOceanProvider) SetClient(client computeTypes.DOClient)
SetClient sets the DO client for testing
func (*DigitalOceanProvider) ValidateCredentials ¶
func (p *DigitalOceanProvider) ValidateCredentials() error
ValidateCredentials validates the DigitalOcean credentials
type Provider ¶
type Provider interface { // ValidateCredentials validates the provider credentials ValidateCredentials() error // GetEnvironmentVars returns the environment variables needed for the provider GetEnvironmentVars() map[string]string // ConfigureProvider configures the provider with the given stack ConfigureProvider(stack interface{}) error // CreateInstance creates a new instance CreateInstance(ctx context.Context, req *types.InstanceRequest) error // DeleteInstance deletes an instance DeleteInstance(ctx context.Context, providerInstanceID int) error }
Provider defines the interface for cloud providers
func NewComputeProvider ¶
func NewComputeProvider(provider models.ProviderID) (Provider, error)
NewComputeProvider creates a new compute provider based on the provider name
type Provisioner ¶
type Provisioner interface { // ConfigureHost configures a single host ConfigureHost(ctx context.Context, host string, sshKeyPath string) error // ConfigureHosts configures multiple hosts in parallel, ensuring SSH readiness ConfigureHosts(ctx context.Context, hosts []string, sshKeyPath string) error // CreateInventory creates an Ansible inventory file from instance info CreateInventory(instance *types.InstanceRequest, sshKeyPath string) (string, error) // RunAnsiblePlaybook runs the Ansible playbook RunAnsiblePlaybook(inventoryName string) error }
Provisioner is the interface for system configuration
func NewProvisioner ¶
func NewProvisioner(jobID string) Provisioner
NewProvisioner creates a new system provisioner