instances

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstancesController

type InstancesController struct {
	MetalService *metal.MetalService
	// contains filtered or unexported fields
}

func New

func New(defaultExternalNetwork string) *InstancesController

New returns a new instance controller that satisfies the kubernetes cloud provider instances interface

func (*InstancesController) AddSSHKeyToAllInstances

func (i *InstancesController) AddSSHKeyToAllInstances(_ context.Context, user string, keyData []byte) error

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

func (*InstancesController) CurrentNodeName

func (i *InstancesController) CurrentNodeName(_ context.Context, nodeName 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 (*InstancesController) InstanceExists added in v0.5.11

func (i *InstancesController) InstanceExists(ctx context.Context, node *v1.Node) (bool, error)

InstanceExists returns true if the instance for the given node exists according to the cloud provider. Use the node.name or node.spec.providerID field to find the node in the cloud provider.

func (*InstancesController) InstanceExistsByProviderID

func (i *InstancesController) 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 machines that exist but are stopped/sleeping.

func (*InstancesController) InstanceID

func (i *InstancesController) 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 or is no longer running, we must return ("", cloudprovider.InstanceNotFound).

func (*InstancesController) InstanceMetadata added in v0.5.11

func (i *InstancesController) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error)

InstanceMetadata contains metadata about a specific instance. Values returned in InstanceMetadata are translated into specific fields and labels for Node.

ProviderID is a unique ID used to identify an instance on the cloud provider. The ProviderID set here will be set on the node's spec.providerID field. The provider ID format can be set by the cloud provider but providers should ensure the format does not change in any incompatible way.

The provider ID format used by existing cloud provider has been:

<provider-name>://<instance-id>

Existing providers setting this field should preserve the existing format currently being set in node.spec.providerID.

func (*InstancesController) InstanceShutdown added in v0.5.11

func (i *InstancesController) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error)

InstanceShutdown returns true if the instance is shutdown according to the cloud provider. Use the node.name or node.spec.providerID field to find the node in the cloud provider.

func (*InstancesController) InstanceShutdownByProviderID

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

InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider.

func (*InstancesController) InstanceType

func (i *InstancesController) InstanceType(ctx context.Context, nodeName types.NodeName) (string, error)

InstanceType returns the type of the specified instance.

func (*InstancesController) InstanceTypeByProviderID

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

InstanceTypeByProviderID returns the type of the specified instance.

func (*InstancesController) NodeAddresses

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

NodeAddresses returns the addresses of the specified instance.

func (*InstancesController) NodeAddressesByProviderID

func (i *InstancesController) 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 node addresses are being queried. m.e. local metadata services cannot be used in this method to obtain node addresses.

Jump to

Keyboard shortcuts

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