clouddkcp

package
v0.0.0-...-a67cef2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderName specifies the name of the cloud controller manager defined in this file.
	ProviderName = "clouddk"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cloud

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

Cloud implements the interface cloudprovider.Interface.

func (Cloud) Clusters

func (c Cloud) Clusters() (cloudprovider.Clusters, bool)

Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.

func (Cloud) HasClusterID

func (c Cloud) HasClusterID() bool

HasClusterID returns true if a ClusterID is required and set.

func (Cloud) Initialize

func (c Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})

Initialize provides the cloud with a kubernetes client builder and may spawn goroutines to perform housekeeping or run custom controllers specific to the cloud provider. Any tasks started here should be cleaned up when the stop channel closes.

func (Cloud) Instances

func (c Cloud) Instances() (cloudprovider.Instances, bool)

Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.

func (Cloud) LoadBalancer

func (c Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.

func (Cloud) ProviderName

func (c Cloud) ProviderName() string

ProviderName returns the cloud provider ID.

func (Cloud) Routes

func (c Cloud) Routes() (cloudprovider.Routes, bool)

Routes returns a routes interface along with whether the interface is supported.

func (Cloud) Zones

func (c Cloud) Zones() (cloudprovider.Zones, bool)

Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.

type CloudConfiguration

type CloudConfiguration struct {
	ClientSettings *clouddk.ClientSettings
	PrivateKey     string
	PublicKey      string
}

CloudConfiguration stores the cloud configuration.

type CloudServer

type CloudServer struct {
	CloudConfiguration *CloudConfiguration
	Information        clouddk.ServerBody
}

CloudServer manages a Cloud.dk server.

func (*CloudServer) Create

func (s *CloudServer) Create(locationID string, packageID string, hostname string) error

Create creates a new Cloud.dk server.

func (*CloudServer) Destroy

func (s *CloudServer) Destroy() error

Destroy destroys a Cloud.dk server.

func (*CloudServer) GetRandomPassword

func (s *CloudServer) GetRandomPassword(length int) string

GetRandomPassword generates a random password of a fixed length.

func (*CloudServer) InitializeByHostname

func (s *CloudServer) InitializeByHostname(hostname string) (notFound bool, e error)

InitializeByHostname initializes a CloudServer based on a hostname.

func (*CloudServer) InitializeByID

func (s *CloudServer) InitializeByID(id string) (notFound bool, e error)

InitializeByID initializes a CloudServer based on an identifier.

func (*CloudServer) SFTP

func (s *CloudServer) SFTP(sshClient *ssh.Client) (*sftp.Client, error)

SFTP creates a new SFTP client for a Cloud.dk server.

func (*CloudServer) SSH

func (s *CloudServer) SSH() (*ssh.Client, error)

SSH establishes a new SSH connection to a Cloud.dk server.

func (*CloudServer) UploadFile

func (s *CloudServer) UploadFile(sftpClient *sftp.Client, filePath string, fileContents *bytes.Buffer) error

UploadFile uploads a file to the server.

type Instances

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

Instances implements the interface cloudprovider.Instances.

func (Instances) AddSSHKeyToAllInstances

func (i Instances) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error

AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances expected format for the key is standard ssh-keygen format: <protocol> <blob>.

func (Instances) CurrentNodeName

func (i Instances) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)

CurrentNodeName returns the name of the node we are currently running on. On most clouds (e.g. GCE) this is the hostname, so we provide the hostname.

func (Instances) InstanceExistsByProviderID

func (i Instances) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceExistsByProviderID returns true if the instance for the given provider exists. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager. This method should still return true for instances that exist but are stopped/sleeping.

func (Instances) InstanceID

func (i Instances) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)

InstanceID returns the cloud provider ID of the node with the specified NodeName. Note that if the instance does not exist, we must return ("", cloudprovider.InstanceNotFound). cloudprovider.InstanceNotFound should NOT be returned for instances that exist but are stopped/sleeping.

func (Instances) InstanceShutdownByProviderID

func (i Instances) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider.

func (Instances) InstanceType

func (i Instances) InstanceType(ctx context.Context, name types.NodeName) (string, error)

InstanceType returns the type of the specified instance.

func (Instances) InstanceTypeByProviderID

func (i Instances) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)

InstanceTypeByProviderID returns the type of the specified instance.

func (Instances) NodeAddresses

func (i Instances) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error)

NodeAddresses returns the addresses of the specified instance.

func (Instances) NodeAddressesByProviderID

func (i Instances) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)

NodeAddressesByProviderID returns the addresses of the specified instance. The instance is specified using the providerID of the node. The ProviderID is a unique identifier of the node. This will not be called from the node whose nodeaddresses are being queried. i.e. local metadata services cannot be used in this method to obtain nodeaddresses.

type LoadBalancers

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

LoadBalancers implements the interface cloudprovider.LoadBalancer.

func (LoadBalancers) EnsureLoadBalancer

func (l LoadBalancers) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)

EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer. Implementations must treat the *v1.Service and *v1.Node parameters as read-only and not modify them. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (LoadBalancers) EnsureLoadBalancerDeleted

func (l LoadBalancers) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error

EnsureLoadBalancerDeleted deletes the specified load balancer if it exists, returning nil if the load balancer specified either didn't exist or was successfully deleted. This construction is useful because many cloud providers' load balancers have multiple underlying components, meaning a Get could say that the LB doesn't exist even if some part of it is still laying around. Implementations must treat the *v1.Service parameter as read-only and not modify it. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.

func (LoadBalancers) GetLoadBalancer

func (l LoadBalancers) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)

GetLoadBalancer returns whether the specified load balancer exists, and if so, what its status is. Implementations must treat the *v1.Service parameter as read-only and not modify it. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (LoadBalancers) GetLoadBalancerName

func (l LoadBalancers) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string

GetLoadBalancerName returns the name of the load balancer. Implementations must treat the *v1.Service parameter as read-only and not modify it.

func (LoadBalancers) UpdateLoadBalancer

func (l LoadBalancers) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error

UpdateLoadBalancer updates hosts under the specified load balancer. Implementations must treat the *v1.Service and *v1.Node parameters as read-only and not modify them. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.

type Zones

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

Zones implements the interface cloudprovider.Zones.

func (Zones) GetZone

func (z Zones) GetZone(ctx context.Context) (cloudprovider.Zone, error)

GetZone returns the Zone containing the current failure zone and locality region that the program is running in. In most cases, this method is called from the kubelet querying a local metadata service to acquire its zone. For the case of external cloud providers, use GetZoneByProviderID or GetZoneByNodeName since GetZone can no longer be called from the kubelets.

func (Zones) GetZoneByNodeName

func (z Zones) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)

GetZoneByNodeName returns the Zone containing the current zone and locality region of the node specified by node name. This method is particularly used in the context of external cloud providers where node initialization must be done outside the kubelets.

func (Zones) GetZoneByProviderID

func (z Zones) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)

GetZoneByProviderID returns the Zone containing the current zone and locality region of the node specified by providerID. This method is particularly used in the context of external cloud providers where node initialization must be done outside the kubelets.

Jump to

Keyboard shortcuts

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