Documentation ¶
Overview ¶
Package gce is an implementation of Interface, TCPLoadBalancer and Instances for Google Compute Engine.
Index ¶
- Constants
- type Config
- type GCECloud
- func (gce *GCECloud) AddInstancesToInstanceGroup(name string, instanceNames []string) error
- func (gce *GCECloud) AddPortToInstanceGroup(ig *compute.InstanceGroup, port int64) (*compute.NamedPort, error)
- func (gce *GCECloud) AddSSHKeyToAllInstances(user string, keyData []byte) error
- func (gce *GCECloud) AttachDisk(diskName, instanceID string, readOnly bool) error
- func (gce *GCECloud) Clusters() (cloudprovider.Clusters, bool)
- func (gce *GCECloud) CreateBackendService(bg *compute.BackendService) error
- func (gce *GCECloud) CreateDisk(name string, sizeGb int64) error
- func (gce *GCECloud) CreateGlobalForwardingRule(proxy *compute.TargetHttpProxy, name string, portRange string) (*compute.ForwardingRule, error)
- func (gce *GCECloud) CreateHttpHealthCheck(hc *compute.HttpHealthCheck) error
- func (gce *GCECloud) CreateInstanceGroup(name string) (*compute.InstanceGroup, error)
- func (gce *GCECloud) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error
- func (gce *GCECloud) CreateTargetHttpProxy(urlMap *compute.UrlMap, name string) (*compute.TargetHttpProxy, error)
- func (gce *GCECloud) CreateUrlMap(backend *compute.BackendService, name string) (*compute.UrlMap, error)
- func (gce *GCECloud) CurrentNodeName(hostname string) (string, error)
- func (gce *GCECloud) DeleteBackendService(name string) error
- func (gce *GCECloud) DeleteDisk(diskToDelete string) error
- func (gce *GCECloud) DeleteGlobalForwardingRule(name string) error
- func (gce *GCECloud) DeleteHttpHealthCheck(name string) error
- func (gce *GCECloud) DeleteInstanceGroup(name string) error
- func (gce *GCECloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
- func (gce *GCECloud) DeleteTargetHttpProxy(name string) error
- func (gce *GCECloud) DeleteUrlMap(name string) error
- func (gce *GCECloud) DetachDisk(devicePath, instanceID string) error
- func (gce *GCECloud) DiskIsAttached(diskName, instanceID string) (bool, error)
- func (gce *GCECloud) EnsureTCPLoadBalancer(name, region string, requestedIP net.IP, ports []*api.ServicePort, ...) (*api.LoadBalancerStatus, error)
- func (gce *GCECloud) EnsureTCPLoadBalancerDeleted(name, region string) error
- func (gce *GCECloud) ExternalID(instance string) (string, error)
- func (gce *GCECloud) GetBackendService(name string) (*compute.BackendService, error)
- func (gce *GCECloud) GetGlobalForwardingRule(name string) (*compute.ForwardingRule, error)
- func (gce *GCECloud) GetHealth(name string, instanceGroupLink string) (*compute.BackendServiceGroupHealth, error)
- func (gce *GCECloud) GetHttpHealthCheck(name string) (*compute.HttpHealthCheck, error)
- func (gce *GCECloud) GetInstanceGroup(name string) (*compute.InstanceGroup, error)
- func (gce *GCECloud) GetTCPLoadBalancer(name, region string) (*api.LoadBalancerStatus, bool, error)
- func (gce *GCECloud) GetTargetHttpProxy(name string) (*compute.TargetHttpProxy, error)
- func (gce *GCECloud) GetUrlMap(name string) (*compute.UrlMap, error)
- func (gce *GCECloud) GetZone() (cloudprovider.Zone, error)
- func (gce *GCECloud) InstanceID(instance string) (string, error)
- func (gce *GCECloud) Instances() (cloudprovider.Instances, bool)
- func (gce *GCECloud) List(filter string) ([]string, error)
- func (gce *GCECloud) ListBackendServices() (*compute.BackendServiceList, error)
- func (gce *GCECloud) ListClusters() ([]string, error)
- func (gce *GCECloud) ListGlobalForwardingRules() (*compute.ForwardingRuleList, error)
- func (gce *GCECloud) ListHttpHealthChecks() (*compute.HttpHealthCheckList, error)
- func (gce *GCECloud) ListInstanceGroups() (*compute.InstanceGroupList, error)
- func (gce *GCECloud) ListInstancesInInstanceGroup(name string, state string) (*compute.InstanceGroupsListInstances, error)
- func (gce *GCECloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
- func (gce *GCECloud) ListTargetHttpProxies() (*compute.TargetHttpProxyList, error)
- func (gce *GCECloud) ListUrlMaps() (*compute.UrlMapList, error)
- func (gce *GCECloud) Master(clusterName string) (string, error)
- func (gce *GCECloud) NodeAddresses(_ string) ([]api.NodeAddress, error)
- func (gce *GCECloud) ProviderName() string
- func (gce *GCECloud) RemoveInstancesFromInstanceGroup(name string, instanceNames []string) error
- func (gce *GCECloud) Routes() (cloudprovider.Routes, bool)
- func (gce *GCECloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)
- func (gce *GCECloud) SetProxyForGlobalForwardingRule(fw *compute.ForwardingRule, proxy *compute.TargetHttpProxy) error
- func (gce *GCECloud) SetUrlMapForTargetHttpProxy(proxy *compute.TargetHttpProxy, urlMap *compute.UrlMap) error
- func (gce *GCECloud) TCPLoadBalancer() (cloudprovider.TCPLoadBalancer, bool)
- func (gce *GCECloud) UpdateBackendService(bg *compute.BackendService) error
- func (gce *GCECloud) UpdateHttpHealthCheck(hc *compute.HttpHealthCheck) error
- func (gce *GCECloud) UpdateTCPLoadBalancer(name, region string, hosts []string) error
- func (gce *GCECloud) UpdateUrlMap(urlMap *compute.UrlMap) (*compute.UrlMap, error)
- func (gce *GCECloud) Zones() (cloudprovider.Zones, bool)
Constants ¶
const (
ProviderName = "gce"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GCECloud ¶
type GCECloud struct {
// contains filtered or unexported fields
}
GCECloud is an implementation of Interface, TCPLoadBalancer and Instances for Google Compute Engine.
func CreateGCECloud ¶ added in v1.2.0
func CreateGCECloud(projectID, zone, networkURL string, tokenSource oauth2.TokenSource, useMetadataServer bool) (*GCECloud, error)
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.
func (*GCECloud) AddInstancesToInstanceGroup ¶
AddInstancesToInstanceGroup adds the given instances to the given instance group.
func (*GCECloud) AddPortToInstanceGroup ¶
func (gce *GCECloud) AddPortToInstanceGroup(ig *compute.InstanceGroup, port int64) (*compute.NamedPort, error)
AddPortToInstanceGroup adds a port to the given instance group.
func (*GCECloud) AddSSHKeyToAllInstances ¶
func (*GCECloud) AttachDisk ¶
func (*GCECloud) CreateBackendService ¶
func (gce *GCECloud) CreateBackendService(bg *compute.BackendService) error
CreateBackendService creates the given BackendService.
func (*GCECloud) CreateDisk ¶ added in v1.2.0
func (*GCECloud) CreateGlobalForwardingRule ¶
func (gce *GCECloud) CreateGlobalForwardingRule(proxy *compute.TargetHttpProxy, name string, portRange string) (*compute.ForwardingRule, error)
CreateGlobalForwardingRule creates and returns a GlobalForwardingRule that points to the given TargetHttpProxy.
func (*GCECloud) CreateHttpHealthCheck ¶ added in v1.2.0
func (gce *GCECloud) CreateHttpHealthCheck(hc *compute.HttpHealthCheck) error
CreateHttpHealthCheck creates the given HttpHealthCheck.
func (*GCECloud) CreateInstanceGroup ¶
func (gce *GCECloud) CreateInstanceGroup(name string) (*compute.InstanceGroup, error)
CreateInstanceGroup creates an instance group with the given instances. It is the callers responsibility to add named ports.
func (*GCECloud) CreateRoute ¶
func (*GCECloud) CreateTargetHttpProxy ¶
func (gce *GCECloud) CreateTargetHttpProxy(urlMap *compute.UrlMap, name string) (*compute.TargetHttpProxy, error)
CreateTargetHttpProxy creates and returns a TargetHttpProxy with the given UrlMap.
func (*GCECloud) CreateUrlMap ¶
func (gce *GCECloud) CreateUrlMap(backend *compute.BackendService, name string) (*compute.UrlMap, error)
CreateUrlMap creates an url map, using the given backend service as the default service.
func (*GCECloud) CurrentNodeName ¶
Implementation of Instances.CurrentNodeName
func (*GCECloud) DeleteBackendService ¶
DeleteBackendService deletes the given BackendService by name.
func (*GCECloud) DeleteDisk ¶ added in v1.2.0
func (*GCECloud) DeleteGlobalForwardingRule ¶
DeleteGlobalForwardingRule deletes the GlobalForwardingRule by name.
func (*GCECloud) DeleteHttpHealthCheck ¶ added in v1.2.0
DeleteHttpHealthCheck deletes the given HttpHealthCheck by name.
func (*GCECloud) DeleteInstanceGroup ¶
DeleteInstanceGroup deletes an instance group.
func (*GCECloud) DeleteRoute ¶
func (gce *GCECloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
func (*GCECloud) DeleteTargetHttpProxy ¶
DeleteTargetHttpProxy deletes the TargetHttpProxy by name.
func (*GCECloud) DeleteUrlMap ¶
DeleteUrlMap deletes a url map by name.
func (*GCECloud) DetachDisk ¶
func (*GCECloud) DiskIsAttached ¶ added in v1.2.0
func (*GCECloud) EnsureTCPLoadBalancer ¶
func (gce *GCECloud) EnsureTCPLoadBalancer(name, region string, requestedIP net.IP, ports []*api.ServicePort, hosts []string, affinityType api.ServiceAffinity) (*api.LoadBalancerStatus, error)
EnsureTCPLoadBalancer is an implementation of TCPLoadBalancer.EnsureTCPLoadBalancer. Our load balancers in GCE consist of four separate GCE resources - a static IP address, a firewall rule, a target pool, and a forwarding rule. This function has to manage all of them. Due to an interesting series of design decisions, this handles both creating new load balancers and updating existing load balancers, recognizing when each is needed.
func (*GCECloud) EnsureTCPLoadBalancerDeleted ¶
EnsureTCPLoadBalancerDeleted is an implementation of TCPLoadBalancer.EnsureTCPLoadBalancerDeleted.
func (*GCECloud) ExternalID ¶
ExternalID returns the cloud provider ID of the specified instance (deprecated).
func (*GCECloud) GetBackendService ¶
func (gce *GCECloud) GetBackendService(name string) (*compute.BackendService, error)
GetBackendService retrieves a backend by name.
func (*GCECloud) GetGlobalForwardingRule ¶
func (gce *GCECloud) GetGlobalForwardingRule(name string) (*compute.ForwardingRule, error)
GetGlobalForwardingRule returns the GlobalForwardingRule by name.
func (*GCECloud) GetHealth ¶ added in v1.2.0
func (gce *GCECloud) GetHealth(name string, instanceGroupLink string) (*compute.BackendServiceGroupHealth, error)
GetHealth 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) GetHttpHealthCheck ¶
func (gce *GCECloud) GetHttpHealthCheck(name string) (*compute.HttpHealthCheck, error)
GetHttpHealthCheck returns the given HttpHealthCheck by name.
func (*GCECloud) GetInstanceGroup ¶
func (gce *GCECloud) GetInstanceGroup(name string) (*compute.InstanceGroup, error)
GetInstanceGroup returns an instance group by name.
func (*GCECloud) GetTCPLoadBalancer ¶
GetTCPLoadBalancer is an implementation of TCPLoadBalancer.GetTCPLoadBalancer
func (*GCECloud) GetTargetHttpProxy ¶
func (gce *GCECloud) GetTargetHttpProxy(name string) (*compute.TargetHttpProxy, error)
GetTargetHttpProxy returns the UrlMap by name.
func (*GCECloud) InstanceID ¶
InstanceID returns the cloud provider ID of the specified instance.
func (*GCECloud) Instances ¶
func (gce *GCECloud) Instances() (cloudprovider.Instances, bool)
Instances returns an implementation of Instances for Google Compute Engine.
func (*GCECloud) ListBackendServices ¶ added in v1.2.0
func (gce *GCECloud) ListBackendServices() (*compute.BackendServiceList, error)
ListBackendServices lists all backend services in the project.
func (*GCECloud) ListClusters ¶
func (*GCECloud) ListGlobalForwardingRules ¶ added in v1.2.0
func (gce *GCECloud) ListGlobalForwardingRules() (*compute.ForwardingRuleList, error)
ListGlobalForwardingRules lists all GlobalForwardingRules in the project.
func (*GCECloud) ListHttpHealthChecks ¶ added in v1.2.0
func (gce *GCECloud) ListHttpHealthChecks() (*compute.HttpHealthCheckList, error)
ListHttpHealthCheck lists all HttpHealthChecks in the project.
func (*GCECloud) ListInstanceGroups ¶ added in v1.2.0
func (gce *GCECloud) ListInstanceGroups() (*compute.InstanceGroupList, error)
ListInstanceGroups lists all InstanceGroups in the project and zone.
func (*GCECloud) ListInstancesInInstanceGroup ¶
func (gce *GCECloud) ListInstancesInInstanceGroup(name string, state string) (*compute.InstanceGroupsListInstances, error)
ListInstancesInInstanceGroup lists all the instances in a given istance group and state.
func (*GCECloud) ListRoutes ¶
func (gce *GCECloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
func (*GCECloud) ListTargetHttpProxies ¶ added in v1.2.0
func (gce *GCECloud) ListTargetHttpProxies() (*compute.TargetHttpProxyList, error)
ListTargetHttpProxies lists all TargetHttpProxies 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) NodeAddresses ¶
func (gce *GCECloud) NodeAddresses(_ string) ([]api.NodeAddress, error)
NodeAddresses is an implementation of Instances.NodeAddresses.
func (*GCECloud) ProviderName ¶
ProviderName returns the cloud provider ID.
func (*GCECloud) RemoveInstancesFromInstanceGroup ¶
RemoveInstancesFromInstanceGroup removes the given instances from the instance group.
func (*GCECloud) Routes ¶
func (gce *GCECloud) Routes() (cloudprovider.Routes, bool)
Routes returns an implementation of Routes for Google Compute Engine.
func (*GCECloud) SetProxyForGlobalForwardingRule ¶
func (gce *GCECloud) SetProxyForGlobalForwardingRule(fw *compute.ForwardingRule, proxy *compute.TargetHttpProxy) error
SetProxyForGlobalForwardingRule links the given TargetHttpProxy with the given GlobalForwardingRule.
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) TCPLoadBalancer ¶
func (gce *GCECloud) TCPLoadBalancer() (cloudprovider.TCPLoadBalancer, bool)
TCPLoadBalancer returns an implementation of TCPLoadBalancer for Google Compute Engine.
func (*GCECloud) UpdateBackendService ¶
func (gce *GCECloud) UpdateBackendService(bg *compute.BackendService) error
UpdateBackendService applies the given BackendService as an update to an existing service.
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) UpdateTCPLoadBalancer ¶
UpdateTCPLoadBalancer is an implementation of TCPLoadBalancer.UpdateTCPLoadBalancer.
func (*GCECloud) UpdateUrlMap ¶
UpdateUrlMap applies the given UrlMap as an update, and returns the new UrlMap.