gce

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Overview

Package gce is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.

Index

Constants

View Source
const (
	// alpha: v1.8 (for Services)
	//
	// Allows Services backed by a GCP load balancer to choose what network
	// tier to use. Currently supports "Standard" and "Premium" (default).
	AlphaFeatureNetworkTiers = "NetworkTiers"

	GCEDiskAlphaFeatureGate = "DiskAlphaAPI"
)
View Source
const (
	// ServiceAnnotationLoadBalancerType is annotated on a service with type LoadBalancer
	// dictates what specific kind of GCP LB should be assembled.
	// Currently, only "internal" is supported.
	ServiceAnnotationLoadBalancerType = "cloud.google.com/load-balancer-type"

	LBTypeInternal LoadBalancerType = "Internal"

	// ServiceAnnotationInternalBackendShare is annotated on a service with "true" when users
	// want to share GCP Backend Services for a set of internal load balancers.
	// ALPHA feature - this may be removed in a future release.
	ServiceAnnotationILBBackendShare = "alpha.cloud.google.com/load-balancer-backend-share"

	// NetworkTierAnnotationKey is annotated on a Service object to indicate which
	// network tier a GCP LB should use. The valid values are "Standard" and
	// "Premium" (default).
	NetworkTierAnnotationKey      = "cloud.google.com/network-tier"
	NetworkTierAnnotationStandard = "Standard"
	NetworkTierAnnotationPremium  = "Premium"

	NetworkTierStandard NetworkTier = NetworkTierAnnotationStandard
	NetworkTierPremium  NetworkTier = NetworkTierAnnotationPremium
	NetworkTierDefault  NetworkTier = NetworkTierPremium
)
View Source
const (
	// Key used to persist UIDs to configmaps.
	UIDConfigMapName = "ingress-uid"
	// Namespace which contains the above config map
	UIDNamespace = metav1.NamespaceSystem
	// Data keys for the specific ids
	UIDCluster     = "uid"
	UIDProvider    = "provider-uid"
	UIDLengthBytes = 8
)
View Source
const (
	DiskTypeSSD      = "pd-ssd"
	DiskTypeStandard = "pd-standard"
)
View Source
const (
	// KMSServiceName is the name of the cloudkms provider registered by this cloud.
	KMSServiceName = "gcp-cloudkms"
)
View Source
const (
	ProviderName = "gce"
)

Variables

This section is empty.

Functions

func FirewallToGCloudCreateCmd added in v1.8.0

func FirewallToGCloudCreateCmd(fw *compute.Firewall, projectID string) string

FirewallToGCloudCreateCmd generates a gcloud command to create a firewall with specified params

func FirewallToGCloudDeleteCmd added in v1.8.0

func FirewallToGCloudDeleteCmd(fwName, projectID string) string

FirewallToGCloudCreateCmd generates a gcloud command to delete a firewall to specified params

func FirewallToGCloudUpdateCmd added in v1.8.0

func FirewallToGCloudUpdateCmd(fw *compute.Firewall, projectID string) string

FirewallToGCloudCreateCmd generates a gcloud command to update a firewall to specified params

func GetGCERegion added in v1.2.0

func GetGCERegion(zone string) (string, error)

GetGCERegion returns region of the gce zone. Zone names are of the form: ${region-name}-${ix}. For example, "us-central1-b" has a region of "us-central1". So we look for the last '-' and trim to just before that.

func GetLoadBalancerAnnotationBackendShare added in v1.7.0

func GetLoadBalancerAnnotationBackendShare(service *v1.Service) bool

GetLoadBalancerAnnotationBackendShare returns whether this service's backend service should be shared with other load balancers. Health checks and the healthcheck firewall will be shared regardless.

func GetNodesHealthCheckPath added in v1.7.0

func GetNodesHealthCheckPath() string

GetNodesHealthCheckPath returns the health check path used by the GCE load balancers (l4) for performing health checks on nodes.

func GetNodesHealthCheckPort added in v1.7.0

func GetNodesHealthCheckPort() int32

GetNodesHealthCheckPort returns the health check port used by the GCE load balancers (l4) for performing health checks on nodes.

func LoadBalancerSrcRanges added in v1.7.0

func LoadBalancerSrcRanges() []string

LoadBalancerSrcRanges contains the ranges of ips used by the GCE load balancers (l4 & L7) for proxying client requests and performing health checks.

func MakeHealthCheckFirewallName added in v1.7.0

func MakeHealthCheckFirewallName(clusterID, hcName string, isNodesHealthCheck bool) string

MakeHealthCheckFirewallName returns the firewall name used by the GCE load balancers (l4) for performing health checks.

func NewAltTokenSource added in v1.3.0

func NewAltTokenSource(tokenURL, tokenBody string) oauth2.TokenSource

Types

type AlphaFeatureGate added in v1.8.0

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

func NewAlphaFeatureGate added in v1.8.0

func NewAlphaFeatureGate(features []string) (*AlphaFeatureGate, error)

func (*AlphaFeatureGate) Enabled added in v1.8.0

func (af *AlphaFeatureGate) Enabled(key string) bool

type AltTokenSource added in v1.3.0

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

func (*AltTokenSource) Token added in v1.3.0

func (a *AltTokenSource) Token() (*oauth2.Token, error)

type CloudAddressService added in v1.8.0

type CloudAddressService interface {
	ReserveRegionAddress(address *compute.Address, region string) error
	GetRegionAddress(name string, region string) (*compute.Address, error)
	GetRegionAddressByIP(region, ipAddress string) (*compute.Address, error)
	DeleteRegionAddress(name, region string) error

	// Alpha API.
	GetAlphaRegionAddress(name, region string) (*computealpha.Address, error)
	ReserveAlphaRegionAddress(addr *computealpha.Address, region string) error

	// Beta API
	ReserveBetaRegionAddress(address *computebeta.Address, region string) error
	GetBetaRegionAddress(name string, region string) (*computebeta.Address, error)
	GetBetaRegionAddressByIP(region, ipAddress string) (*computebeta.Address, error)
	// contains filtered or unexported methods
}

CloudAddressService is an interface for managing addresses

type CloudConfig added in v1.8.0

type CloudConfig struct {
	ApiEndpoint        string
	ProjectID          string
	NetworkProjectID   string
	Region             string
	Zone               string
	ManagedZones       []string
	NetworkName        string
	NetworkURL         string
	SubnetworkName     string
	SubnetworkURL      string
	SecondaryRangeName string
	NodeTags           []string
	NodeInstancePrefix string
	TokenSource        oauth2.TokenSource
	UseMetadataServer  bool
	AlphaFeatureGate   *AlphaFeatureGate
}

CloudConfig includes all the necessary configuration for creating GCECloud

type CloudForwardingRuleService added in v1.8.0

