...

Package gce

import "k8s.io/kubernetes/test/e2e/framework/providers/gce"
Overview
Index

Overview ▾

Index ▾

func ConstructFirewallForLBService(svc *v1.Service, nodeTag string) *compute.Firewall
func ConstructHealthCheckFirewallForLBService(clusterID string, svc *v1.Service, nodeTag string, isNodesHealthCheck bool) *compute.Firewall
func GcloudComputeResourceDelete(resource, name, project string, args ...string) error
func GetClusterID(ctx context.Context, c clientset.Interface) (string, error)
func GetGCECloud() (*gcecloud.Cloud, error)
func GetInstanceTags(cloudConfig framework.CloudConfig, instanceName string) *compute.Tags
func IsGoogleAPIHTTPErrorCode(err error, code int) bool
func MakeFirewallNameForLBService(name string) string
func MakeHealthCheckFirewallNameForLBService(clusterID, name string, isNodesHealthCheck bool) string
func NewProvider(gceCloud *gcecloud.Cloud) framework.ProviderInterface
func PackProtocolsPortsFromFirewall(alloweds []*compute.FirewallAllowed) []string
func RecreateNodes(c clientset.Interface, nodes []v1.Node) error
func SameStringArray(result, expected []string, include bool) error
func SetInstanceTags(cloudConfig framework.CloudConfig, instanceName, zone string, tags []string) []string
func VerifyFirewallRule(res, exp *compute.Firewall, network string, portsSubset bool) error
func WaitForFirewallRule(ctx context.Context, gceCloud *gcecloud.Cloud, fwName string, exist bool, timeout time.Duration) (*compute.Firewall, error)
func WaitForNodeBootIdsToChange(ctx context.Context, c clientset.Interface, nodes []v1.Node, timeout time.Duration) error
type IngressController
    func (cont *IngressController) BackendServiceUsingIG(svcPorts map[string]v1.ServicePort) error
    func (cont *IngressController) BackendServiceUsingNEG(svcPorts map[string]v1.ServicePort) error
    func (cont *IngressController) Cleanup(del bool) error
    func (cont *IngressController) CleanupIngressController(ctx context.Context) error
    func (cont *IngressController) CleanupIngressControllerWithTimeout(ctx context.Context, timeout time.Duration) error
    func (cont *IngressController) Init(ctx context.Context) error
    func (cont *IngressController) WaitForNegBackendService(ctx context.Context, svcPorts map[string]v1.ServicePort) error
type Provider
    func (p *Provider) CleanupServiceResources(ctx context.Context, c clientset.Interface, loadBalancerName, region, zone string)
    func (p *Provider) CreatePD(zone string) (string, error)
    func (p *Provider) CreatePVSource(ctx context.Context, zone, diskName string) (*v1.PersistentVolumeSource, error)
    func (p *Provider) CreateShare() (string, string, string, error)
    func (p *Provider) DeleteNode(node *v1.Node) error
    func (p *Provider) DeletePD(pdName string) error
    func (p *Provider) DeletePVSource(ctx context.Context, pvSource *v1.PersistentVolumeSource) error
    func (p *Provider) DeleteShare(accountName, shareName string) error
    func (p *Provider) EnableAndDisableInternalLB() (enable, disable func(svc *v1.Service))
    func (p *Provider) EnsureLoadBalancerResourcesDeleted(ctx context.Context, ip, portRange string) error
    func (p *Provider) GetGroupNodes(group string) ([]string, error)
    func (p *Provider) GroupSize(group string) (int, error)
    func (p *Provider) L4LoadBalancerSrcRanges() []string
    func (p *Provider) ResizeGroup(group string, size int32) error

Package files

doc.go firewall.go gce.go ingress.go util.go

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 GcloudComputeResourceDelete

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

GcloudComputeResourceDelete deletes the specified compute resource by name and project.

func GetClusterID

func GetClusterID(ctx context.Context, c clientset.Interface) (string, error)

GetClusterID returns cluster ID

func GetGCECloud

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

GetGCECloud returns GCE cloud provider

func GetInstanceTags

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

GetInstanceTags gets tags from GCE instance with given name.

