ingress

package
v1.13.6 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Ingress class annotation defined in ingress repository.
	// TODO: All these annotations should be reused from
	// ingress-gce/pkg/annotations instead of duplicating them here.
	IngressClassKey = "kubernetes.io/ingress.class"

	// Ingress class annotation value for multi cluster ingress.
	MulticlusterIngressClassValue = "gce-multi-cluster"

	// Static IP annotation defined in ingress repository.
	IngressStaticIPKey = "kubernetes.io/ingress.global-static-ip-name"

	// Allow HTTP annotation defined in ingress repository.
	IngressAllowHTTPKey = "kubernetes.io/ingress.allow-http"

	// Pre-shared-cert annotation defined in ingress repository.
	IngressPreSharedCertKey = "ingress.gcp.kubernetes.io/pre-shared-cert"

	// ServiceApplicationProtocolKey annotation defined in ingress repository.
	ServiceApplicationProtocolKey = "service.alpha.kubernetes.io/app-protocols"

	// IngressManifestPath is the parent path to yaml test manifests.
	IngressManifestPath = "test/e2e/testing-manifests/ingress"

	// IngressReqTimeout is the timeout on a single http request.
	IngressReqTimeout = 10 * time.Second

	NEGAnnotation       = "cloud.google.com/neg"
	NEGStatusAnnotation = "cloud.google.com/neg-status"
	NEGUpdateTimeout    = 2 * time.Minute

	InstanceGroupAnnotation = "ingress.gcp.kubernetes.io/instance-groups"

	// Prefix for annotation keys used by the ingress controller to specify the
	// names of GCP resources such as forwarding rules, url maps, target proxies, etc
	// that it created for the corresponding ingress.
	StatusPrefix = "ingress.kubernetes.io"
)

Variables

This section is empty.

Functions

func BuildInsecureClient

func BuildInsecureClient(timeout time.Duration) *http.Client

BuildInsecureClient returns an insecure http client. Can be used for "curl -k".

func GenerateRSACerts

func GenerateRSACerts(host string, isCA bool) ([]byte, []byte, error)

GenerateRSACerts generates a basic self signed certificate using a key length of rsaBits, valid for validFor time.

Types

type E2ELogger

type E2ELogger struct{}

func (*E2ELogger) Errorf

func (l *E2ELogger) Errorf(format string, args ...interface{})

func (*E2ELogger) Infof

func (l *E2ELogger) Infof(format string, args ...interface{})

type GLogger

type GLogger struct{}

func (*GLogger) Errorf

func (l *GLogger) Errorf(format string, args ...interface{})

func (*GLogger) Infof

func (l *GLogger) Infof(format string, args ...interface{})

type IngressConformanceTests

type IngressConformanceTests struct {
	EntryLog string
	Execute  func()
	ExitLog  string
}

IngressConformanceTests contains a closure with an entry and exit log line.

func CreateIngressComformanceTests

func CreateIngressComformanceTests(jig *IngressTestJig, ns string, annotations map[string]string) []IngressConformanceTests

CreateIngressComformanceTests generates an slice of sequential test cases: a simple http ingress, ingress with HTTPS, ingress HTTPS with a modified hostname, ingress https with a modified URLMap

type IngressTestJig

type IngressTestJig struct {
	Client clientset.Interface
	Logger TestLogger

	RootCAs map[string][]byte
	Address string
	Ingress *extensions.Ingress
	// class is the value of the annotation keyed under
	// `kubernetes.io/ingress.class`. It's added to all ingresses created by
	// this jig.
	Class string

	// The interval used to poll urls
	PollInterval time.Duration
}

IngressTestJig holds the relevant state and parameters of the ingress test.

func NewIngressTestJig

func NewIngressTestJig(c clientset.Interface) *IngressTestJig

NewIngressTestJig instantiates struct with client

func (*IngressTestJig) AddHTTPS

func (j *IngressTestJig) AddHTTPS(secretName string, hosts ...string)

AddHTTPS updates the ingress to add this secret for these hosts.

func (*IngressTestJig) ConstructFirewallForIngress

func (j *IngressTestJig) ConstructFirewallForIngress(firewallRuleName string, nodeTags []string) *compute.Firewall

ConstructFirewallForIngress returns the expected GCE firewall rule for the ingress resource

func (*IngressTestJig) CreateIngress

func (j *IngressTestJig) CreateIngress(manifestPath, ns string, ingAnnotations map[string]string, svcAnnotations map[string]string)

CreateIngress creates the Ingress and associated service/rc. Required: ing.yaml, rc.yaml, svc.yaml must exist in manifestPath Optional: secret.yaml, ingAnnotations If ingAnnotations is specified it will overwrite any annotations in ing.yaml If svcAnnotations is specified it will overwrite any annotations in svc.yaml

func (*IngressTestJig) DeleteTestResource

func (j *IngressTestJig) DeleteTestResource(cs clientset.Interface, deploy *extensions.Deployment, svc *v1.Service, ing *extensions.Ingress) []error

DeleteTestResource deletes given deployment, service and ingress.

func (*IngressTestJig) GetDefaultBackendNodePort

func (j *IngressTestJig) GetDefaultBackendNodePort() (int32, error)

func (*IngressTestJig) GetDistinctResponseFromIngress