type CloudForwardingRuleService interface {
	GetRegionForwardingRule(name, region string) (*compute.ForwardingRule, error)
	CreateRegionForwardingRule(rule *compute.ForwardingRule, region string) error
	DeleteRegionForwardingRule(name, region string) error

	// Alpha API.
	GetAlphaRegionForwardingRule(name, region string) (*computealpha.ForwardingRule, error)
	CreateAlphaRegionForwardingRule(rule *computealpha.ForwardingRule, region string) error
	// contains filtered or unexported methods
}

CloudForwardingRuleService is an interface for managing forwarding rules. TODO: Expand the interface to include more methods.

type ClusterID added in v1.7.0

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

func (*ClusterID) GetFederationId added in v1.7.0

func (ci *ClusterID) GetFederationId() (string, bool, error)

GetFederationId returns the id which could represent the entire Federation or just the cluster if not federated.

func (*ClusterID) GetID added in v1.7.0

func (ci *ClusterID) GetID() (string, error)

GetID returns the id which is unique to this cluster if federated, return the provider id (unique to the cluster) if not federated, return the cluster id

type ConfigFile added in v1.8.0

type ConfigFile struct {
	Global ConfigGlobal `gcfg:"global"`
}

ConfigFile is the struct used to parse the /etc/gce.conf configuration file.

type ConfigGlobal added in v1.8.0

type ConfigGlobal struct {
	TokenURL  string `gcfg:"token-url"`
	TokenBody string `gcfg:"token-body"`
	// ProjectID and NetworkProjectID can either be the numeric or string-based
	// unique identifier that starts with [a-z].
	ProjectID string `gcfg:"project-id"`
	// NetworkProjectID refers to the project which owns the network being used.
	NetworkProjectID string `gcfg:"network-project-id"`
	NetworkName      string `gcfg:"network-name"`
	SubnetworkName   string `gcfg:"subnetwork-name"`
	// SecondaryRangeName is the name of the secondary range to allocate IP
	// aliases. The secondary range must be present on the subnetwork the
	// cluster is attached to.
	SecondaryRangeName string   `gcfg:"secondary-range-name"`
	NodeTags           []string `gcfg:"node-tags"`
	NodeInstancePrefix string   `gcfg:"node-instance-prefix"`
	Multizone          bool     `gcfg:"multizone"`
	// ApiEndpoint is the GCE compute API endpoint to use. If this is blank,
	// then the default endpoint is used.
	ApiEndpoint string `gcfg:"api-endpoint"`
	// LocalZone specifies the GCE zone that gce cloud client instance is
	// located in (i.e. where the controller will be running). If this is
	// blank, then the local zone will be discovered via the metadata server.
	LocalZone string `gcfg:"local-zone"`
	// Possible values: List of api names separated by comma. Default to none.
	// For example: MyFeatureFlag
	AlphaFeatures []string `gcfg:"alpha-features"`
}

type DiskType added in v1.4.0

type DiskType string

type Disks added in v1.3.0

type Disks interface {
	// AttachDisk attaches given disk to the node with the specified NodeName.
	// Current instance is used when instanceID is empty string.
	AttachDisk(diskName string, nodeName types.NodeName, readOnly bool) error

	// DetachDisk detaches given disk to the node with the specified NodeName.
	// Current instance is used when nodeName is empty string.
	DetachDisk(devicePath string, nodeName types.NodeName) error

	// DiskIsAttached checks if a disk is attached to the node with the specified NodeName.
	DiskIsAttached(diskName string, nodeName types.NodeName) (bool, error)

	// DisksAreAttached is a batch function to check if a list of disks are attached
	// to the node with the specified NodeName.
	DisksAreAttached(diskNames []string, nodeName types.NodeName) (map[string]bool, error)

	// CreateDisk creates a new PD with given properties. Tags are serialized
	// as JSON into Description field.
	CreateDisk(name string, diskType string, zone string, sizeGb int64, tags map[string]string) error

	// CreateRegionalDisk creates a new Regional Persistent Disk, with the
	// specified properties, replicated to the specified zones. Tags are
	// serialized as JSON into Description field.
	CreateRegionalDisk(name string, diskType string, replicaZones sets.String, sizeGb int64, tags map[string]string) error

	// DeleteDisk deletes PD.
	DeleteDisk(diskToDelete string) error

	// GetAutoLabelsForPD returns labels to apply to PersistentVolume
	// representing this PD, namely failure domain and zone.
	// zone can be provided to specify the zone for the PD,
	// if empty all managed zones will be searched.
	GetAutoLabelsForPD(name string, zone string) (map[string]string, error)
}

Disks is interface for manipulation with GCE PDs.

type FakeCloudAddressService added in v1.8.0

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

func NewFakeCloudAddressService added in v1.8.0

func NewFakeCloudAddressService() *FakeCloudAddressService

func (*FakeCloudAddressService) DeleteRegionAddress added in v1.8.0

func (cas *FakeCloudAddressService) DeleteRegionAddress(name, region string) error

func (*FakeCloudAddressService) GetAlphaRegionAddress added in v1.8.0

func (cas *FakeCloudAddressService) GetAlphaRegionAddress(name, region string) (*computealpha.Address, error)

func (*FakeCloudAddressService) GetAlphaRegionAddressByIP added in v1.8.0

func (cas *FakeCloudAddressService) GetAlphaRegionAddressByIP(region, ipAddress string) (*computealpha.Address, error)

func (*FakeCloudAddressService) GetBetaRegionAddress added in v1.8.0

func (cas *FakeCloudAddressService) GetBetaRegionAddress(name, region string) (*computebeta.Address, error)

func (*FakeCloudAddressService) GetBetaRegionAddressByIP added in v1.8.0

func (cas *FakeCloudAddressService) GetBetaRegionAddressByIP(name, region string) (*computebeta.Address, error)

func (*FakeCloudAddressService) GetRegionAddress added in v1.8.0

func (cas *FakeCloudAddressService) GetRegionAddress(name, region string) (*compute.Address, error)

func (*FakeCloudAddressService) GetRegionAddressByIP added in v1.8.0

func (cas *FakeCloudAddressService) GetRegionAddressByIP(name, region string) (*compute.Address, error)

func (*FakeCloudAddressService) ReserveAlphaRegionAddress added in v1.8.0

func (cas *FakeCloudAddressService) ReserveAlphaRegionAddress(addr *computealpha.Address, region string) error

func (*FakeCloudAddressService) ReserveBetaRegionAddress added in v1.8.0

func (cas *FakeCloudAddressService) ReserveBetaRegionAddress(addr *computebeta.Address, region string) error

func (*FakeCloudAddressService) ReserveRegionAddress added in v1.8.0

