Documentation ¶
Index ¶
- func GetRegion(zoneName string) (string, error)
- func MapNodeNameToInstanceName(nodeName types.NodeName) string
- func ParseProviderID(providerID string) (folderID string, zone string, instanceName string, err error)
- type Cloud
- func (yc *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error
- func (yc *Cloud) Clusters() (cloudprovider.Clusters, bool)
- func (yc *Cloud) CurrentNodeName(ctx context.Context, hostName string) (types.NodeName, error)
- func (yc *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error)
- func (yc *Cloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)
- func (yc *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
- func (yc *Cloud) HasClusterID() bool
- func (yc *Cloud) Initialize(clientBuilder controller.ControllerClientBuilder)
- func (yc *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
- func (yc *Cloud) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)
- func (yc *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
- func (yc *Cloud) InstanceType(ctx context.Context, nodeName types.NodeName) (string, error)
- func (yc *Cloud) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
- func (yc *Cloud) Instances() (cloudprovider.Instances, bool)
- func (yc *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (yc *Cloud) NodeAddresses(ctx context.Context, nodeName types.NodeName) ([]v1.NodeAddress, error)
- func (yc *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
- func (yc *Cloud) ProviderName() string
- func (yc *Cloud) Routes() (cloudprovider.Routes, bool)
- func (yc *Cloud) Zones() (cloudprovider.Zones, bool)
- type CloudAPI
- type CloudAPIImpl
- type CloudConfig
- type MetadataService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapNodeNameToInstanceName ¶
MapNodeNameToInstanceName maps a k8s Node Name to a Yandex.Cloud Instance Name Currently - this is a simple string cast.
Types ¶
type Cloud ¶
type Cloud struct {
// contains filtered or unexported fields
}
Cloud is an implementation of cloudprovider.Interface for Yandex.Cloud
func NewCloud ¶
func NewCloud(config *CloudConfig, api CloudAPI) *Cloud
NewCloud creates a new instance of Cloud object
func (*Cloud) AddSSHKeyToAllInstances ¶
AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances.
func (*Cloud) Clusters ¶
func (yc *Cloud) Clusters() (cloudprovider.Clusters, bool)
Clusters returns a clusters interface if supported.
func (*Cloud) CurrentNodeName ¶
CurrentNodeName returns the name of the node we are currently running on
func (*Cloud) GetZone ¶
GetZone returns the Zone containing the current zone and locality region for the node we are currently running on.
func (*Cloud) GetZoneByNodeName ¶
func (yc *Cloud) 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.
func (*Cloud) GetZoneByProviderID ¶
func (yc *Cloud) 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
func (*Cloud) HasClusterID ¶
HasClusterID returns true if the cluster has a clusterID
func (*Cloud) Initialize ¶
func (yc *Cloud) Initialize(clientBuilder controller.ControllerClientBuilder)
Initialize passes a Kubernetes clientBuilder interface to the cloud provider
func (*Cloud) InstanceExistsByProviderID ¶
InstanceExistsByProviderID returns true if the instance with the given providerID still exists. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
func (*Cloud) InstanceID ¶
InstanceID returns the cloud provider ID of the node with the specified nodeName.
func (*Cloud) InstanceShutdownByProviderID ¶
InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes
func (*Cloud) InstanceType ¶
InstanceType returns the type of the node with the specified nodeName. Currently "" is always returned, since Yandex.Cloud API does not provide any information about instance type.
func (*Cloud) InstanceTypeByProviderID ¶
InstanceTypeByProviderID returns the type of the node with the specified unique providerD. Currently "" is always returned, since Yandex.Cloud API does not provide any information about instance type.
func (*Cloud) Instances ¶
func (yc *Cloud) Instances() (cloudprovider.Instances, bool)
Instances returns an instances interface if supported.
func (*Cloud) LoadBalancer ¶
func (yc *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
LoadBalancer returns a balancer interface if supported.
func (*Cloud) NodeAddresses ¶
func (yc *Cloud) NodeAddresses(ctx context.Context, nodeName types.NodeName) ([]v1.NodeAddress, error)
NodeAddresses returns the addresses of the node specified by node name.
func (*Cloud) NodeAddressesByProviderID ¶
func (yc *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
NodeAddressesByProviderID returns the addresses of the node specified by providerID
func (*Cloud) ProviderName ¶
ProviderName returns the cloud provider ID.
type CloudAPI ¶
type CloudAPI interface { // FindInstanceByFolderAndName searches for Instance with the specified folderID and instanceName. // If nothing found - no error must be returned. FindInstanceByFolderAndName(ctx context.Context, folderID string, instanceName string) (*compute.Instance, error) }
CloudAPI is an abstraction over Yandex.Cloud SDK, to allow mocking/unit testing
func NewCloudAPI ¶
func NewCloudAPI(config *CloudConfig) (CloudAPI, error)
NewCloudAPI creates new instance of CloudAPI object
type CloudAPIImpl ¶
type CloudAPIImpl struct {
// contains filtered or unexported fields
}
CloudAPIImpl is an implementation of CloudAPI
func (*CloudAPIImpl) FindInstanceByFolderAndName ¶
func (api *CloudAPIImpl) FindInstanceByFolderAndName(ctx context.Context, folderID string, instanceName string) (*compute.Instance, error)
FindInstanceByFolderAndName searches for Instance with the specified folderID and instanceName.
type CloudConfig ¶
type CloudConfig struct { FolderID string LocalZone string OAuthToken ycsdk.Credentials }
CloudConfig includes all the necessary configuration for creating Cloud object
func NewCloudConfig ¶
func NewCloudConfig() (*CloudConfig, error)
NewCloudConfig creates a new instance of CloudConfig object
type MetadataService ¶
type MetadataService struct {
// contains filtered or unexported fields
}
MetadataService knows how to query the Yandex.Cloud instance metadata server. See https://cloud.yandex.com/docs/compute/operations/vm-info/get-info#gce-metadata.
func NewMetadataService ¶
func NewMetadataService() *MetadataService
NewMetadataService creates an instance of the MetadataService object using default metadata URL.
func NewMetadataServiceWithURL ¶
func NewMetadataServiceWithURL(metadataURL string) *MetadataService
NewMetadataServiceWithURL creates an instance of the MetadataService object using specified metadata URL.
func (*MetadataService) Get ¶
func (m *MetadataService) Get(suffix string) (string, error)
Get returns a value from the instance metadata service. The suffix is appended to "${metadataURL}/computeMetadata/v1/".
func (*MetadataService) GetFolderID ¶
func (m *MetadataService) GetFolderID() (string, error)
GetFolderID returns the current VM's FolderID, such as "b1g4c2a3g6vkffp3qacq" Currently instance metadata service does not implement "project/project-id" element, so we using "instance/zone" to extract FolderID information
func (*MetadataService) GetZone ¶
func (m *MetadataService) GetZone() (string, error)
GetZone returns the current VM's Zone, such as "ru-central1-a".