Documentation ¶
Index ¶
- Constants
- Variables
- func AddInstancesErrorHook(context.Context, *meta.Key, *compute.InstanceGroupsAddInstancesRequest, ...) error
- func Backend(name string, port networkingv1.ServiceBackendPort) *networkingv1.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) (*networkingv1.Ingress, error)
- func DeleteAddressErrorHook(ctx context.Context, key *meta.Key, m *cloud.MockAddresses, ...) (bool, error)
- func DeleteBackendServicesErrorHook(ctx context.Context, key *meta.Key, m *cloud.MockRegionBackendServices, ...) (bool, error)
- func DeleteFirewallsErrorHook(ctx context.Context, key *meta.Key, m *cloud.MockFirewalls, ...) (bool, error)
- func DeleteForwardingRulesErrorHook(ctx context.Context, key *meta.Key, m *cloud.MockForwardingRules, ...) (bool, error)
- func DeleteHealthCheckErrorHook(ctx context.Context, key *meta.Key, m *cloud.MockRegionHealthChecks, ...) (bool, error)
- func DeleteHealthCheckResourceInUseErrorHook(ctx context.Context, key *meta.Key, m *cloud.MockHealthChecks, ...) (bool, error)
- func DeleteRegionalHealthCheckResourceInUseErrorHook(ctx context.Context, key *meta.Key, m *cloud.MockRegionHealthChecks, ...) (bool, error)
- func FakeGoogleAPIConflictErr() *googleapi.Error
- func FakeGoogleAPIForbiddenErr() *googleapi.Error
- func FakeGoogleAPINotFoundErr() *googleapi.Error
- func FakeGoogleAPIRequestEntityTooLargeError() *googleapi.Error
- func FakeGoogleAPIRequestServerError() *googleapi.Error
- func Float64ToPtr(val float64) *float64
- func GCEInstanceExists(name string, g *gce.Cloud) (bool, error)
- func GetErrorInstanceGroupHook(ctx context.Context, key *meta.Key, m *cloud.MockInstanceGroups, ...) (bool, *compute.InstanceGroup, error)
- func GetLegacyForwardingRule(ctx context.Context, key *meta.Key, m *cloud.MockForwardingRules, ...) (bool, *compute.ForwardingRule, error)
- func GetRBSForwardingRule(ctx context.Context, key *meta.Key, m *cloud.MockForwardingRules, ...) (bool, *compute.ForwardingRule, error)
- func GetRBSForwardingRuleInStandardTier(ctx context.Context, key *meta.Key, m *cloud.MockForwardingRules, ...) (bool, *compute.ForwardingRule, error)
- func InsertAddressErrorHook(ctx context.Context, key *meta.Key, obj *compute.Address, ...) (bool, error)
- func InsertAddressNetworkErrorHook(ctx context.Context, key *meta.Key, obj *compute.Address, ...) (bool, error)
- func InsertAddressNotAllocatedToProjectErrorHook(ctx context.Context, key *meta.Key, obj *compute.Address, ...) (bool, error)
- func InsertErrorHook(ctx context.Context, key *meta.Key, obj *compute.InstanceGroup, ...) (bool, error)
- func InsertForwardingRuleErrorHook(err error) ...
- func InsertForwardingRuleHook(ctx context.Context, key *meta.Key, obj *compute.ForwardingRule, ...) (b bool, e error)
- func InstancesListToNameSet(instancesList []*compute.InstanceWithNamedPorts) (sets.String, error)
- func Int64ToPtr(val int64) *int64
- func ListErrorHook(ctx context.Context, zone string, fl *filter.F, m *cloud.MockInstanceGroups, ...) (bool, []*compute.InstanceGroup, error)
- func ListInstancesWithErrorHook(context.Context, *meta.Key, *compute.InstanceGroupsListInstancesRequest, ...) ([]*compute.InstanceWithNamedPorts, error)
- func MustCreateDualStackClusterSubnet(t *testing.T, gcecloud *gce.Cloud, ipv6AccessType string)
- func MustCreateDualStackSubnet(t *testing.T, gcecloud *gce.Cloud, subnetName, ipv6AccessType string)
- func NewBackendConfig(name types.NamespacedName, spec backendconfig.BackendConfigSpec) *backendconfig.BackendConfig
- func NewIngress(name types.NamespacedName, spec networkingv1.IngressSpec) *networkingv1.Ingress
- func NewL4ILBDualStackService(port int, protocol api_v1.Protocol, ipFamilies []api_v1.IPFamily, ...) *api_v1.Service
- func NewL4ILBService(onlyLocal bool, port int) *api_v1.Service
- func NewL4LegacyNetLBService(port int, nodePort int32) *api_v1.Service
- func NewL4LegacyNetLBServiceWithoutPorts() *api_v1.Service
- func NewL4NetLBRBSDualStackService(protocol api_v1.Protocol, ipFamilies []api_v1.IPFamily, ...) *api_v1.Service
- func NewL4NetLBRBSService(port int) *api_v1.Service
- func NewL4NetLBRBSServiceMultiplePorts(name string, ports []int32) *api_v1.Service
- func NewService(name types.NamespacedName, spec api_v1.ServiceSpec) *api_v1.Service
- func NewSvcNeg(name types.NamespacedName, status negv1beta1.ServiceNetworkEndpointGroupStatus) *negv1beta1.ServiceNetworkEndpointGroup
- func SetNamedPortsErrorHook(context.Context, *meta.Key, *compute.InstanceGroupsSetNamedPortsRequest, ...) error
- func UpdateRegionBackendServiceWithErrorHookUpdate(context.Context, *meta.Key, *compute.BackendService, ...) error
- type FakeRecorderSource
- type FlagSaver
- type L4LBErrorMetricInfo
- type L4LBLatencyMetricInfo
Constants ¶
const ( FinalizerAddFlag = flag("enable-finalizer-add") FinalizerRemoveFlag = flag("enable-finalizer-remove") EnableV2FrontendNamerFlag = flag("enable-v2-frontend-namer") )
const (
FwIPAddress = "10.0.0.1"
)
Variables ¶
var ( FrontendConfig = &frontendconfigv1beta1.FrontendConfig{ ObjectMeta: meta_v1.ObjectMeta{ Name: "config-test", Namespace: "test", }, } IngressWithoutFrontendConfig = &v1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "ing-no-config", Namespace: "test", }, } IngressWithFrontendConfig = &v1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "ing-with-config", Namespace: "test", Annotations: map[string]string{ annotations.FrontendConfigKey: "config-test", }, }, } IngressWithFrontendConfigOtherNamespace = &v1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "ing-with-config", Namespace: "other-namespace", Annotations: map[string]string{ annotations.FrontendConfigKey: "config-test", }, }, } IngressWithOtherFrontendConfig = &v1.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 = networkingv1.ServiceBackendPort{Number: 80} DefaultBeSvcPort = utils.ServicePort{ ID: utils.ServicePortID{Service: types.NamespacedName{Namespace: "system", Name: "default"}, Port: BackendPort}, NodePort: 30000, Protocol: annotations.ProtocolHTTP, } )
Functions ¶
func AddInstancesErrorHook ¶ added in v1.15.0
func Backend ¶
func Backend(name string, port networkingv1.ServiceBackendPort) *networkingv1.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 ¶
func DecodeIngress(data []byte) (*networkingv1.Ingress, error)
DecodeIngress deserializes an Ingress object.
func DeleteAddressErrorHook ¶ added in v1.15.0
func DeleteBackendServicesErrorHook ¶ added in v1.15.0
func DeleteFirewallsErrorHook ¶ added in v1.15.0
func DeleteForwardingRulesErrorHook ¶ added in v1.15.0
func DeleteHealthCheckErrorHook ¶ added in v1.15.0
func DeleteHealthCheckResourceInUseErrorHook ¶ added in v1.15.0
func DeleteRegionalHealthCheckResourceInUseErrorHook ¶ added in v1.15.0
func FakeGoogleAPIConflictErr ¶ added in v1.16.0
FakeGoogleAPIConflictErr creates a StatusConflict error with type googleapi.Error
func FakeGoogleAPIForbiddenErr ¶ added in v1.16.0
FakeGoogleAPIForbiddenErr creates a Forbidden error with type googleapi.Error
func FakeGoogleAPINotFoundErr ¶ added in v1.16.0
FakeGoogleAPINotFoundErr creates a NotFound error with type googleapi.Error
func FakeGoogleAPIRequestEntityTooLargeError ¶ added in v1.17.0
FakeGoogleAPIRequestEntityTooLargeError creates a StatusRequestEntityTooLarge error with type googleapi.Error
func FakeGoogleAPIRequestServerError ¶ added in v1.30.0
FakeGoogleAPIRequestServerError creates a StatusInternalServerError error with type googleapi.Error
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 GetErrorInstanceGroupHook ¶ added in v1.15.0
func GetLegacyForwardingRule ¶ added in v1.15.0
func GetRBSForwardingRule ¶ added in v1.16.0
func GetRBSForwardingRuleInStandardTier ¶ added in v1.17.0
func InsertAddressErrorHook ¶ added in v1.15.0
func InsertAddressNetworkErrorHook ¶ added in v1.17.0
func InsertAddressNotAllocatedToProjectErrorHook ¶ added in v1.20.3
func InsertErrorHook ¶ added in v1.15.0
func InsertForwardingRuleErrorHook ¶ added in v1.20.3
func InsertForwardingRuleHook ¶ added in v1.15.0
func InstancesListToNameSet ¶ added in v1.16.0
func Int64ToPtr ¶ added in v1.10.0
Int64ToPtr returns int ptr for given int.
func ListErrorHook ¶ added in v1.15.0
func ListInstancesWithErrorHook ¶ added in v1.15.0
func MustCreateDualStackClusterSubnet ¶ added in v1.25.0
func MustCreateDualStackSubnet ¶ added in v1.25.0
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 networkingv1.IngressSpec) *networkingv1.Ingress
NewIngress returns an Ingress with the given spec.
func NewL4ILBDualStackService ¶ added in v1.21.0
func NewL4ILBDualStackService(port int, protocol api_v1.Protocol, ipFamilies []api_v1.IPFamily, externalTrafficPolicy api_v1.ServiceExternalTrafficPolicyType) *api_v1.Service
NewL4ILBDualStackService creates a Service of type LoadBalancer with the Internal annotation and provided ipFamilies and ipFamilyPolicy
func NewL4ILBService ¶ added in v1.9.0
NewL4ILBService creates a Service of type LoadBalancer with the Internal annotation.
func NewL4LegacyNetLBService ¶ added in v1.16.0
NewL4LegacyNetLBService creates a Legacy Service of type LoadBalancer without the RBS Annotation
func NewL4LegacyNetLBServiceWithoutPorts ¶ added in v1.16.0
func NewL4NetLBRBSDualStackService ¶ added in v1.22.0
func NewL4NetLBRBSDualStackService(protocol api_v1.Protocol, ipFamilies []api_v1.IPFamily, externalTrafficPolicy api_v1.ServiceExternalTrafficPolicyType) *api_v1.Service
NewL4NetLBRBSDualStackService creates a Service of type LoadBalancer with RBS Annotation and provided ipFamilies and ipFamilyPolicy
func NewL4NetLBRBSService ¶ added in v1.16.0
NewL4NetLBRBSService creates a Service of type LoadBalancer with RBS Annotation
func NewL4NetLBRBSServiceMultiplePorts ¶ added in v1.16.0
NewL4NetLBRBSServiceMultiplePorts creates a Service of type LoadBalancer with multiple named ports.
func NewService ¶
func NewService(name types.NamespacedName, spec api_v1.ServiceSpec) *api_v1.Service
NewService returns a Service with the given spec.
func NewSvcNeg ¶ added in v1.32.0
func NewSvcNeg(name types.NamespacedName, status negv1beta1.ServiceNetworkEndpointGroupStatus) *negv1beta1.ServiceNetworkEndpointGroup
NewService returns a SvcNeg with the given spec.
func SetNamedPortsErrorHook ¶ added in v1.15.0
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.
type L4LBErrorMetricInfo ¶ added in v1.16.0
L4LBErrorMetricInfo holds the state of the sync_error_count metric for ILB or NetLB.
func GetL4ILBErrorMetric ¶ added in v1.11.2
func GetL4ILBErrorMetric() (*L4LBErrorMetricInfo, error)
GetL4ILBErrorMetric gets the current state of the l4_ilb_sync_error_count.
func GetL4NetLBErrorMetric ¶ added in v1.16.0
func GetL4NetLBErrorMetric() (*L4LBErrorMetricInfo, error)
GetL4NetLBErrorMetric gets the current state of the l4_netlb_sync_error_count.
func (*L4LBErrorMetricInfo) ValidateDiff ¶ added in v1.16.0
func (old *L4LBErrorMetricInfo) ValidateDiff(new, expect *L4LBErrorMetricInfo, t *testing.T)
ValidateDiff ensures that the diff between the old and the new metric is as expected. The test uses diff rather than absolute values since the metrics are cumulative of all test cases.
type L4LBLatencyMetricInfo ¶ added in v1.16.0
type L4LBLatencyMetricInfo struct { CreateCount uint64 DeleteCount uint64 UpdateCount uint64 UpperBoundSeconds float64 // contains filtered or unexported fields }
L4LatencyMetricInfo holds the state of the sync_duration_seconds metric for ILB or NetLB.
func GetL4ILBLatencyMetric ¶ added in v1.16.0
func GetL4ILBLatencyMetric() (*L4LBLatencyMetricInfo, error)
GetL4ILBLatencyMetric gets the current state of the l4_ilb_sync_duration_seconds metric.
func GetL4NetLBLatencyMetric ¶ added in v1.16.0
func GetL4NetLBLatencyMetric() (*L4LBLatencyMetricInfo, error)
GetL4NetLBLatencyMetric gets the current state of the l4_netlb_sync_duration_seconds metric.
func (*L4LBLatencyMetricInfo) ValidateDiff ¶ added in v1.16.0
func (old *L4LBLatencyMetricInfo) ValidateDiff(new, expect *L4LBLatencyMetricInfo, t *testing.T)
ValidateDiff ensures that the diff between the old and the new metric is as expected. The test uses diff rather than absolute values since the metrics are cumulative of all test cases.