gce

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const GceLabelNameEtcdClusterPrefix = "k8s-io-etcd-"
View Source
const GceLabelNameKubernetesCluster = "k8s-io-cluster-name"

The tag name we use to differentiate multiple logically independent clusters running in the same region

View Source
const GceLabelNameRolePrefix = "k8s-io-role-"

Variables

This section is empty.

Functions

func DecodeGCELabel added in v1.10.0

func DecodeGCELabel(s string) (string, error)

DecodeGCELabel reverse EncodeGCELabel, taking the encoded RFC1035 compatible value back to a string

func DefaultProject added in v1.10.0

func DefaultProject() (string, error)

DefaultProject returns the current project configured in the gcloud SDK, ("", nil) if no project was set

func DeleteInstance added in v1.10.0

func DeleteInstance(c GCECloud, instanceSelfLink string) error

DeleteInstance deletes the specified instance (by URL) in GCE

func DeleteInstanceGroupManager added in v1.10.0

func DeleteInstanceGroupManager(c GCECloud, t *compute.InstanceGroupManager) error

DeleteInstanceGroupManager deletes the specified InstanceGroupManager in GCE

func DeleteInstanceTemplate added in v1.10.0

func DeleteInstanceTemplate(c GCECloud, selfLink string) error

DeleteInstanceTemplate deletes the specified InstanceTemplate (by URL) in GCE

func EncodeGCELabel added in v1.10.0

func EncodeGCELabel(s string) string

EncodeGCELabel encodes a string into an RFC1035 compatible value, suitable for use as GCE label key or value We use a URI inspired escaping, but with - instead of %.

func FindInstanceTemplates added in v1.10.0

func FindInstanceTemplates(c GCECloud, clusterName string) ([]*compute.InstanceTemplate, error)

FindInstanceTemplates finds all instance templates that are associated with the current cluster It matches them by looking for instance metadata with key='cluster-name' and value of our cluster name

func InstallMockGCECloud added in v1.10.0

func InstallMockGCECloud(region string, project string) *mockGCECloud

InstallMockGCECloud registers a mockGCECloud implementation for the specified region & project

func IsNotFound

func IsNotFound(err error) bool

func IsNotReady

func IsNotReady(err error) bool

func LastComponent added in v1.10.0

func LastComponent(s string) string

LastComponent returns the last component of a URL, i.e. anything after the last slash If there is no slash, returns the whole string

func LimitedLengthName added in v1.10.0

func LimitedLengthName(s string, n int) string

LimitedLengthName returns a string subject to a maximum length

func ListManagedInstances added in v1.10.0

func ListManagedInstances(c GCECloud, igm *compute.InstanceGroupManager) ([]*compute.ManagedInstance, error)

ListManagedInstances lists the specified InstanceGroupManagers in GCE

func NameForInstanceGroupManager added in v1.10.0

func NameForInstanceGroupManager(c *kops.Cluster, ig *kops.InstanceGroup, zone string) string

NameForInstanceGroupManager builds a name for an InstanceGroupManager in the specified zone

func SafeClusterName added in v1.10.0

func SafeClusterName(clusterName string) string

func SafeObjectName added in v1.10.0

func SafeObjectName(name string, clusterName string) string

SafeObjectName returns the object name and cluster name escaped for GCE

func WaitForOp added in v1.10.0

func WaitForOp(client *compute.Service, op *compute.Operation) error

func ZoneToRegion added in v1.10.0

func ZoneToRegion(zone string) (string, error)

ZoneToRegion maps a GCE zone name to a GCE region name, returning an error if it cannot be mapped

Types

type GCEAPITarget

type GCEAPITarget struct {
	Cloud GCECloud
}

func NewGCEAPITarget

func NewGCEAPITarget(cloud GCECloud) *GCEAPITarget

func (*GCEAPITarget) Finish

func (t *GCEAPITarget) Finish(taskMap map[string]fi.Task) error

func (*GCEAPITarget) ProcessDeletions added in v1.10.0

func (t *GCEAPITarget) ProcessDeletions() bool

type GCECloud

type GCECloud interface {
	fi.Cloud
	Compute() *compute.Service
	Storage() *storage.Service
	IAM() *iam.Service

	Region() string
	Project() string
	WaitForOp(op *compute.Operation) error
	GetApiIngressStatus(cluster *kops.Cluster) ([]kops.ApiIngressStatus, error)
	Labels() map[string]string

	// FindClusterStatus gets the status of the cluster as it exists in GCE, inferred from volumes
	FindClusterStatus(cluster *kops.Cluster) (*kops.ClusterStatus, error)

	Zones() ([]string, error)

	// ServiceAccount returns the email for the service account that the instances will run under
	ServiceAccount() (string, error)
}

func NewGCECloud

func NewGCECloud(region string, project string, labels map[string]string) (GCECloud, error)

type GoogleCloudURL

type GoogleCloudURL struct {
	Version string
	Project string
	Type    string
	Name    string
	Global  bool
	Region  string
	Zone    string
}

func ParseGoogleCloudURL

func ParseGoogleCloudURL(u string) (*GoogleCloudURL, error)

func (*GoogleCloudURL) BuildURL

func (u *GoogleCloudURL) BuildURL() string

Jump to

Keyboard shortcuts

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