func IsGoogleAPIHTTPErrorCode

func IsGoogleAPIHTTPErrorCode(err error, code int) bool

IsGoogleAPIHTTPErrorCode 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

MakeHealthCheckFirewallNameForLBService returns the firewall name used by the GCE load balancers for performing health checks.

func NewProvider

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

NewProvider returns a cloud provider interface for GCE

func PackProtocolsPortsFromFirewall

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

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

func RecreateNodes

func RecreateNodes(c clientset.Interface, nodes []v1.Node) error

RecreateNodes recreates the given nodes in a managed instance group.

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(ctx context.Context, gceCloud *gcecloud.Cloud, fwName string, exist bool, timeout time.Duration) (*compute.Firewall, error)

WaitForFirewallRule waits for the specified firewall existence

func WaitForNodeBootIdsToChange

func WaitForNodeBootIdsToChange(ctx context.Context, c clientset.Interface, nodes []v1.Node, timeout time.Duration) error

WaitForNodeBootIdsToChange waits for the boot ids of the given nodes to change in order to verify the node has been recreated.

type IngressController

IngressController manages implementation details of Ingress on GCE/GKE.

type IngressController struct {
    Ns  string
    UID string

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

func (*IngressController) BackendServiceUsingIG

func (cont *IngressController) BackendServiceUsingIG(svcPorts map[string]v1.ServicePort) error

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

func (*IngressController) BackendServiceUsingNEG

func (cont *IngressController) BackendServiceUsingNEG(svcPorts map[string]v1.ServicePort) error

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

func (*IngressController) Cleanup

func (cont *IngressController) 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 (*IngressController) CleanupIngressController

func (cont *IngressController) CleanupIngressController(ctx context.Context) error

CleanupIngressController calls cont.CleanupIngressControllerWithTimeout with hard-coded timeout

func (*IngressController) CleanupIngressControllerWithTimeout

func (cont *IngressController) CleanupIngressControllerWithTimeout(ctx context.Context, timeout time.Duration) error

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

func (*IngressController) Init

func (cont *IngressController) Init(ctx context.Context) error

Init initializes the IngressController with an UID

func (*IngressController) WaitForNegBackendService

func (cont *IngressController) WaitForNegBackendService(ctx context.Context, svcPorts map[string]v1.ServicePort) error

WaitForNegBackendService waits for the expected backend service to become

type Provider

Provider is a structure to handle GCE clouds for e2e testing

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

func (*Provider) CleanupServiceResources

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

CleanupServiceResources 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)

CreatePD creates a persistent volume

func (*Provider) CreatePVSource

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

CreatePVSource creates a persistent volume source

func (*Provider) CreateShare

func (p *Provider) CreateShare() (string, string, string, error)

func (*Provider) DeleteNode

func (p *Provider) DeleteNode(node *v1.Node) error

DeleteNode deletes a node which is specified as the argument

func (*Provider) DeletePD

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

DeletePD deletes a persistent volume

func (*Provider) DeletePVSource

func (p *Provider) DeletePVSource(ctx context.Context, pvSource *v1.PersistentVolumeSource) error

DeletePVSource deletes a persistent volume source

func (*Provider) DeleteShare

func (p *Provider) DeleteShare(accountName, shareName string) error

func (*Provider) EnableAndDisableInternalLB

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

EnableAndDisableInternalLB returns functions for both enabling and disabling internal Load Balancer

func (*Provider) EnsureLoadBalancerResourcesDeleted

func (p *Provider) EnsureLoadBalancerResourcesDeleted(ctx context.Context, ip, portRange string) error

EnsureLoadBalancerResourcesDeleted ensures that cloud load balancer resources that were created

func (*Provider) GetGroupNodes

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

GetGroupNodes returns a node name for the specified node group

func (*Provider) GroupSize

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

GroupSize returns the size of an instance group

func (*Provider) L4LoadBalancerSrcRanges

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

L4LoadBalancerSrcRanges contains the ranges of ips used by the GCE L4 load balancers for proxying client requests and performing health checks.

func (*Provider) ResizeGroup

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

ResizeGroup resizes an instance group