func (cas *FakeCloudAddressService) ReserveRegionAddress(addr *compute.Address, region string) error

func (*FakeCloudAddressService) SetRegionalAddresses added in v1.8.0

func (cas *FakeCloudAddressService) SetRegionalAddresses(region string, addrs []*computealpha.Address)

SetRegionalAddresses sets the addresses of ther region. This is used for setting the test environment.

func (*FakeCloudAddressService) String added in v1.8.0

func (cas *FakeCloudAddressService) String() string

type FakeCloudForwardingRuleService added in v1.8.0

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

func NewFakeCloudForwardingRuleService added in v1.8.0

func NewFakeCloudForwardingRuleService() *FakeCloudForwardingRuleService

func (*FakeCloudForwardingRuleService) CreateAlphaRegionForwardingRule added in v1.8.0

func (f *FakeCloudForwardingRuleService) CreateAlphaRegionForwardingRule(fwdRule *computealpha.ForwardingRule, region string) error

func (*FakeCloudForwardingRuleService) CreateRegionForwardingRule added in v1.8.0

func (f *FakeCloudForwardingRuleService) CreateRegionForwardingRule(fwdRule *compute.ForwardingRule, region string) error

func (*FakeCloudForwardingRuleService) DeleteRegionForwardingRule added in v1.8.0

func (f *FakeCloudForwardingRuleService) DeleteRegionForwardingRule(name, region string) error

func (*FakeCloudForwardingRuleService) GetAlphaRegionForwardingRule added in v1.8.0

func (f *FakeCloudForwardingRuleService) GetAlphaRegionForwardingRule(name, region string) (*computealpha.ForwardingRule, error)

func (*FakeCloudForwardingRuleService) GetRegionForwardingRule added in v1.8.0

func (f *FakeCloudForwardingRuleService) GetRegionForwardingRule(name, region string) (*compute.ForwardingRule, error)

func (*FakeCloudForwardingRuleService) SetRegionalForwardingRulees added in v1.8.0

func (f *FakeCloudForwardingRuleService) SetRegionalForwardingRulees(region string, fwdRules []*computealpha.ForwardingRule)

SetRegionalForwardingRulees sets the fwdRuleesses of ther region. This is used for setting the test environment.

type GCECloud

type GCECloud struct {
	// ClusterID contains functionality for getting (and initializing) the ingress-uid. Call GCECloud.Initialize()
	// for the cloudprovider to start watching the configmap.
	ClusterID ClusterID

	// AlphaFeatureGate gates gce alpha features in GCECloud instance.
	// Related wrapper functions that interacts with gce alpha api should examine whether
	// the corresponding api is enabled.
	// If not enabled, it should return error.
	AlphaFeatureGate *AlphaFeatureGate
	// contains filtered or unexported fields
}

GCECloud is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.

func CreateGCECloud added in v1.2.0

func CreateGCECloud(config *CloudConfig) (*GCECloud, error)

CreateGCECloud creates a GCECloud object using the specified parameters. If no networkUrl is specified, loads networkName via rest call. If no tokenSource is specified, uses oauth2.DefaultTokenSource. If managedZones is nil / empty all zones in the region will be managed.

func (*GCECloud) AddAliasToInstance added in v1.8.0

func (gce *GCECloud) AddAliasToInstance(nodeName types.NodeName, alias *net.IPNet) error

AddAliasToInstance adds an alias to the given instance from the named secondary range.

func (*GCECloud) AddInstancesToInstanceGroup

func (gce *GCECloud) AddInstancesToInstanceGroup(name string, zone string, instanceRefs []*compute.InstanceReference) error

AddInstancesToInstanceGroup adds the given instances to the given instance group.

func (*GCECloud) AddInstancesToTargetPool added in v1.7.0

func (gce *GCECloud) AddInstancesToTargetPool(name, region string, instanceRefs []*compute.InstanceReference) error

AddInstancesToTargetPool adds instances by link to the TargetPool

func (*GCECloud) AddSSHKeyToAllInstances

func (gce *GCECloud) AddSSHKeyToAllInstances(user string, keyData []byte) error

func (*GCECloud) AliasRanges added in v1.7.0

func (gce *GCECloud) AliasRanges(nodeName types.NodeName) (cidrs []string, err error)

AliasRanges returns a list of CIDR ranges that are assigned to the `node` for allocation to pods. Returns a list of the form "<ip>/<netmask>".

func (*GCECloud) AttachDisk

func (gce *GCECloud) AttachDisk(diskName string, nodeName types.NodeName, readOnly bool) error

func (*GCECloud) Clusters

func (gce *GCECloud) Clusters() (cloudprovider.Clusters, bool)

func (*GCECloud) CreateAlphaRegionForwardingRule added in v1.8.0

func (gce *GCECloud) CreateAlphaRegionForwardingRule(rule *computealpha.ForwardingRule, region string) error

CreateAlphaRegionForwardingRule creates and returns an Alpha forwarding fule in the given region.

func (*GCECloud) CreateDisk added in v1.2.0

func (gce *GCECloud) CreateDisk(
	name string, diskType string, zone string, sizeGb int64, tags map[string]string) error

CreateDisk creates a new Persistent Disk, with the specified name & size, in the specified zone. It stores specified tags encoded in JSON in Description field.

func (*GCECloud) CreateFirewall added in v1.2.0

func (gce *GCECloud) CreateFirewall(f *compute.Firewall) error

CreateFirewall creates the passed firewall

func (*GCECloud) CreateGlobalBackendService added in v1.7.0

func (gce *GCECloud) CreateGlobalBackendService(bg *compute.BackendService) error

CreateGlobalBackendService creates the given BackendService.

func (*GCECloud) CreateGlobalForwardingRule

func (gce *GCECloud) CreateGlobalForwardingRule(rule *compute.ForwardingRule) error

CreateGlobalForwardingRule creates the passed GlobalForwardingRule

func (*GCECloud) CreateHealthCheck added in v1.7.0

func (gce *GCECloud) CreateHealthCheck(hc *compute.HealthCheck) error

CreateHealthCheck creates the given HealthCheck.

func (*GCECloud) CreateHttpHealthCheck added in v1.2.0

func (gce *GCECloud) CreateHttpHealthCheck(hc *compute.HttpHealthCheck) error

CreateHttpHealthCheck creates the given HttpHealthCheck.

func (*GCECloud) CreateHttpsHealthCheck added in v1.7.0

func (gce *GCECloud) CreateHttpsHealthCheck(hc *compute.HttpsHealthCheck) error

CreateHttpsHealthCheck creates the given HttpsHealthCheck.

func (*GCECloud) CreateInstanceGroup

func (gce *GCECloud) CreateInstanceGroup(ig *compute.InstanceGroup, zone string) error

CreateInstanceGroup creates an instance group with the given instances. It is the callers responsibility to add named ports.

