Documentation ¶
Overview ¶
Package gce is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.
Index ¶
- Constants
- func GetGCERegion(zone string) (string, error)
- func NewAltTokenSource(tokenURL, tokenBody string) oauth2.TokenSource
- type AltTokenSource
- type Config
- type GCECloud
- func (gce *GCECloud) EnsureFirewall(ctx context.Context, apiService *apiv1.Service, hostnames []string) error
- func (gce *GCECloud) EnsureFirewallDeleted(ctx context.Context, service *apiv1.Service) error
- func (gce *GCECloud) Firewall() (cloudprovider.Firewall, bool)
- func (gce *GCECloud) GetComputeService() *compute.Service
- func (gce *GCECloud) GetSecurityGroupName(service *apiv1.Service) string
- func (gce *GCECloud) ProviderName() string
Constants ¶
const (
ProviderName = "gce"
)
Variables ¶
This section is empty.
Functions ¶
func GetGCERegion ¶
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 NewAltTokenSource ¶
func NewAltTokenSource(tokenURL, tokenBody string) oauth2.TokenSource
Types ¶
type AltTokenSource ¶
type AltTokenSource struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct { Global struct { TokenURL string `gcfg:"token-url"` TokenBody string `gcfg:"token-body"` ProjectID string `gcfg:"project-id"` NetworkName string `gcfg:"network-name"` NodeTags []string `gcfg:"node-tags"` NodeInstancePrefix string `gcfg:"node-instance-prefix"` Multizone bool `gcfg:"multizone"` } }
type GCECloud ¶
type GCECloud struct {
// contains filtered or unexported fields
}
GCECloud is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.
func CreateGCECloud ¶
func CreateGCECloud(projectID, region, zone string, managedZones []string, networkURL string, nodeTags []string, nodeInstancePrefix 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. If managedZones is nil / empty all zones in the region will be managed.
func (*GCECloud) EnsureFirewall ¶
func (gce *GCECloud) EnsureFirewall(ctx context.Context, apiService *apiv1.Service, hostnames []string) error
EnsureFirewall is an implementation of LoadBalancer.EnsureLoadBalancer. 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) EnsureFirewallDeleted ¶
EnsureFirewallDeleted is an implementation of Firewall.EnsureFirewallDeleted.
func (*GCECloud) Firewall ¶
func (gce *GCECloud) Firewall() (cloudprovider.Firewall, bool)
Firewall returns an implementation of Firewall for Google Compute Engine.
func (*GCECloud) GetComputeService ¶
Raw access to the underlying GCE service, probably should only be used for e2e tests
func (*GCECloud) GetSecurityGroupName ¶
func (*GCECloud) ProviderName ¶
ProviderName returns the cloud provider ID.