Documentation ¶
Index ¶
- Constants
- Variables
- func Backend(name string, port intstr.IntOrString) *v1beta1.IngressBackend
- func CheckEvent(recorder *record.FakeRecorder, expected string, shouldMatch bool) error
- func CreateAndInsertNodes(gce *gce.Cloud, nodeNames []string, zoneName string) ([]*api_v1.Node, error)
- func DecodeIngress(data []byte) (*v1beta1.Ingress, error)
- func Float64ToPtr(val float64) *float64
- func GCEInstanceExists(name string, g *gce.Cloud) (bool, error)
- func GetPrometheusMetric(name string) (*dto.MetricFamily, error)
- func Int64ToPtr(val int64) *int64
- func NewBackendConfig(name types.NamespacedName, spec backendconfig.BackendConfigSpec) *backendconfig.BackendConfig
- func NewIngress(name types.NamespacedName, spec v1beta1.IngressSpec) *v1beta1.Ingress
- func NewL4ILBService(onlyLocal bool, port int) *api_v1.Service
- func NewService(name types.NamespacedName, spec api_v1.ServiceSpec) *api_v1.Service
- type FakeRecorderSource
- type FlagSaver
Constants ¶
const ( FinalizerAddFlag = flag("enable-finalizer-add") FinalizerRemoveFlag = flag("enable-finalizer-remove") EnableV2FrontendNamerFlag = flag("enable-v2-frontend-namer") )
Variables ¶
var ( FrontendConfig = &frontendconfigv1beta1.FrontendConfig{ ObjectMeta: meta_v1.ObjectMeta{ Name: "config-test", Namespace: "test", }, } IngressWithoutFrontendConfig = &v1beta1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "ing-no-config", Namespace: "test", }, } IngressWithFrontendConfig = &v1beta1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "ing-with-config", Namespace: "test", Annotations: map[string]string{ annotations.FrontendConfigKey: "config-test", }, }, } IngressWithFrontendConfigOtherNamespace = &v1beta1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "ing-with-config", Namespace: "other-namespace", Annotations: map[string]string{ annotations.FrontendConfigKey: "config-test", }, }, } IngressWithOtherFrontendConfig = &v1beta1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "ing-with-config", Namespace: "test", Annotations: map[string]string{ annotations.FrontendConfigKey: "other-config", }, }, } )
The below vars are used for sharing unit testing types with multiple packages.
var ( BackendPort = intstr.IntOrString{Type: intstr.Int, IntVal: 80} DefaultBeSvcPort = utils.ServicePort{ ID: utils.ServicePortID{Service: types.NamespacedName{Namespace: "system", Name: "default"}, Port: BackendPort}, NodePort: 30000, Protocol: annotations.ProtocolHTTP, } )
Functions ¶
func Backend ¶
func Backend(name string, port intstr.IntOrString) *v1beta1.IngressBackend
Backend returns an IngressBackend with the given service name/port.
func CheckEvent ¶ added in v1.9.0
func CheckEvent(recorder *record.FakeRecorder, expected string, shouldMatch bool) error
CheckEvent watches for events in the given FakeRecorder and checks if it matches the given string. It will be used in the l4 firewall XPN tests once TestEnsureLoadBalancerDeletedSucceedsOnXPN and others are uncommented.
func CreateAndInsertNodes ¶ added in v1.9.0
func CreateAndInsertNodes(gce *gce.Cloud, nodeNames []string, zoneName string) ([]*api_v1.Node, error)
CreateAndInsertNodes adds the given nodeNames in the given zone as GCE instances, so they can be looked up in tests.
func DecodeIngress ¶
DecodeIngress deserializes an Ingress object.
func Float64ToPtr ¶ added in v1.9.1
Float64ToPtr returns float ptr for given float.
func GCEInstanceExists ¶ added in v1.9.0
GCEInstanceExists returns if a given instance name exists.
func GetPrometheusMetric ¶ added in v1.10.12
func GetPrometheusMetric(name string) (*dto.MetricFamily, error)
func Int64ToPtr ¶ added in v1.10.0
Int64ToPtr returns int ptr for given int.
func NewBackendConfig ¶
func NewBackendConfig(name types.NamespacedName, spec backendconfig.BackendConfigSpec) *backendconfig.BackendConfig
NewBackendConfig returns a BackendConfig with the given spec.
func NewIngress ¶
func NewIngress(name types.NamespacedName, spec v1beta1.IngressSpec) *v1beta1.Ingress
NewIngress returns an Ingress with the given spec.
func NewL4ILBService ¶ added in v1.9.0
NewL4ILBService creates a Service of type LoadBalancer with the Internal annotation.
func NewService ¶
func NewService(name types.NamespacedName, spec api_v1.ServiceSpec) *api_v1.Service
NewService returns a Service with the given spec.
Types ¶
type FakeRecorderSource ¶ added in v1.10.0
type FakeRecorderSource struct{}
func (*FakeRecorderSource) Recorder ¶ added in v1.10.0
func (_ *FakeRecorderSource) Recorder(ns string) record.EventRecorder
type FlagSaver ¶ added in v1.8.0
type FlagSaver struct {
// contains filtered or unexported fields
}
FlagSaver is an utility type to capture the value of a flag and reset back to the saved value.
func NewFlagSaver ¶ added in v1.8.0
func NewFlagSaver() FlagSaver
NewFlagSaver returns a flag saver by initializing the map.