func (*GCECloud) CreateRegionBackendService added in v1.7.0

func (gce *GCECloud) CreateRegionBackendService(bg *compute.BackendService, region string) error

CreateRegionBackendService creates the given BackendService.

func (*GCECloud) CreateRegionForwardingRule added in v1.7.0

func (gce *GCECloud) CreateRegionForwardingRule(rule *compute.ForwardingRule, region string) error

CreateRegionForwardingRule creates and returns a RegionalForwardingRule that points to the given BackendService

func (*GCECloud) CreateRegionalDisk added in v1.8.0

func (gce *GCECloud) CreateRegionalDisk(
	name string, diskType string, replicaZones sets.String, sizeGb int64, tags map[string]string) error

CreateRegionalDisk creates a new Regional Persistent Disk, with the specified name & size, replicated to the specified zones. It stores specified tags encoded in JSON in Description field.

func (*GCECloud) CreateRoute

func (gce *GCECloud) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error

func (*GCECloud) CreateSslCertificate added in v1.2.0

func (gce *GCECloud) CreateSslCertificate(sslCerts *compute.SslCertificate) (*compute.SslCertificate, error)

CreateSslCertificate creates and returns a SslCertificate.

func (*GCECloud) CreateTargetHttpProxy

func (gce *GCECloud) CreateTargetHttpProxy(proxy *compute.TargetHttpProxy) error

CreateTargetHttpProxy creates a TargetHttpProxy

func (*GCECloud) CreateTargetHttpsProxy added in v1.2.0

func (gce *GCECloud) CreateTargetHttpsProxy(proxy *compute.TargetHttpsProxy) error

CreateTargetHttpsProxy creates a TargetHttpsProxy

func (*GCECloud) CreateTargetPool added in v1.7.0

func (gce *GCECloud) CreateTargetPool(tp *compute.TargetPool, region string) error

CreateTargetPool creates the passed TargetPool

func (*GCECloud) CreateUrlMap

func (gce *GCECloud) CreateUrlMap(urlMap *compute.UrlMap) error

CreateUrlMap creates a url map

func (*GCECloud) CurrentNodeName

func (gce *GCECloud) CurrentNodeName(hostname string) (types.NodeName, error)

Implementation of Instances.CurrentNodeName

func (*GCECloud) DeleteDisk added in v1.2.0

func (gce *GCECloud) DeleteDisk(diskToDelete string) error

func (*GCECloud) DeleteExternalTargetPoolAndChecks added in v1.7.0

func (gce *GCECloud) DeleteExternalTargetPoolAndChecks(service *v1.Service, name, region, clusterID string, hcNames ...string) error

func (*GCECloud) DeleteFirewall added in v1.2.0

func (gce *GCECloud) DeleteFirewall(name string) error

DeleteFirewall deletes the given firewall rule.

func (*GCECloud) DeleteGlobalAddress added in v1.7.0

func (gce *GCECloud) DeleteGlobalAddress(name string) error

DeleteGlobalAddress deletes a global address by name.

func (*GCECloud) DeleteGlobalBackendService added in v1.7.0

func (gce *GCECloud) DeleteGlobalBackendService(name string) error

DeleteGlobalBackendService deletes the given BackendService by name.

func (*GCECloud) DeleteGlobalForwardingRule

func (gce *GCECloud) DeleteGlobalForwardingRule(name string) error

DeleteGlobalForwardingRule deletes the GlobalForwardingRule by name.

func (*GCECloud) DeleteHealthCheck added in v1.7.0

func (gce *GCECloud) DeleteHealthCheck(name string) error

DeleteHealthCheck deletes the given HealthCheck by name.

func (*GCECloud) DeleteHttpHealthCheck added in v1.2.0

func (gce *GCECloud) DeleteHttpHealthCheck(name string) error

DeleteHttpHealthCheck deletes the given HttpHealthCheck by name.

func (*GCECloud) DeleteHttpsHealthCheck added in v1.7.0

func (gce *GCECloud) DeleteHttpsHealthCheck(name string) error

DeleteHttpsHealthCheck deletes the given HttpsHealthCheck by name.

func (*GCECloud) DeleteInstanceGroup

func (gce *GCECloud) DeleteInstanceGroup(name string, zone string) error

DeleteInstanceGroup deletes an instance group.

func (*GCECloud) DeleteRegionAddress added in v1.7.0

func (gce *GCECloud) DeleteRegionAddress(name, region string) error

DeleteRegionAddress deletes a region address by name.

func (*GCECloud) DeleteRegionBackendService added in v1.7.0

func (gce *GCECloud) DeleteRegionBackendService(name, region string) error

DeleteRegionBackendService deletes the given BackendService by name.

func (*GCECloud) DeleteRegionForwardingRule added in v1.7.0

func (gce *GCECloud) DeleteRegionForwardingRule(name, region string) error

DeleteRegionForwardingRule deletes the RegionalForwardingRule by name & region.

func (*GCECloud) DeleteRoute

