Documentation ¶
Index ¶
- Constants
- func MockAggregatedListNetworkEndpointGroupHook(ctx context.Context, fl *filter.F, m *cloud.MockNetworkEndpointGroups) (bool, map[string][]*compute.NetworkEndpointGroup, error)
- func MockAttachNetworkEndpointsHook(ctx context.Context, key *meta.Key, ...) error
- func MockDetachNetworkEndpointsHook(ctx context.Context, key *meta.Key, ...) error
- func MockListNetworkEndpointsHook(ctx context.Context, key *meta.Key, ...) ([]*compute.NetworkEndpointWithHealthStatus, error)
- func MockNetworkEndpointAPIs(fakeGCE *gce.Cloud)
- func NodePredicateForEndpointCalculatorMode(mode EndpointsCalculatorMode) utils.NodeConditionPredicate
- type AddressData
- type EndpointPodMap
- type EndpointsCalculatorMode
- type EndpointsData
- type FakeNetworkEndpointGroupCloud
- func (f *FakeNetworkEndpointGroupCloud) AggregatedListNetworkEndpointGroup(version meta.Version) (map[*meta.Key]*composite.NetworkEndpointGroup, error)
- func (f *FakeNetworkEndpointGroupCloud) AttachNetworkEndpoints(name, zone string, endpoints []*composite.NetworkEndpoint, ...) error
- func (f *FakeNetworkEndpointGroupCloud) CreateNetworkEndpointGroup(neg *composite.NetworkEndpointGroup, zone string) error
- func (f *FakeNetworkEndpointGroupCloud) DeleteNetworkEndpointGroup(name string, zone string, version meta.Version) error
- func (f *FakeNetworkEndpointGroupCloud) DetachNetworkEndpoints(name, zone string, endpoints []*composite.NetworkEndpoint, ...) error
- func (f *FakeNetworkEndpointGroupCloud) GetNetworkEndpointGroup(name string, zone string, version meta.Version) (*composite.NetworkEndpointGroup, error)
- func (f *FakeNetworkEndpointGroupCloud) ListNetworkEndpointGroup(zone string, version meta.Version) ([]*composite.NetworkEndpointGroup, error)
- func (f *FakeNetworkEndpointGroupCloud) ListNetworkEndpoints(name, zone string, showHealthStatus bool, version meta.Version) ([]*composite.NetworkEndpointWithHealthStatus, error)
- func (f *FakeNetworkEndpointGroupCloud) NetworkURL() string
- func (f *FakeNetworkEndpointGroupCloud) SubnetworkURL() string
- type FakeZoneGetter
- type NegSyncer
- type NegSyncerKey
- type NegSyncerManager
- type NetworkEndpoint
- type NetworkEndpointEntry
- type NetworkEndpointGroupCloud
- type NetworkEndpointGroupNamer
- type NetworkEndpointSet
- func (s NetworkEndpointSet) Delete(items ...NetworkEndpoint)
- func (s NetworkEndpointSet) Difference(s2 NetworkEndpointSet) NetworkEndpointSet
- func (s1 NetworkEndpointSet) Equal(s2 NetworkEndpointSet) bool
- func (s NetworkEndpointSet) Has(item NetworkEndpoint) bool
- func (s NetworkEndpointSet) HasAll(items ...NetworkEndpoint) bool
- func (s NetworkEndpointSet) HasAny(items ...NetworkEndpoint) bool
- func (s NetworkEndpointSet) Insert(items ...NetworkEndpoint)
- func (s1 NetworkEndpointSet) Intersection(s2 NetworkEndpointSet) NetworkEndpointSet
- func (s1 NetworkEndpointSet) IsSuperset(s2 NetworkEndpointSet) bool
- func (s NetworkEndpointSet) Len() int
- func (s NetworkEndpointSet) List() []NetworkEndpoint
- func (s NetworkEndpointSet) PopAny() (NetworkEndpoint, bool)
- func (s1 NetworkEndpointSet) Union(s2 NetworkEndpointSet) NetworkEndpointSet
- type NetworkEndpointStore
- type NetworkEndpointType
- type NetworkEndpointsCalculator
- type PortData
- type PortInfo
- type PortInfoMap
- func NewPortInfoMap(namespace, name string, svcPortTupleSet SvcPortTupleSet, ...) PortInfoMap
- func NewPortInfoMapForVMIPNEG(namespace, name string, namer namer.L4ResourcesNamer, local bool) PortInfoMap
- func NewPortInfoMapWithDestinationRule(namespace, name string, svcPortTupleSet SvcPortTupleSet, ...) (PortInfoMap, error)
- func (p1 PortInfoMap) Difference(p2 PortInfoMap) PortInfoMap
- func (p1 PortInfoMap) EndpointsCalculatorMode() EndpointsCalculatorMode
- func (p1 PortInfoMap) Merge(p2 PortInfoMap) error
- func (p1 PortInfoMap) NegsWithReadinessGate() sets.String
- func (p1 PortInfoMap) ToPortNegMap() annotations.PortNegMap
- func (p1 PortInfoMap) ToPortSubsetNegMap() annotations.PortSubsetNegMap
- type PortInfoMapKey
- type SvcPortTuple
- type SvcPortTupleSet
- type TestContext
- type ZoneGetter
Constants ¶
const ( TestZone1 = "zone1" TestZone2 = "zone2" TestZone3 = "zone3" TestZone4 = "zone4" TestInstance1 = "instance1" TestInstance2 = "instance2" TestInstance3 = "instance3" TestInstance4 = "instance4" TestInstance5 = "instance5" TestInstance6 = "instance6" TestUnreadyInstance1 = "unready-instance1" TestUnreadyInstance2 = "unready-instance2" TestUpgradeInstance1 = "upgrade-instance1" TestUpgradeInstance2 = "upgrade-instance2" )
const ( VmIpPortEndpointType = NetworkEndpointType("GCE_VM_IP_PORT") VmIpEndpointType = NetworkEndpointType("GCE_VM_IP") NonGCPPrivateEndpointType = NetworkEndpointType("NON_GCP_PRIVATE_IP_PORT") L7Mode = EndpointsCalculatorMode("L7") L4LocalMode = EndpointsCalculatorMode("L4, ExternalTrafficPolicy:Local") L4ClusterMode = EndpointsCalculatorMode("L4, ExternalTrafficPolicy:Cluster") NegCRManagedByKey = "networking.gke.io/managed-by" NegCRServiceNameKey = "networking.gke.io/service-name" NegCRServicePortKey = "networking.gke.io/service-port" // NegCRControllerValue is used as the value for the managed-by label on NEG CRs when enabled. NegCRControllerValue = "neg-controller" // NEG CR Condition Reasons NegSyncSuccessful = "NegSyncSuccessful" NegSyncFailed = "NegSyncFailed" NegInitializationSuccessful = "NegInitializationSuccessful" NegInitializationFailed = "NegInitializationFailed" // NEG CRD Enabled Garbage Collection Event Reasons NegGCError = "NegCRError" )
Variables ¶
This section is empty.
Functions ¶
func MockAggregatedListNetworkEndpointGroupHook ¶ added in v1.7.0
func MockAggregatedListNetworkEndpointGroupHook(ctx context.Context, fl *filter.F, m *cloud.MockNetworkEndpointGroups) (bool, map[string][]*compute.NetworkEndpointGroup, error)
TODO: move this logic into code gen TODO: make AggregateList return map[meta.Key]Object
func MockAttachNetworkEndpointsHook ¶ added in v1.5.0
func MockDetachNetworkEndpointsHook ¶ added in v1.5.0
func MockListNetworkEndpointsHook ¶ added in v1.5.0
func MockNetworkEndpointAPIs ¶ added in v1.5.0
func NodePredicateForEndpointCalculatorMode ¶ added in v1.14.0
func NodePredicateForEndpointCalculatorMode(mode EndpointsCalculatorMode) utils.NodeConditionPredicate
NodePredicateForEndpointCalculatorMode returns the predicate function to select candidate nodes, given the endpoints calculator mode.
Types ¶
type AddressData ¶ added in v1.14.0
type AddressData struct { TargetRef *apiv1.ObjectReference NodeName *string Addresses []string Ready bool }
type EndpointPodMap ¶ added in v1.6.0
type EndpointPodMap map[NetworkEndpoint]types.NamespacedName
EndpointPodMap is a map from network endpoint to a namespaced name of a pod
type EndpointsCalculatorMode ¶ added in v1.9.0
type EndpointsCalculatorMode string
type EndpointsData ¶ added in v1.14.0
type EndpointsData struct { Meta *metav1.ObjectMeta Ports []PortData // Addresses contains both ready and not ready addresses even when it is converted from Endpoints. Addresses []AddressData }
Abstraction over Endpoints and EndpointSlices. It contains all the information needed to set up GCP Load Balancer.
func EndpointsDataFromEndpointSlices ¶ added in v1.14.0
func EndpointsDataFromEndpointSlices(slices []*discovery.EndpointSlice) []EndpointsData
Converts API EndpointSlice list to the EndpointsData abstraction. Terminating endpoints are ignored.
func EndpointsDataFromEndpoints ¶ added in v1.14.0
func EndpointsDataFromEndpoints(ep *apiv1.Endpoints) []EndpointsData
Converts API Endpoints to the EndpointsData abstraction. All endpoints are converted, not ready addresses are converted with Ready=false.
type FakeNetworkEndpointGroupCloud ¶
type FakeNetworkEndpointGroupCloud struct { NetworkEndpointGroups map[string][]*composite.NetworkEndpointGroup NetworkEndpoints map[string][]*composite.NetworkEndpoint Subnetwork string Network string // contains filtered or unexported fields }
func (*FakeNetworkEndpointGroupCloud) AggregatedListNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) AggregatedListNetworkEndpointGroup(version meta.Version) (map[*meta.Key]*composite.NetworkEndpointGroup, error)
func (*FakeNetworkEndpointGroupCloud) AttachNetworkEndpoints ¶
func (f *FakeNetworkEndpointGroupCloud) AttachNetworkEndpoints(name, zone string, endpoints []*composite.NetworkEndpoint, version meta.Version) error
func (*FakeNetworkEndpointGroupCloud) CreateNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) CreateNetworkEndpointGroup(neg *composite.NetworkEndpointGroup, zone string) error
func (*FakeNetworkEndpointGroupCloud) DeleteNetworkEndpointGroup ¶
func (*FakeNetworkEndpointGroupCloud) DetachNetworkEndpoints ¶
func (f *FakeNetworkEndpointGroupCloud) DetachNetworkEndpoints(name, zone string, endpoints []*composite.NetworkEndpoint, version meta.Version) error
func (*FakeNetworkEndpointGroupCloud) GetNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) GetNetworkEndpointGroup(name string, zone string, version meta.Version) (*composite.NetworkEndpointGroup, error)
func (*FakeNetworkEndpointGroupCloud) ListNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) ListNetworkEndpointGroup(zone string, version meta.Version) ([]*composite.NetworkEndpointGroup, error)
func (*FakeNetworkEndpointGroupCloud) ListNetworkEndpoints ¶
func (f *FakeNetworkEndpointGroupCloud) ListNetworkEndpoints(name, zone string, showHealthStatus bool, version meta.Version) ([]*composite.NetworkEndpointWithHealthStatus, error)
func (*FakeNetworkEndpointGroupCloud) NetworkURL ¶
func (f *FakeNetworkEndpointGroupCloud) NetworkURL() string
func (*FakeNetworkEndpointGroupCloud) SubnetworkURL ¶
func (f *FakeNetworkEndpointGroupCloud) SubnetworkURL() string
type FakeZoneGetter ¶ added in v1.11.10
type FakeZoneGetter struct {
// contains filtered or unexported fields
}
func NewFakeZoneGetter ¶
func NewFakeZoneGetter() *FakeZoneGetter
func (*FakeZoneGetter) AddZone ¶ added in v1.11.10
func (f *FakeZoneGetter) AddZone(newZone string, instances ...string) error
Adds a zone with the given instances to the zone getter
func (*FakeZoneGetter) DeleteZone ¶ added in v1.11.10
func (f *FakeZoneGetter) DeleteZone(newZone string)
Deletes a zone in the zoneInstanceMap
func (*FakeZoneGetter) GetZoneForNode ¶ added in v1.11.10
func (f *FakeZoneGetter) GetZoneForNode(name string) (string, error)
func (*FakeZoneGetter) ListZones ¶ added in v1.11.10
func (f *FakeZoneGetter) ListZones(predicate utils.NodeConditionPredicate) ([]string, error)
type NegSyncer ¶
type NegSyncer interface { // Start starts the syncer. This call is synchronous. It will return after syncer is started. Start() error // Stop stops the syncer. This call is asynchronous. It will not block until syncer is stopped. Stop() // Sync signals the syncer to sync NEG. This call is asynchronous. Syncer will sync once it becomes idle. Sync() bool // IsStopped returns true if syncer is stopped IsStopped() bool // IsShuttingDown returns true if syncer is shutting down IsShuttingDown() bool }
NegSyncer is an interface to interact with syncer
type NegSyncerKey ¶ added in v1.6.0
type NegSyncerKey struct { // Namespace of service Namespace string // Name of service Name string // Name of neg NegName string // PortTuple is the port tuple of the service backing the NEG PortTuple SvcPortTuple // Subset name, subset is defined in Istio:DestinationRule, this is only used // when --enable-csm=true. Subset string // Subset label, should set together with Subset. SubsetLabels string // NegType is the type of the network endpoints in this NEG. NegType NetworkEndpointType // EpCalculatorMode indicates how the endpoints for the NEG are determined. // GCE_VM_IP_PORT NEGs get L7Mode or "". // In case of GCE_VM_IP NEGs: // The endpoints are nodes selected at random in case of Cluster trafficPolicy(L4ClusterMode). // The endpoints are nodes running backends of this service in case of Local trafficPolicy(L4LocalMode). EpCalculatorMode EndpointsCalculatorMode }
NegSyncerKey includes information to uniquely identify a NEG syncer
func (NegSyncerKey) GetAPIVersion ¶ added in v1.8.0
func (key NegSyncerKey) GetAPIVersion() meta.Version
GetAPIVersion returns the compute API version to be used in order to create the negType specified in the given NegSyncerKey.
func (NegSyncerKey) String ¶ added in v1.6.0
func (key NegSyncerKey) String() string
type NegSyncerManager ¶
type NegSyncerManager interface { // EnsureSyncer ensures corresponding syncers are started and stops any unnecessary syncer // portMap is a map of ServicePort Port to TargetPort. Returns counts of successful Neg syncers // and failed Neg sycner creations EnsureSyncers(namespace, name string, portMap PortInfoMap) (int, int, error) // StopSyncer stops all syncers related to the service. This call is asynchronous. It will not wait for all syncers to stop. StopSyncer(namespace, name string) // Sync signals all syncers related to the service to sync. This call is asynchronous. Sync(namespace, name string) // SyncNodes signals all syncers watching nodes to sync. This call is asynchronous. SyncNodes() // GC garbage collects network endpoint group and syncers GC() error // ShutDown shuts down the manager ShutDown() }
NegSyncerManager is an interface for controllers to manage syncer
type NetworkEndpoint ¶ added in v1.6.0
NetworkEndpoint contains the essential information for each network endpoint in a NEG
type NetworkEndpointEntry ¶ added in v1.5.0
type NetworkEndpointEntry struct { NetworkEndpoint *composite.NetworkEndpoint Healths []*composite.HealthStatusForNetworkEndpoint }
type NetworkEndpointGroupCloud ¶
type NetworkEndpointGroupCloud interface { GetNetworkEndpointGroup(name string, zone string, version meta.Version) (*composite.NetworkEndpointGroup, error) ListNetworkEndpointGroup(zone string, version meta.Version) ([]*composite.NetworkEndpointGroup, error) AggregatedListNetworkEndpointGroup(version meta.Version) (map[*meta.Key]*composite.NetworkEndpointGroup, error) CreateNetworkEndpointGroup(neg *composite.NetworkEndpointGroup, zone string) error DeleteNetworkEndpointGroup(name string, zone string, version meta.Version) error AttachNetworkEndpoints(name, zone string, endpoints []*composite.NetworkEndpoint, version meta.Version) error DetachNetworkEndpoints(name, zone string, endpoints []*composite.NetworkEndpoint, version meta.Version) error ListNetworkEndpoints(name, zone string, showHealthStatus bool, version meta.Version) ([]*composite.NetworkEndpointWithHealthStatus, error) NetworkURL() string SubnetworkURL() string }
NetworkEndpointGroupCloud is an interface for managing gce network endpoint group.
func NewAdapter ¶ added in v1.6.0
func NewAdapter(g *gce.Cloud) NetworkEndpointGroupCloud
NewAdapter takes a Cloud and returns a NetworkEndpointGroupCloud.
func NewAdapterWithNetwork ¶ added in v1.10.8
func NewAdapterWithNetwork(g *gce.Cloud, network, subnetwork string) NetworkEndpointGroupCloud
func NewFakeNetworkEndpointGroupCloud ¶
func NewFakeNetworkEndpointGroupCloud(subnetwork, network string) NetworkEndpointGroupCloud
DEPRECATED: Please do not use this mock function. Use the pkg/neg/types/mock.go instead.
type NetworkEndpointGroupNamer ¶
type NetworkEndpointGroupNamer interface { NEG(namespace, name string, port int32) string NEGWithSubset(namespace, name, subset string, port int32) string IsNEG(name string) bool }
NetworkEndpointGroupNamer is an interface for generating network endpoint group name.
type NetworkEndpointSet ¶ added in v1.6.0
type NetworkEndpointSet map[NetworkEndpoint]struct{}
NetworkEndpointSet is a set of NetworkEndpoints, implemented via map[NetworkEndpoint]struct{} for minimal memory consumption.
func NetworkEndpointSetKeySet ¶ added in v1.6.0
func NetworkEndpointSetKeySet(theMap interface{}) NetworkEndpointSet
NetworkEndpointSetKeySet creates a NetworkEndpointSet from a keys of a map[NetworkEndpoint](? extends interface{}). If the value passed in is not actually a map, this will panic.
func NewNetworkEndpointSet ¶ added in v1.6.0
func NewNetworkEndpointSet(items ...NetworkEndpoint) NetworkEndpointSet
NewNetworkEndpointSet creates a NetworkEndpointSet from a list of values.
func (NetworkEndpointSet) Delete ¶ added in v1.6.0
func (s NetworkEndpointSet) Delete(items ...NetworkEndpoint)
Delete removes all items from the set.
func (NetworkEndpointSet) Difference ¶ added in v1.6.0
func (s NetworkEndpointSet) Difference(s2 NetworkEndpointSet) NetworkEndpointSet
Difference returns a set of objects that are not in s2 For example: s1 = {a1, a2, a3} s2 = {a1, a2, a4, a5} s1.Difference(s2) = {a3} s2.Difference(s1) = {a4, a5}
func (NetworkEndpointSet) Equal ¶ added in v1.6.0
func (s1 NetworkEndpointSet) Equal(s2 NetworkEndpointSet) bool
Equal returns true if and only if s1 is equal (as a set) to s2. Two sets are equal if their membership is identical. (In practice, this means same elements, order doesn't matter)
func (NetworkEndpointSet) Has ¶ added in v1.6.0
func (s NetworkEndpointSet) Has(item NetworkEndpoint) bool
Has returns true if and only if item is contained in the set.
func (NetworkEndpointSet) HasAll ¶ added in v1.6.0
func (s NetworkEndpointSet) HasAll(items ...NetworkEndpoint) bool
HasAll returns true if and only if all items are contained in the set.
func (NetworkEndpointSet) HasAny ¶ added in v1.6.0
func (s NetworkEndpointSet) HasAny(items ...NetworkEndpoint) bool
HasAny returns true if any items are contained in the set.
func (NetworkEndpointSet) Insert ¶ added in v1.6.0
func (s NetworkEndpointSet) Insert(items ...NetworkEndpoint)
Insert adds items to the set.
func (NetworkEndpointSet) Intersection ¶ added in v1.6.0
func (s1 NetworkEndpointSet) Intersection(s2 NetworkEndpointSet) NetworkEndpointSet
Intersection returns a new set which includes the item in BOTH s1 and s2 For example: s1 = {a1, a2} s2 = {a2, a3} s1.Intersection(s2) = {a2}
func (NetworkEndpointSet) IsSuperset ¶ added in v1.6.0
func (s1 NetworkEndpointSet) IsSuperset(s2 NetworkEndpointSet) bool
IsSuperset returns true if and only if s1 is a superset of s2.
func (NetworkEndpointSet) Len ¶ added in v1.6.0
func (s NetworkEndpointSet) Len() int
Len returns the size of the set.
func (NetworkEndpointSet) List ¶ added in v1.6.0
func (s NetworkEndpointSet) List() []NetworkEndpoint
List returns the slice with contents in random order.
func (NetworkEndpointSet) PopAny ¶ added in v1.6.0
func (s NetworkEndpointSet) PopAny() (NetworkEndpoint, bool)
PopAny returns a single element from the set.
func (NetworkEndpointSet) Union ¶ added in v1.6.0
func (s1 NetworkEndpointSet) Union(s2 NetworkEndpointSet) NetworkEndpointSet
Union returns a new set which includes items in either s1 or s2. For example: s1 = {a1, a2} s2 = {a3, a4} s1.Union(s2) = {a1, a2, a3, a4} s2.Union(s1) = {a1, a2, a3, a4}
type NetworkEndpointStore ¶ added in v1.5.0
type NetworkEndpointStore map[meta.Key][]NetworkEndpointEntry
func GetNetworkEndpointStore ¶ added in v1.7.0
func GetNetworkEndpointStore(negCloud NetworkEndpointGroupCloud) NetworkEndpointStore
GetNetworkEndpointStore is a helper function to access the NetworkEndpointStore of the mock NEG cloud
func (NetworkEndpointStore) AddNetworkEndpointHealthStatus ¶ added in v1.7.0
func (s NetworkEndpointStore) AddNetworkEndpointHealthStatus(key meta.Key, entries []NetworkEndpointEntry)
type NetworkEndpointType ¶ added in v1.8.0
type NetworkEndpointType string
type NetworkEndpointsCalculator ¶ added in v1.9.0
type NetworkEndpointsCalculator interface { // CalculateEndpoints computes the NEG endpoints based on service endpoints and the current NEG state and returns a // map of zone name to network endpoint set CalculateEndpoints(eds []EndpointsData, currentMap map[string]NetworkEndpointSet) (map[string]NetworkEndpointSet, EndpointPodMap, error) // Mode indicates the mode that the EndpointsCalculator is operating in. Mode() EndpointsCalculatorMode }
type PortInfo ¶ added in v1.6.0
type PortInfo struct { // PortTuple is port tuple of a service. PortTuple SvcPortTuple // Subset name, subset is defined in Istio:DestinationRule, this is only used // when --enable-csm=true. Subset string // Subset label, should set together with Subset. SubsetLabels string // NegName is the name of the NEG NegName string // ReadinessGate indicates if the NEG associated with the port has NEG readiness gate enabled // This is enabled with service port is reference by ingress. // If the service port is only exposed as stand alone NEG, it should not be enbled. ReadinessGate bool // EpCalculatorMode indicates if the endpoints for the NEG associated with this port need to // be selected at random(L4ClusterMode), or by following service endpoints(L4LocalMode). // This is applicable in GCE_VM_IP NEGs where the endpoints are the nodes instead of pods. // L7 NEGs will have either "" or L7Mode. EpCalculatorMode EndpointsCalculatorMode }
PortInfo contains information associated with service port
type PortInfoMap ¶ added in v1.6.0
type PortInfoMap map[PortInfoMapKey]PortInfo
PortInfoMap is a map of PortInfoMapKey:PortInfo
func NewPortInfoMap ¶ added in v1.6.0
func NewPortInfoMap(namespace, name string, svcPortTupleSet SvcPortTupleSet, namer NetworkEndpointGroupNamer, readinessGate bool, customNegNames map[SvcPortTuple]string) PortInfoMap
func NewPortInfoMapForVMIPNEG ¶ added in v1.9.4
func NewPortInfoMapForVMIPNEG(namespace, name string, namer namer.L4ResourcesNamer, local bool) PortInfoMap
NewPortInfoMapForVMIPNEG creates PortInfoMap with empty port tuple. Since VM_IP NEGs target the node instead of the pod, there is no port info to be stored.
func NewPortInfoMapWithDestinationRule ¶ added in v1.7.0
func NewPortInfoMapWithDestinationRule(namespace, name string, svcPortTupleSet SvcPortTupleSet, namer NetworkEndpointGroupNamer, readinessGate bool, destinationRule *istioV1alpha3.DestinationRule) (PortInfoMap, error)
NewPortInfoMapWithDestinationRule create PortInfoMap based on a gaven DesinationRule. Return error message if the DestinationRule contains duplicated subsets.
func (PortInfoMap) Difference ¶ added in v1.6.0
func (p1 PortInfoMap) Difference(p2 PortInfoMap) PortInfoMap
Difference returns the entries of PortInfoMap which satisfies one of the following 2 conditions: 1. portInfo entry is in p1 and not present in p2 2. or the portInfo entry is not the same in p1 and p2.
func (PortInfoMap) EndpointsCalculatorMode ¶ added in v1.14.0
func (p1 PortInfoMap) EndpointsCalculatorMode() EndpointsCalculatorMode
EndpointsCalculatorMode returns the endpoints calculator mode for this portInfoMap. This indicates the type of NEG used.
func (PortInfoMap) Merge ¶ added in v1.6.0
func (p1 PortInfoMap) Merge(p2 PortInfoMap) error
Merge merges p2 into p1 PortInfoMap It assumes the same key (service port) will have the same target port and negName If not, it will throw error If a key in p1 or p2 has readiness gate enabled, the merged port info will also has readiness gate enabled The merged port info will have the same Endpoints Calculator mode as p1 and p2. This field is important for VM_IP NEGs. L7 NEGs can have an empty string or L7Mode value.
func (PortInfoMap) NegsWithReadinessGate ¶ added in v1.6.0
func (p1 PortInfoMap) NegsWithReadinessGate() sets.String
NegsWithReadinessGate returns the NegNames which has readiness gate enabled
func (PortInfoMap) ToPortNegMap ¶ added in v1.6.0
func (p1 PortInfoMap) ToPortNegMap() annotations.PortNegMap
func (PortInfoMap) ToPortSubsetNegMap ¶ added in v1.7.0
func (p1 PortInfoMap) ToPortSubsetNegMap() annotations.PortSubsetNegMap
type PortInfoMapKey ¶ added in v1.7.0
type PortInfoMapKey struct { // ServicePort is the service port ServicePort int32 // Istio:DestinationRule Subset, only used when --enable-csm=true Subset string }
PortInfoMapKey is the Key of PortInfoMap
type SvcPortTuple ¶ added in v1.8.0
type SvcPortTuple struct { // Port is the service port number Port int32 // Name is the service port name Name string // TargetPort is the service target port. // This can be a port number or named port TargetPort string }
SvcPortTuple is the tuple representing one service port
func (SvcPortTuple) Empty ¶ added in v1.9.0
func (t SvcPortTuple) Empty() bool
func (SvcPortTuple) String ¶ added in v1.8.0
func (t SvcPortTuple) String() string
String returns the string representation of SvcPortTuple
type SvcPortTupleSet ¶ added in v1.8.0
type SvcPortTupleSet map[SvcPortTuple]struct{}
SvcPortTupleSet is a set of SvcPortTuple
func NewSvcPortTupleSet ¶ added in v1.8.0
func NewSvcPortTupleSet(tuples ...SvcPortTuple) SvcPortTupleSet
NewSvcPortTupleSet returns SvcPortTupleSet with the input tuples
func (SvcPortTupleSet) Get ¶ added in v1.8.0
func (set SvcPortTupleSet) Get(svcPort int32) (SvcPortTuple, bool)
Get returns the SvcPortTuple with matching svc port if found
func (SvcPortTupleSet) Insert ¶ added in v1.8.0
func (set SvcPortTupleSet) Insert(tuples ...SvcPortTuple)
Insert inserts a SvcPortTuple into SvcPortTupleSet
type TestContext ¶ added in v1.11.0
type TestContext struct { KubeClient kubernetes.Interface SvcNegClient svcnegclient.Interface Cloud *gce.Cloud NegNamer NetworkEndpointGroupNamer L4Namer namer.L4ResourcesNamer IngressInformer cache.SharedIndexInformer PodInformer cache.SharedIndexInformer ServiceInformer cache.SharedIndexInformer NodeInformer cache.SharedIndexInformer EndpointInformer cache.SharedIndexInformer EndpointSliceInformer cache.SharedIndexInformer SvcNegInformer cache.SharedIndexInformer KubeSystemUID types.UID ResyncPeriod time.Duration }
TestContext provides controller context for testing
func NewTestContext ¶ added in v1.11.0
func NewTestContext() *TestContext
func NewTestContextWithKubeClient ¶ added in v1.11.0
func NewTestContextWithKubeClient(kubeClient kubernetes.Interface) *TestContext
type ZoneGetter ¶
type ZoneGetter interface { ListZones(predicate utils.NodeConditionPredicate) ([]string, error) GetZoneForNode(name string) (string, error) }
ZoneGetter is an interface for retrieve zone related information
func NewSimpleZoneGetter ¶ added in v1.10.0
func NewSimpleZoneGetter(zone string) ZoneGetter