gce

package
v1.13.3-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FirewallTimeoutDefault = 3 * time.Minute
	FirewallTestTcpTimeout = time.Duration(1 * time.Second)
	// Set ports outside of 30000-32767, 80 and 8080 to avoid being whitelisted by the e2e cluster
	FirewallTestHttpPort = int32(29999)
	FirewallTestUdpPort  = int32(29998)
)

Variables

This section is empty.

Functions

func ConstructFirewallForLBService

func ConstructFirewallForLBService(svc *v1.Service, nodeTag string) *compute.Firewall

ConstructFirewallForLBService returns the expected GCE firewall rule for a loadbalancer type service

func ConstructHealthCheckFirewallForLBService

func ConstructHealthCheckFirewallForLBService(clusterID string, svc *v1.Service, nodeTag string, isNodesHealthCheck bool) *compute.Firewall

ConstructHealthCheckFirewallForLBService returns the expected GCE firewall rule for a loadbalancer type service

func GcloudComputeResourceCreate

func GcloudComputeResourceCreate(resource, name, project string, args ...string) error

GcloudComputeResourceCreate creates a compute resource with a name and arguments.

func GcloudComputeResourceDelete

func GcloudComputeResourceDelete(resource, name, project string, args ...string) error

GcloudComputeResourceDelete deletes the specified compute resource by name and project.

func GetClusterID

func GetClusterID(c clientset.Interface) (string, error)

func GetClusterName

func GetClusterName(instancePrefix string) string

GetClusterName returns the CLUSTER_NAME env we set for e2e cluster. From cluster/gce/config-test.sh, cluster name is set up using below format: CLUSTER_NAME="${CLUSTER_NAME:-${INSTANCE_PREFIX}}"

func GetE2eFirewalls

func GetE2eFirewalls(masterName, masterTag, nodeTag, network, clusterIpRange string) []*compute.Firewall

GetE2eFirewalls returns all firewall rules we create for an e2e cluster. From cluster/gce/util.sh, all firewall rules should be consistent with the ones created by startup scripts.

func GetGCECloud

func GetGCECloud() (*gcecloud.Cloud, error)

func GetInstancePrefix

func GetInstancePrefix(masterName string) (string, error)

GetInstancePrefix returns the INSTANCE_PREFIX env we set for e2e cluster. From cluster/gce/config-test.sh, master name is set up using below format: MASTER_NAME="${INSTANCE_PREFIX}-master"

func GetInstanceTags

func GetInstanceTags(cloudConfig framework.CloudConfig, instanceName string) *compute.Tags

GetInstanceTags gets tags from GCE instance with given name.

func GetNodeTags

func GetNodeTags(c clientset.Interface, cloudConfig framework.CloudConfig) []string

GetNodeTags gets k8s node tag from one of the nodes

func IsGoogleAPIHTTPErrorCode

func IsGoogleAPIHTTPErrorCode(err error, code int) bool

IsHTTPErrorCode returns true if the error is a google api error matching the corresponding HTTP error code.

func MakeFirewallNameForLBService

func MakeFirewallNameForLBService(name string) string

MakeFirewallNameForLBService return the expected firewall name for a LB service. This should match the formatting of makeFirewallName() in pkg/cloudprovider/providers/gce/gce_loadbalancer.go

func MakeHealthCheckFirewallNameForLBService

func MakeHealthCheckFirewallNameForLBService(clusterID, name string, isNodesHealthCheck bool) string

func NewProvider

func NewProvider(gceCloud *gcecloud.Cloud) framework.ProviderInterface

func PackProtocolsPortsFromFirewall

func PackProtocolsPortsFromFirewall(alloweds []*compute.FirewallAllowed) []string

PackProtocolsPortsFromFirewall packs protocols and ports in an unified way for verification.

func SameStringArray

func SameStringArray(result, expected []string, include bool) error

SameStringArray verifies whether two string arrays have the same strings, return error if not. Order does not matter. When `include` is set to true, verifies whether result includes all elements from expected.

func SetInstanceTags

func SetInstanceTags(cloudConfig framework.CloudConfig, instanceName, zone string, tags []string) []string

SetInstanceTags sets tags on GCE instance with given name.

func VerifyFirewallRule

func VerifyFirewallRule(res, exp *compute.Firewall, network string, portsSubset bool) error

VerifyFirewallRule verifies whether the result firewall is consistent with the expected firewall. When `portsSubset` is false, match given ports exactly. Otherwise, only check ports are included.

func WaitForFirewallRule

func WaitForFirewallRule(gceCloud *gcecloud.Cloud, fwName string, exist bool, timeout time.Duration) (*compute.Firewall, error)

Types

type GCEIngressController

type GCEIngressController struct {
	Ns string

	UID string

	Client clientset.Interface
	Cloud  framework.CloudConfig
	// contains filtered or unexported fields
}

GCEIngressController manages implementation details of Ingress on GCE/GKE.

func (*GCEIngressController) BackendServiceUsingIG

func (cont *GCEIngressController) BackendServiceUsingIG(svcPorts map[string]v1.ServicePort) (bool, error)

BackendServiceUsingIG returns true only if all global backend service with matching svcPorts pointing to IG as backend