func (gce *GCECloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error

func (*GCECloud) DeleteSslCertificate added in v1.2.0

func (gce *GCECloud) DeleteSslCertificate(name string) error

DeleteSslCertificate deletes the SslCertificate by name.

func (*GCECloud) DeleteTargetHttpProxy

func (gce *GCECloud) DeleteTargetHttpProxy(name string) error

DeleteTargetHttpProxy deletes the TargetHttpProxy by name.

func (*GCECloud) DeleteTargetHttpsProxy added in v1.2.0

func (gce *GCECloud) DeleteTargetHttpsProxy(name string) error

DeleteTargetHttpsProxy deletes the TargetHttpsProxy by name.

func (*GCECloud) DeleteTargetPool added in v1.5.0

func (gce *GCECloud) DeleteTargetPool(name, region string) error

DeleteTargetPool deletes TargetPool by name.

func (*GCECloud) DeleteUrlMap

func (gce *GCECloud) DeleteUrlMap(name string) error

DeleteUrlMap deletes a url map by name.

func (*GCECloud) DetachDisk

func (gce *GCECloud) DetachDisk(devicePath string, nodeName types.NodeName) error

func (*GCECloud) DiskIsAttached added in v1.2.0

func (gce *GCECloud) DiskIsAttached(diskName string, nodeName types.NodeName) (bool, error)

func (*GCECloud) DisksAreAttached added in v1.4.6

func (gce *GCECloud) DisksAreAttached(diskNames []string, nodeName types.NodeName) (map[string]bool, error)

func (*GCECloud) EnsureLoadBalancer added in v1.2.0

func (gce *GCECloud) EnsureLoadBalancer(clusterName string, svc *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)

EnsureLoadBalancer is an implementation of LoadBalancer.EnsureLoadBalancer.

func (*GCECloud) EnsureLoadBalancerDeleted added in v1.2.0

func (gce *GCECloud) EnsureLoadBalancerDeleted(clusterName string, svc *v1.Service) error

EnsureLoadBalancerDeleted is an implementation of LoadBalancer.EnsureLoadBalancerDeleted.

func (*GCECloud) ExternalID

func (gce *GCECloud) ExternalID(nodeName types.NodeName) (string, error)

ExternalID returns the cloud provider ID of the node with the specified NodeName (deprecated).

func (*GCECloud) GetAllZones added in v1.3.0

func (gce *GCECloud) GetAllZones() (sets.String, error)

GetAllZones returns all the zones in which nodes are running

func (*GCECloud) GetAlphaRegionAddress added in v1.8.0

func (gce *GCECloud) GetAlphaRegionAddress(name, region string) (*computealpha.Address, error)

GetAlphaRegionAddress returns the Alpha, regional address by name.

func (*GCECloud) GetAlphaRegionForwardingRule added in v1.8.0

func (gce *GCECloud) GetAlphaRegionForwardingRule(name, region string) (*computealpha.ForwardingRule, error)

GetAlphaRegionForwardingRule returns the Alpha forwarding rule by name & region.

func (*GCECloud) GetAutoLabelsForPD added in v1.2.0

func (gce *GCECloud) GetAutoLabelsForPD(name string, zone string) (map[string]string, error)

Builds the labels that should be automatically added to a PersistentVolume backed by a GCE PD Specifically, this builds FailureDomain (zone) and Region labels. The PersistentVolumeLabel admission controller calls this and adds the labels when a PV is created. If zone is specified, the volume will only be found in the specified zone, otherwise all managed zones will be searched.

func (*GCECloud) GetBetaRegionAddress added in v1.8.0

func (gce *GCECloud) GetBetaRegionAddress(name, region string) (*computebeta.Address, error)

GetBetaRegionAddress returns the beta region address by name

func (*GCECloud) GetBetaRegionAddressByIP added in v1.8.0

func (gce *GCECloud) GetBetaRegionAddressByIP(region, ipAddress string) (*computebeta.Address, error)

GetBetaRegionAddressByIP returns the beta regional address matching the given IP address.

func (*GCECloud) GetComputeService added in v1.2.0

func (g *GCECloud) GetComputeService() *compute.Service

Raw access to the underlying GCE service, probably should only be used for e2e tests

func (*GCECloud) GetDiskByNameUnknownZone added in v1.7.0

func (gce *GCECloud) GetDiskByNameUnknownZone(diskName string) (*GCEDisk, error)

Scans all managed zones to return the GCE PD Prefer getDiskByName, if the zone can be established Return cloudprovider.DiskNotFound if the given disk cannot be found in any zone

func (*GCECloud) GetFirewall added in v1.2.0

func (gce *GCECloud) GetFirewall(name string) (*compute.Firewall, error)

GetFirewall returns the Firewall by name.

func (*GCECloud) GetGlobalAddress added in v1.7.0

func (gce *GCECloud) GetGlobalAddress(name string) (*compute.Address, error)

GetGlobalAddress returns the global address by name.

func (*GCECloud) GetGlobalBackendService added in v1.7.0

func (gce *GCECloud) GetGlobalBackendService(name string) (*compute.BackendService, error)

GetGlobalBackendService retrieves a backend by name.

func (*GCECloud) GetGlobalBackendServiceHealth added in v1.7.0

func (gce *GCECloud) GetGlobalBackendServiceHealth(name string, instanceGroupLink string) (*compute.BackendServiceGroupHealth, error)

GetGlobalBackendServiceHealth returns the health of the BackendService identified by the given name, in the given instanceGroup. The instanceGroupLink is the fully qualified self link of an instance group.

func (*GCECloud) GetGlobalForwardingRule

func (gce *GCECloud) GetGlobalForwardingRule(name string) (*compute.ForwardingRule, error)

GetGlobalForwardingRule returns the GlobalForwardingRule by name.

func (*GCECloud) GetHealthCheck added in v1.7.0

func (gce *GCECloud) GetHealthCheck(name string) (*compute.HealthCheck, error)

GetHealthCheck returns the given HealthCheck by name.

func (*GCECloud) GetHttpHealthCheck

func (gce *GCECloud) GetHttpHealthCheck(name string) (*compute.HttpHealthCheck, error)

GetHttpHealthCheck returns the given HttpHealthCheck by name.

func (*GCECloud) GetHttpsHealthCheck added in v1.7.0

func (gce *GCECloud) GetHttpsHealthCheck(name string) (*compute.HttpsHealthCheck, error)

GetHttpsHealthCheck returns the given HttpsHealthCheck by name.

func (*GCECloud) GetInstanceGroup

func (gce *GCECloud) GetInstanceGroup(name string, zone string) (*compute.InstanceGroup, error)

GetInstanceGroup returns an instance group by name.

func (*GCECloud) GetKMSService added in v1.8.0

func (g *GCECloud) GetKMSService() *cloudkms.Service

Raw access to the cloudkmsService of GCE cloud. Required for encryption of etcd using Google KMS.

func (*GCECloud) GetLabelsForVolume added in v1.8.0

func (gce *GCECloud) GetLabelsForVolume(pv *v1.PersistentVolume) (map[string]string, error)

func (*GCECloud) GetLoadBalancer added in v1.2.0

func (gce *GCECloud) GetLoadBalancer(clusterName string, svc *v1.Service) (*v1.LoadBalancerStatus, bool, error)

GetLoadBalancer is an implementation of LoadBalancer.GetLoadBalancer

func (*GCECloud) GetNodeTags added in v1.7.0

func (gce *GCECloud) GetNodeTags(nodeNames []string) ([]string, error)

GetNodeTags will first try returning the list of tags specified in GCE cloud Configuration. If they weren't provided, it'll compute the host tags with the given hostnames. If the list of hostnames has not changed, a cached set of nodetags are returned.

func (*GCECloud) GetRegionAddress added in v1.7.0

func (gce *GCECloud) GetRegionAddress(name, region string) (*compute.Address, error)

GetRegionAddress returns the region address by name

func (*GCECloud) GetRegionAddressByIP added in v1.8.0

func (gce *GCECloud) GetRegionAddressByIP(region, ipAddress string) (*compute.Address, error)

GetRegionAddressByIP returns the regional address matching the given IP address.

func (*GCECloud) GetRegionBackendService added in v1.7.0

func (gce *GCECloud) GetRegionBackendService(name, region string) (*compute.BackendService, error)

GetRegionBackendService retrieves a backend by name.

func (*GCECloud) GetRegionForwardingRule added in v1.7.0

func (gce *GCECloud) GetRegionForwardingRule(name, region string) (*compute.ForwardingRule, error)

GetRegionForwardingRule returns the RegionalForwardingRule by name & region.

func (*GCECloud) GetRegionalBackendServiceHealth added in v1.7.0

func (gce *GCECloud) GetRegionalBackendServiceHealth(name, region string, instanceGroupLink string) (*compute.BackendServiceGroupHealth, error)

GetRegionalBackendServiceHealth returns the health of the BackendService identified by the given name, in the given instanceGroup. The instanceGroupLink is the fully qualified self link of an instance group.

func (*GCECloud) GetSslCertificate added in v1.2.0

func (gce *GCECloud) GetSslCertificate(name string) (*compute.SslCertificate, error)

GetSslCertificate returns the SslCertificate by name.

func (*GCECloud) GetTargetHttpProxy

func (gce *GCECloud) GetTargetHttpProxy(name string) (*compute.TargetHttpProxy, error)

GetTargetHttpProxy returns the UrlMap by name.

func (*GCECloud) GetTargetHttpsProxy added in v1.2.0

func (gce *GCECloud) GetTargetHttpsProxy(name string) (*compute.TargetHttpsProxy, error)

GetTargetHttpsProxy returns the UrlMap by name.

func (*GCECloud) GetTargetPool added in v1.7.0

func (gce *GCECloud) GetTargetPool(name, region string) (*compute.TargetPool, error)

GetTargetPool returns the TargetPool by name.

func (*GCECloud) GetUrlMap

func (gce *GCECloud) GetUrlMap(name string) (*compute.UrlMap, error)

GetUrlMap returns the UrlMap by name.

func (*GCECloud) GetZone

func (gce *GCECloud) GetZone() (cloudprovider.Zone, error)

GetZone creates a cloudprovider.Zone of the current zone and region

func (*GCECloud) GetZoneByNodeName added in v1.8.0

func (gce *GCECloud) GetZoneByNodeName(nodeName types.NodeName) (cloudprovider.Zone, error)

GetZoneByNodeName implements Zones.GetZoneByNodeName This is particularly useful in external cloud providers where the kubelet does not initialize node data.

func (*GCECloud) GetZoneByProviderID added in v1.8.0

func (gce *GCECloud) GetZoneByProviderID(providerID string) (cloudprovider.Zone, error)

GetZoneByProviderID implements Zones.GetZoneByProviderID This is particularly useful in external cloud providers where the kubelet does not initialize node data.

func (*GCECloud) HasClusterID added in v1.8.0

func (gce *GCECloud) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*GCECloud) Initialize added in v1.7.0

