ucloud

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2017 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ResourceTypeUHost = "uhost"

	InstanceStateInitializing = "Initializing"
	InstanceStateStarting     = "Starting"
	InstanceStateRunning      = "Running"
	InstanceStateStopping     = "Stopping"
	InstanceStateStopped      = "Stopped"
	InstanceStateFailed       = "Install Fail"
	InstanceStateRebooting    = "Rebooting"

	InstanceLoginModePassword = "Password"
	InstanceIPTypePrivate     = "Private"
	InstanceChargeTypeDynamic = "Dynamic"

	EIPStatusUsed = "used"
	EIPStatusFree = "free"

	EIPChargeTypeDynamic      = "Dynamic"
	EIPPayModeTraffic         = "Traffic"
	EIPPayModeBandwidth       = "Bandwidth"
	EIPPayModeSharedBandwidth = "SharedBandwidth"
	EIPOperatorBGP            = "Bgp"

	DefaultWaitTimeout = 2 * 60 // in seconds
)
View Source
const ProviderName = "ucloud"

Variables

View Source
var (
	ErrorNotFound     = fmt.Errorf("Instance is not found")
	CloudInitInterval = 5 * time.Second
	CloudInitTimeout  = 3 * time.Minute
	// UCloud doesn't allow tag keys starting with "aliyun"
	InitializedTagKey = "instance." + UCloudAnnotationPrefix + "initialized"
	SSHUsernameMap    = map[string]string{
		"ubuntu": "ubuntu",
		"centos": "root",
	}
	StateMap = map[string]cluster.InstancePhase{
		InstanceStateInitializing: cluster.InstancePending,
		InstanceStateStarting:     cluster.InstancePending,
		InstanceStateRunning:      cluster.InstanceRunning,
		InstanceStateStopping:     cluster.InstanceFailed,
		InstanceStateStopped:      cluster.InstanceFailed,
		InstanceStateFailed:       cluster.InstanceFailed,
		InstanceStateRebooting:    cluster.InstancePending,
	}
)
View Source
var NameKey = UCloudAnnotationPrefix + "name"

Node name as a tag on uhost instance

View Source
var UCloudAnnotationPrefix = "ucloud." + cluster.AnnotationPrefix

Used in k8s annotations and labels

Functions

This section is empty.

Types

type EIP

type EIP struct {
	ID string `k8s:"eip-id"`
}

type EIPOptions

type EIPOptions struct {
	OperatorName      string `k8s:"eip-operator-name"`
	Bandwidth         int    `k8s:"eip-bandwidth"`
	ChargeType        string `k8s:"eip-charge-type"`
	PayMode           string `k8s:"eip-pay-mode"`
	SharedBandwidthID string `k8s:"eip-shared-bandwidth-id"`
}

type LogWriter

type LogWriter struct {
}

func (*LogWriter) Write

func (lr *LogWriter) Write(p []byte) (int, error)

type UCloud

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

func (*UCloud) Archon

func (p *UCloud) Archon() (cloudprovider.ArchonInterface, bool)

func (*UCloud) Clusters

func (p *UCloud) Clusters() (cp.Clusters, bool)

func (*UCloud) EnsureInstance

func (p *UCloud) EnsureInstance(clusterName string, instance *cluster.Instance) (status *cluster.InstanceStatus, err error)

func (*UCloud) EnsureInstanceDeleted

func (p *UCloud) EnsureInstanceDeleted(clusterName string, instance *cluster.Instance) (err error)

func (*UCloud) EnsureNetwork

func (p *UCloud) EnsureNetwork(clusterName string, network *cluster.Network) (status *cluster.NetworkStatus, err error)

func (*UCloud) EnsureNetworkDeleted

func (p *UCloud) EnsureNetworkDeleted(clusterName string, network *cluster.Network) (err error)

func (*UCloud) EnsurePrivateIP