func (*GCEIngressController) BackendServiceUsingNEG

func (cont *GCEIngressController) BackendServiceUsingNEG(svcPorts map[string]v1.ServicePort) (bool, error)

BackendServiceUsingNEG returns true only if all global backend service with matching nodeports pointing to NEG as backend

func (*GCEIngressController) Cleanup

func (cont *GCEIngressController) Cleanup(del bool) error

Cleanup cleans up cloud resources. If del is false, it simply reports existing resources without deleting them. If dle is true, it deletes resources it finds acceptable (see canDelete func).

func (*GCEIngressController) CleanupGCEIngressController

func (cont *GCEIngressController) CleanupGCEIngressController() error

func (*GCEIngressController) CleanupGCEIngressControllerWithTimeout

func (cont *GCEIngressController) CleanupGCEIngressControllerWithTimeout(timeout time.Duration) error

CleanupGCEIngressControllerWithTimeout calls the GCEIngressController.Cleanup(false) followed with deleting the static ip, and then a final GCEIngressController.Cleanup(true)

func (*GCEIngressController) CreateStaticIP

func (cont *GCEIngressController) CreateStaticIP(name string) string

CreateStaticIP allocates a random static ip with the given name. Returns a string representation of the ip. Caller is expected to manage cleanup of the ip by invoking deleteStaticIPs.

func (*GCEIngressController) GetFirewallRule

func (cont *GCEIngressController) GetFirewallRule() *compute.Firewall

GetFirewallRule returns the firewall used by the GCEIngressController. Causes a fatal error incase of an error. TODO: Rename this to GetFirewallRuleOrDie and similarly rename all other methods here to be consistent with rest of the code in this repo.

func (*GCEIngressController) GetFirewallRuleName

func (cont *GCEIngressController) GetFirewallRuleName() string

GetFirewallRuleName returns the name of the firewall used for the GCEIngressController.

func (*GCEIngressController) GetFirewallRuleOrError

func (cont *GCEIngressController) GetFirewallRuleOrError() (*compute.Firewall, error)

GetFirewallRule returns the firewall used by the GCEIngressController. Returns an error if that fails. TODO: Rename this to GetFirewallRule when the above method with that name is renamed.

func (*GCEIngressController) GetGlobalAddress

func (cont *GCEIngressController) GetGlobalAddress(ipName string) *compute.Address

func (*GCEIngressController) Init

func (cont *GCEIngressController) Init() error

Init initializes the GCEIngressController with an UID

func (*GCEIngressController) ListGlobalBackendServices

func (cont *GCEIngressController) ListGlobalBackendServices() []*compute.BackendService

func (*GCEIngressController) ListGlobalForwardingRules

func (cont *GCEIngressController) ListGlobalForwardingRules() []*compute.ForwardingRule

func (*GCEIngressController) ListInstanceGroups

func (cont *GCEIngressController) ListInstanceGroups() []*compute.InstanceGroup

func (*GCEIngressController) ListSslCertificates

func (cont *GCEIngressController) ListSslCertificates() []*compute.SslCertificate

func (*GCEIngressController) ListTargetHttpProxies

func (cont *GCEIngressController) ListTargetHttpProxies() []*compute.TargetHttpProxy

func (*GCEIngressController) ListTargetHttpsProxies

func (cont *GCEIngressController) ListTargetHttpsProxies() []*compute.TargetHttpsProxy

func (*GCEIngressController) ListUrlMaps

func (cont *GCEIngressController) ListUrlMaps() []*compute.UrlMap

type Provider

type Provider struct {
	framework.NullProvider
	// contains filtered or unexported fields
}

func (*Provider) CleanupServiceResources

func (p *Provider) CleanupServiceResources(c clientset.Interface, loadBalancerName, region, zone string)

CleanupResources cleans up GCE Service Type=LoadBalancer resources with the given name. The name is usually the UUID of the Service prefixed with an alpha-numeric character ('a') to work around cloudprovider rules.

func (*Provider) CreatePD

func (p *Provider) CreatePD(zone string) (string, error)

func (*Provider) CreatePVSource

func (p *Provider) CreatePVSource(zone, diskName string) (*v1.PersistentVolumeSource, error)

func (*Provider) DeletePD

func (p *Provider) DeletePD(pdName string) error

func (*Provider) DeletePVSource

func (p *Provider) DeletePVSource(pvSource *v1.PersistentVolumeSource) error

func (*Provider) EnableAndDisableInternalLB

func (p *Provider) EnableAndDisableInternalLB() (enable, disable func(svc *v1.Service))

func (*Provider) EnsureLoadBalancerResourcesDeleted

func (p *Provider) EnsureLoadBalancerResourcesDeleted(ip, portRange string) error

func (*Provider) GetGroupNodes

func (p *Provider) GetGroupNodes(group string) ([]string, error)

func (*Provider) GroupSize

func (p *Provider) GroupSize(group string) (int, error)

func (*Provider) LoadBalancerSrcRanges

func (p *Provider) LoadBalancerSrcRanges() []string

func (*Provider) ResizeGroup

func (p *Provider) ResizeGroup(group string, size int32) error

Jump to

Keyboard shortcuts

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