func (gce *GCECloud) Initialize(clientBuilder controller.ControllerClientBuilder)

Initialize takes in a clientBuilder and spawns a goroutine for watching the clusterid configmap. This must be called before utilizing the funcs of gce.ClusterID

func (*GCECloud) InstanceExistsByProviderID added in v1.8.0

func (gce *GCECloud) InstanceExistsByProviderID(providerID string) (bool, error)

InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.

func (*GCECloud) InstanceID

func (gce *GCECloud) InstanceID(nodeName types.NodeName) (string, error)

InstanceID returns the cloud provider ID of the node with the specified NodeName.

func (*GCECloud) InstanceType added in v1.2.0

func (gce *GCECloud) InstanceType(nodeName types.NodeName) (string, error)

InstanceType returns the type of the specified node with the specified NodeName.

func (*GCECloud) InstanceTypeByProviderID added in v1.7.0

func (gce *GCECloud) InstanceTypeByProviderID(providerID string) (string, error)

InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here

func (*GCECloud) Instances

func (gce *GCECloud) Instances() (cloudprovider.Instances, bool)

Instances returns an implementation of Instances for Google Compute Engine.

func (*GCECloud) ListAlphaRegionForwardingRules added in v1.8.0

func (gce *GCECloud) ListAlphaRegionForwardingRules(region string) (*computealpha.ForwardingRuleList, error)

ListRegionForwardingRules lists all RegionalForwardingRules in the project & region.

func (*GCECloud) ListClusters

func (gce *GCECloud) ListClusters() ([]string, error)

func (*GCECloud) ListGlobalBackendServices added in v1.7.0

func (gce *GCECloud) ListGlobalBackendServices() (*compute.BackendServiceList, error)

ListGlobalBackendServices lists all backend services in the project.

func (*GCECloud) ListGlobalForwardingRules added in v1.2.0

func (gce *GCECloud) ListGlobalForwardingRules() (*compute.ForwardingRuleList, error)

ListGlobalForwardingRules lists all GlobalForwardingRules in the project.

func (*GCECloud) ListHealthChecks added in v1.7.0

func (gce *GCECloud) ListHealthChecks() (*compute.HealthCheckList, error)

ListHealthChecks lists all HealthCheck in the project.

func (*GCECloud) ListHttpHealthChecks added in v1.2.0

func (gce *GCECloud) ListHttpHealthChecks() (*compute.HttpHealthCheckList, error)

ListHttpHealthChecks lists all HttpHealthChecks in the project.

func (*GCECloud) ListHttpsHealthChecks added in v1.7.0

func (gce *GCECloud) ListHttpsHealthChecks() (*compute.HttpsHealthCheckList, error)

ListHttpsHealthChecks lists all HttpsHealthChecks in the project.

func (*GCECloud) ListInstanceGroups added in v1.2.0

func (gce *GCECloud) ListInstanceGroups(zone string) (*compute.InstanceGroupList, error)

ListInstanceGroups lists all InstanceGroups in the project and zone.

func (*GCECloud) ListInstancesInInstanceGroup

func (gce *GCECloud) ListInstancesInInstanceGroup(name string, zone string, state string) (*compute.InstanceGroupsListInstances, error)

ListInstancesInInstanceGroup lists all the instances in a given instance group and state.

func (*GCECloud) ListRegionBackendServices added in v1.7.0

func (gce *GCECloud) ListRegionBackendServices(region string) (*compute.BackendServiceList, error)

ListRegionBackendServices lists all backend services in the project.

func (*GCECloud) ListRegionForwardingRules added in v1.7.0

func (gce *GCECloud) ListRegionForwardingRules(region string) (*compute.ForwardingRuleList, error)

ListRegionForwardingRules lists all RegionalForwardingRules in the project & region.

func (*GCECloud) ListRoutes

func (gce *GCECloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)

func (*GCECloud) ListSslCertificates added in v1.2.0

func (gce *GCECloud) ListSslCertificates() (*compute.SslCertificateList, error)

ListSslCertificates lists all SslCertificates in the project.

func (*GCECloud) ListTargetHttpProxies added in v1.2.0

func (gce *GCECloud) ListTargetHttpProxies() (*compute.TargetHttpProxyList, error)