func (p *UCloud) EnsurePrivateIP(clusterName string, instance *cluster.Instance) (status *cluster.InstanceStatus, err error)

func (*UCloud) EnsurePrivateIPDeleted

func (p *UCloud) EnsurePrivateIPDeleted(clusterName string, instance *cluster.Instance) (err error)

func (*UCloud) EnsurePublicIP

func (p *UCloud) EnsurePublicIP(clusterName string, instance *cluster.Instance) (status *cluster.InstanceStatus, err error)

func (*UCloud) EnsurePublicIPDeleted

func (p *UCloud) EnsurePublicIPDeleted(clusterName string, instance *cluster.Instance) (err error)

func (*UCloud) GetInstance

func (p *UCloud) GetInstance(clusterName string, instance *cluster.Instance) (status *cluster.InstanceStatus, err error)

func (*UCloud) Initialize added in v0.4.0

func (p *UCloud) Initialize(clientBuilder controller.ControllerClientBuilder)

func (*UCloud) Instances

func (p *UCloud) Instances() (cp.Instances, bool)

func (*UCloud) ListInstances

func (p *UCloud) ListInstances(clusterName string, network *cluster.Network, selector map[string]string) (names []string, statuses []*cluster.InstanceStatus, err error)

func (*UCloud) LoadBalancer

func (p *UCloud) LoadBalancer() (cp.LoadBalancer, bool)

func (*UCloud) PrivateIP

func (p *UCloud) PrivateIP() (cloudprovider.PrivateIPInterface, bool)

func (*UCloud) ProviderName

func (p *UCloud) ProviderName() string

func (*UCloud) PublicIP

func (p *UCloud) PublicIP() (cloudprovider.PublicIPInterface, bool)

func (*UCloud) Routes

func (p *UCloud) Routes() (cp.Routes, bool)

func (*UCloud) ScrubDNS

func (p *UCloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)

func (*UCloud) Zones

func (p *UCloud) Zones() (cp.Zones, bool)

type UCloudInstanceInitialized

type UCloudInstanceInitialized struct {
	Initialized bool `k8s:"instance-initialized"`
}

type UCloudInstanceOptions

type UCloudInstanceOptions struct {
	CPU             int    `k8s:"cpu"`
	Memory          int    `k8s:"memory"`
	SystemDiskSize  int    `k8s:"system-disk-size"`
	StorageDiskSize int    `k8s:"storage-disk-size"`
	DiskType        string `k8s:"disk-type"`
	NetCapability   string `k8s:"net-capability"`
	UseSSH          bool   `k8s:"use-ssh"`
}

type UCloudInterface

type UCloudInterface interface {
	CreateInstance(*uhost.CreateUHostInstanceParams) (string, error)
	StopInstance(string, bool) error
	StartInstance(string) error
	DeleteInstance(string) error
	DescribeInstances(args *uhost.DescribeUHostInstanceParams) (instances []uhost.UHostSet, err error)
	DescribeInstanceAttribute(string) (*uhost.UHostSet, error)

	ReinstallInstance(string, string) error

	//AllocatePublicIpAddress(string) (string, error)
	AllocateEipAddress(*unet.AllocateEIPParams) (*unet.EIPSet, error)
	//WaitForEip(common.Region, string, uhost.EipStatus, int) error
	AssociateEipAddress(string, string) error
	DescribeEipAddress(string) (*unet.EIPSet, error)
	UnassociateEipAddress(string, string) error
	ReleaseEipAddress(string) error

	CreateSecurityGroup(*unet.CreateSecurityGroupParams) error
	DeleteSecurityGroup(int) error

	ModifyRemark(string, string) error
	WaitForInstance(id string, status string, timeout int) error
}

type UCloudNetwork

type UCloudNetwork struct {
	VPC           string `k8s:"vpc-id"`
	Subnet        string `k8s:"subnet-id"`
	SecurityGroup string `k8s:"security-group-id"`
}

Jump to

Keyboard shortcuts

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