func (j *IngressTestJig) GetDistinctResponseFromIngress() (sets.String, error)

GetDistinctResponseFromIngress tries GET call to the ingress VIP and return all distinct responses.

func (*IngressTestJig) GetIngressNodePorts

func (j *IngressTestJig) GetIngressNodePorts(includeDefaultBackend bool) []string

GetIngressNodePorts returns related backend services' nodePorts. Current GCE ingress controller allows traffic to the default HTTP backend by default, so retrieve its nodePort if includeDefaultBackend is true.

func (*IngressTestJig) GetRootCA

func (j *IngressTestJig) GetRootCA(secretName string) (rootCA []byte)

GetRootCA returns a rootCA from the ingress test jig.

func (*IngressTestJig) GetServicePorts

func (j *IngressTestJig) GetServicePorts(includeDefaultBackend bool) map[string]v1.ServicePort

GetIngressNodePorts returns related backend services' svcPorts. Current GCE ingress controller allows traffic to the default HTTP backend by default, so retrieve its nodePort if includeDefaultBackend is true.

func (*IngressTestJig) PrepareTLSSecret

func (j *IngressTestJig) PrepareTLSSecret(namespace, secretName string, hosts ...string) error

PrepareTLSSecret creates a TLS secret and caches the cert.

func (*IngressTestJig) RemoveHTTPS

func (j *IngressTestJig) RemoveHTTPS(secretName string)

RemoveHTTPS updates the ingress to not use this secret for TLS. Note: Does not delete the secret.

func (*IngressTestJig) SetHTTPS

func (j *IngressTestJig) SetHTTPS(secretName string, hosts ...string)

SetHTTPS updates the ingress to use only this secret for these hosts.

func (*IngressTestJig) SetUpBacksideHTTPSIngress

func (j *IngressTestJig) SetUpBacksideHTTPSIngress(cs clientset.Interface, namespace string, staticIPName string) (*extensions.Deployment, *v1.Service, *extensions.Ingress, error)

SetUpBacksideHTTPSIngress sets up deployment, service and ingress with backside HTTPS configured.

func (*IngressTestJig) TryDeleteGivenIngress

func (j *IngressTestJig) TryDeleteGivenIngress(ing *extensions.Ingress)

func (*IngressTestJig) TryDeleteGivenService

func (j *IngressTestJig) TryDeleteGivenService(svc *v1.Service)

func (*IngressTestJig) TryDeleteIngress

func (j *IngressTestJig) TryDeleteIngress()

TryDeleteIngress attempts to delete the ingress resource and logs errors if they occur.

func (*IngressTestJig) Update

func (j *IngressTestJig) Update(update func(ing *extensions.Ingress))

Update retrieves the ingress, performs the passed function, and then updates it.

func (*IngressTestJig) VerifyURL

func (j *IngressTestJig) VerifyURL(route, host string, iterations int, interval time.Duration, httpClient *http.Client) error

VerifyURL polls for the given iterations, in intervals, and fails if the given url returns a non-healthy http code even once.

func (*IngressTestJig) WaitForGivenIngressWithTimeout

func (j *IngressTestJig) WaitForGivenIngressWithTimeout(ing *extensions.Ingress, waitForNodePort bool, timeout time.Duration) error

WaitForGivenIngressWithTimeout waits till the ingress acquires an IP, then waits for its hosts/urls to respond to a protocol check (either http or https). If waitForNodePort is true, the NodePort of the Service is verified before verifying the Ingress. NodePort is currently a requirement for cloudprovider Ingress.

func (*IngressTestJig) WaitForIngress

func (j *IngressTestJig) WaitForIngress(waitForNodePort bool)

func (*IngressTestJig) WaitForIngressAddress

func (j *IngressTestJig) WaitForIngressAddress(c clientset.Interface, ns, ingName string, timeout time.Duration) (string, error)

WaitForIngressAddress waits for the Ingress to acquire an address.

func (*IngressTestJig) WaitForIngressWithCert

func (j *IngressTestJig) WaitForIngressWithCert(waitForNodePort bool, knownHosts []string, cert []byte) error

WaitForIngress waits till the ingress acquires an IP, then waits for its hosts/urls to respond to a protocol check (either http or https). If waitForNodePort is true, the NodePort of the Service is verified before verifying the Ingress. NodePort is currently a requirement for cloudprovider Ingress. Hostnames and certificate need to be explicitly passed in.

type NegStatus

type NegStatus struct {
	// NetworkEndpointGroups returns the mapping between service port and NEG
	// resource. key is service port, value is the name of the NEG resource.
	NetworkEndpointGroups map[int32]string `json:"network_endpoint_groups,omitempty"`
	Zones                 []string         `json:"zones,omitempty"`
}

NegStatus contains name and zone of the Network Endpoint Group resources associated with this service. Needs to be consistent with the NEG internal structs in ingress-gce.

type NginxIngressController

type NginxIngressController struct {
	Ns string

	Client clientset.Interface
	// contains filtered or unexported fields
}

NginxIngressController manages implementation details of Ingress on Nginx.

func (*NginxIngressController) Init

func (cont *NginxIngressController) Init()

Init initializes the NginxIngressController

type TestLogger

type TestLogger interface {
	Infof(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Jump to

Keyboard shortcuts

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