ListTargetHttpProxies lists all TargetHttpProxies in the project.

func (*GCECloud) ListTargetHttpsProxies added in v1.2.0

func (gce *GCECloud) ListTargetHttpsProxies() (*compute.TargetHttpsProxyList, error)

ListTargetHttpsProxies lists all TargetHttpsProxies in the project.

func (*GCECloud) ListUrlMaps added in v1.2.0

func (gce *GCECloud) ListUrlMaps() (*compute.UrlMapList, error)

ListUrlMaps lists all UrlMaps in the project.

func (*GCECloud) ListZonesInRegion added in v1.7.0

func (gce *GCECloud) ListZonesInRegion(region string) ([]*compute.Zone, error)

ListZonesInRegion returns all zones in a GCP region

func (*GCECloud) LoadBalancer added in v1.2.0

func (gce *GCECloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns an implementation of LoadBalancer for Google Compute Engine.

func (*GCECloud) Master

func (gce *GCECloud) Master(clusterName string) (string, error)

func (*GCECloud) NetworkProjectID added in v1.8.0

func (g *GCECloud) NetworkProjectID() string

NetworkProjectID returns the ProjectID corresponding to the project this cluster's network is in.

func (*GCECloud) NetworkURL added in v1.7.0

func (gce *GCECloud) NetworkURL() string

NetworkURL returns the network url

func (*GCECloud) NodeAddresses

func (gce *GCECloud) NodeAddresses(_ types.NodeName) ([]v1.NodeAddress, error)

NodeAddresses is an implementation of Instances.NodeAddresses.

func (*GCECloud) NodeAddressesByProviderID added in v1.7.0

func (gce *GCECloud) NodeAddressesByProviderID(providerID string) ([]v1.NodeAddress, error)

This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here

func (*GCECloud) OnXPN added in v1.7.0

func (gce *GCECloud) OnXPN() bool

OnXPN returns true if the cluster is running on a cross project network (XPN)

func (*GCECloud) ProjectID added in v1.8.0

func (g *GCECloud) ProjectID() string

ProjectID returns the ProjectID corresponding to the project this cloud is in.

func (*GCECloud) ProviderName

func (gce *GCECloud) ProviderName() string

ProviderName returns the cloud provider ID.

func (*GCECloud) Region added in v1.7.0

func (gce *GCECloud) Region() string

Region returns the region

func (*GCECloud) RemoveInstancesFromInstanceGroup

func (gce *GCECloud) RemoveInstancesFromInstanceGroup(name string, zone string, instanceRefs []*compute.InstanceReference) error

RemoveInstancesFromInstanceGroup removes the given instances from the instance group.

func (*GCECloud) RemoveInstancesFromTargetPool added in v1.7.0

func (gce *GCECloud) RemoveInstancesFromTargetPool(name, region string, instanceRefs []*compute.InstanceReference) error

RemoveInstancesToTargetPool removes instances by link to the TargetPool

func (*GCECloud) ReserveAlphaRegionAddress added in v1.8.0

func (gce *GCECloud) ReserveAlphaRegionAddress(addr *computealpha.Address, region string) error

ReserveAlphaRegionAddress creates an Alpha, regional address.

func (*GCECloud) ReserveBetaRegionAddress added in v1.8.0

func (gce *GCECloud) ReserveBetaRegionAddress(addr *computebeta.Address, region string) error

ReserveBetaRegionAddress creates a beta region address

func (*GCECloud) ReserveGlobalAddress added in v1.7.0

func (gce *GCECloud) ReserveGlobalAddress(addr *compute.Address) error

ReserveGlobalAddress creates a global address. Caller is allocated a random IP if they do not specify an ipAddress. If an ipAddress is specified, it must belong to the current project, eg: an ephemeral IP associated with a global forwarding rule.

func (*GCECloud) ReserveRegionAddress added in v1.7.0

func (gce *GCECloud) ReserveRegionAddress(addr *compute.Address, region string) error

ReserveRegionAddress creates a region address

func (*GCECloud) Routes

func (gce *GCECloud) Routes() (cloudprovider.Routes, bool)

Routes returns an implementation of Routes for Google Compute Engine.

func (*GCECloud) ScrubDNS added in v1.1.1

func (gce *GCECloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)

ScrubDNS filters DNS settings for pods.

func (*GCECloud) SetNamedPortsOfInstanceGroup added in v1.7.0

func (gce *GCECloud) SetNamedPortsOfInstanceGroup(igName, zone string, namedPorts []*compute.NamedPort) error

SetNamedPortsOfInstanceGroup sets the list of named ports on a given instance group

func (*GCECloud) SetProxyForGlobalForwardingRule

func (gce *GCECloud) SetProxyForGlobalForwardingRule(forwardingRuleName, targetProxyLink string) error

SetProxyForGlobalForwardingRule links the given TargetHttp(s)Proxy with the given GlobalForwardingRule. targetProxyLink is the SelfLink of a TargetHttp(s)Proxy.

func (*GCECloud) SetSslCertificateForTargetHttpsProxy added in v1.2.0

func (gce *GCECloud) SetSslCertificateForTargetHttpsProxy(proxy *compute.TargetHttpsProxy, sslCert *compute.SslCertificate) error

SetSslCertificateForTargetHttpsProxy sets the given SslCertificate for the given TargetHttpsProxy.

func (*GCECloud) SetUrlMapForTargetHttpProxy

func (gce *GCECloud) SetUrlMapForTargetHttpProxy(proxy *compute.TargetHttpProxy, urlMap *compute.UrlMap) error

SetUrlMapForTargetHttpProxy sets the given UrlMap for the given TargetHttpProxy.

func (*GCECloud) SetUrlMapForTargetHttpsProxy added in v1.2.0

func (gce *GCECloud) SetUrlMapForTargetHttpsProxy(proxy *compute.TargetHttpsProxy, urlMap *compute.UrlMap) error

SetUrlMapForTargetHttpsProxy sets the given UrlMap for the given TargetHttpsProxy.

func (*GCECloud) SubnetworkURL added in v1.7.0

func (gce *GCECloud) SubnetworkURL() string

SubnetworkURL returns the subnetwork url

func (*GCECloud) ToInstanceReferences added in v1.7.0

func (gce *GCECloud) ToInstanceReferences(zone string, instanceNames []string) (refs []*compute.InstanceReference)

ToInstanceReferences returns instance references by links

func (*GCECloud) UpdateFirewall added in v1.2.0

func (gce *GCECloud) UpdateFirewall(f *compute.Firewall) error

UpdateFirewall applies the given firewall as an update to an existing service.

func (*GCECloud) UpdateGlobalBackendService added in v1.7.0

func (gce *GCECloud) UpdateGlobalBackendService(bg *compute.BackendService) error

UpdateGlobalBackendService applies the given BackendService as an update to an existing service.

func (*GCECloud) UpdateHealthCheck added in v1.7.0

func (gce *GCECloud) UpdateHealthCheck(hc *compute.HealthCheck) error

UpdateHealthCheck applies the given HealthCheck as an update.

func (*GCECloud) UpdateHttpHealthCheck added in v1.2.0

func (gce *GCECloud) UpdateHttpHealthCheck(hc *compute.HttpHealthCheck) error

UpdateHttpHealthCheck applies the given HttpHealthCheck as an update.

func (*GCECloud) UpdateHttpsHealthCheck added in v1.7.0

func (gce *GCECloud) UpdateHttpsHealthCheck(hc *compute.HttpsHealthCheck) error

UpdateHttpsHealthCheck applies the given HttpsHealthCheck as an update.

func (*GCECloud) UpdateLoadBalancer added in v1.2.0

func (gce *GCECloud) UpdateLoadBalancer(clusterName string, svc *v1.Service, nodes []*v1.Node) error

UpdateLoadBalancer is an implementation of LoadBalancer.UpdateLoadBalancer.

func (*GCECloud) UpdateRegionBackendService added in v1.7.0

func (gce *GCECloud) UpdateRegionBackendService(bg *compute.BackendService, region string) error

UpdateRegionBackendService applies the given BackendService as an update to an existing service.

func (*GCECloud) UpdateUrlMap

func (gce *GCECloud) UpdateUrlMap(urlMap *compute.UrlMap) error

UpdateUrlMap applies the given UrlMap as an update

func (*GCECloud) Zones

func (gce *GCECloud) Zones() (cloudprovider.Zones, bool)

Zones returns an implementation of Zones for Google Compute Engine.

type GCEDisk added in v1.7.0

type GCEDisk struct {
	ZoneInfo zoneType
	Region   string
	Name     string
	Kind     string
	Type     string
}

type GCEServiceManager added in v1.7.0

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

func (*GCEServiceManager) AttachDisk added in v1.8.0

func (manager *GCEServiceManager) AttachDisk(
	disk *GCEDisk,
	readWrite string,
	instanceZone string,
	instanceName string) (gceObject, error)

func (*GCEServiceManager) CreateDisk added in v1.7.0

func (manager *GCEServiceManager) CreateDisk(
	name string,
	sizeGb int64,
	tagsStr string,
	diskType string,
	zone string) (gceObject, error)

func (*GCEServiceManager) CreateRegionalDisk added in v1.8.0

func (manager *GCEServiceManager) CreateRegionalDisk(
	name string,
	sizeGb int64,
	tagsStr string,
	diskType string,
	replicaZones sets.String) (gceObject, error)

func (*GCEServiceManager) DeleteDisk added in v1.7.0

func (manager *GCEServiceManager) DeleteDisk(
	zone string,
	diskName string) (gceObject, error)

func (*GCEServiceManager) DeleteRegionalDisk added in v1.8.0

func (manager *GCEServiceManager) DeleteRegionalDisk(
	diskName string) (gceObject, error)

func (*GCEServiceManager) DetachDisk added in v1.8.0

func (manager *GCEServiceManager) DetachDisk(
	instanceZone string,
	instanceName string,
	devicePath string) (gceObject, error)

func (*GCEServiceManager) GetDisk added in v1.7.0

func (manager *GCEServiceManager) GetDisk(
	zone string,
	diskName string) (*GCEDisk, error)

func (*GCEServiceManager) GetRegionalDisk added in v1.8.0

func (manager *GCEServiceManager) GetRegionalDisk(
	diskName string) (*GCEDisk, error)

func (*GCEServiceManager) WaitForRegionalOp added in v1.8.0

func (manager *GCEServiceManager) WaitForRegionalOp(
	op gceObject, mc *metricContext) error

func (*GCEServiceManager) WaitForZoneOp added in v1.7.0

func (manager *GCEServiceManager) WaitForZoneOp(
	op gceObject, zone string, mc *metricContext) error

type LoadBalancerType added in v1.7.0

type LoadBalancerType string

func GetLoadBalancerAnnotationType added in v1.7.0

func GetLoadBalancerAnnotationType(service *v1.Service) (LoadBalancerType, bool)

GetLoadBalancerAnnotationType returns the type of GCP load balancer which should be assembled.

type NetworkTier added in v1.8.0

type NetworkTier string

func GetServiceNetworkTier added in v1.8.0

func GetServiceNetworkTier(service *v1.Service) (NetworkTier, error)

GetServiceNetworkTier returns the network tier of GCP load balancer which should be assembled, and an error if the specified tier is not supported.

func NetworkTierGCEValueToType added in v1.8.0

func NetworkTierGCEValueToType(s string) NetworkTier

NetworkTierGCEValueToType converts the value of the NetworkTier field of a GCE object to the NetworkTier type.

func (NetworkTier) ToGCEValue added in v1.8.0

func (n NetworkTier) ToGCEValue() string

ToGCEValue converts NetworkTier to a string that we can populate the NetworkTier field of GCE objects.

type ServiceManager added in v1.7.0

type ServiceManager interface {
	// Creates a new persistent disk on GCE with the given disk spec.
	CreateDisk(
		name string,
		sizeGb int64,
		tagsStr string,
		diskType string,
		zone string) (gceObject, error)

	// Creates a new regional persistent disk on GCE with the given disk spec.
	CreateRegionalDisk(
		name string,
		sizeGb int64,
		tagsStr string,
		diskType string,
		zones sets.String) (gceObject, error)

	// Deletes the persistent disk from GCE with the given diskName.
	DeleteDisk(zone string, disk string) (gceObject, error)

	// Deletes the regional persistent disk from GCE with the given diskName.
	DeleteRegionalDisk(diskName string) (gceObject, error)

	// Attach a persistent disk on GCE with the given disk spec to the specified instance.
	AttachDisk(
		disk *GCEDisk,
		readWrite string,
		instanceZone string,
		instanceName string) (gceObject, error)

	// Detach a persistent disk on GCE with the given disk spec from the specified instance.
	DetachDisk(
		instanceZone string,
		instanceName string,
		devicePath string) (gceObject, error)

	// Gets the persistent disk from GCE with the given diskName.
	GetDisk(zone string, diskName string) (*GCEDisk, error)

	// Gets the regional persistent disk from GCE with the given diskName.
	GetRegionalDisk(diskName string) (*GCEDisk, error)

	// Waits until GCE reports the given operation in the given zone as done.
	WaitForZoneOp(op gceObject, zone string, mc *metricContext) error

	// Waits until GCE reports the given operation in the given region is done.
	WaitForRegionalOp(op gceObject, mc *metricContext) error
}

Jump to

Keyboard shortcuts

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