Documentation ¶
Index ¶
- Constants
- Variables
- 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 NewFakeZoneGetter() *fakeZoneGetter
- type EndpointPodMap
- type FakeNetworkEndpointGroupCloud
- func (f *FakeNetworkEndpointGroupCloud) AggregatedListNetworkEndpointGroup() (map[string][]*compute.NetworkEndpointGroup, error)
- func (f *FakeNetworkEndpointGroupCloud) AttachNetworkEndpoints(name, zone string, endpoints []*compute.NetworkEndpoint) error
- func (f *FakeNetworkEndpointGroupCloud) CreateNetworkEndpointGroup(neg *compute.NetworkEndpointGroup, zone string) error
- func (f *FakeNetworkEndpointGroupCloud) DeleteNetworkEndpointGroup(name string, zone string) error
- func (f *FakeNetworkEndpointGroupCloud) DetachNetworkEndpoints(name, zone string, endpoints []*compute.NetworkEndpoint) error
- func (f *FakeNetworkEndpointGroupCloud) GetNetworkEndpointGroup(name string, zone string) (*compute.NetworkEndpointGroup, error)
- func (f *FakeNetworkEndpointGroupCloud) ListNetworkEndpointGroup(zone string) ([]*compute.NetworkEndpointGroup, error)
- func (f *FakeNetworkEndpointGroupCloud) ListNetworkEndpoints(name, zone string, showHealthStatus bool) ([]*compute.NetworkEndpointWithHealthStatus, error)
- func (f *FakeNetworkEndpointGroupCloud) NetworkURL() string
- func (f *FakeNetworkEndpointGroupCloud) SubnetworkURL() string
- 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 PortInfo
- type PortInfoMap
- type SvcPortMap
- type ZoneGetter
Constants ¶
const ( TestZone1 = "zone1" TestZone2 = "zone2" TestInstance1 = "instance1" TestInstance2 = "instance2" TestInstance3 = "instance3" TestInstance4 = "instance4" )
Variables ¶
var NotFoundError = fmt.Errorf("not Found")
Functions ¶
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 NewFakeZoneGetter ¶
func NewFakeZoneGetter() *fakeZoneGetter
Types ¶
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 FakeNetworkEndpointGroupCloud ¶
type FakeNetworkEndpointGroupCloud struct { NetworkEndpointGroups map[string][]*compute.NetworkEndpointGroup NetworkEndpoints map[string][]*compute.NetworkEndpoint Subnetwork string Network string // contains filtered or unexported fields }
func (*FakeNetworkEndpointGroupCloud) AggregatedListNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) AggregatedListNetworkEndpointGroup() (map[string][]*compute.NetworkEndpointGroup, error)
func (*FakeNetworkEndpointGroupCloud) AttachNetworkEndpoints ¶
func (f *FakeNetworkEndpointGroupCloud) AttachNetworkEndpoints(name, zone string, endpoints []*compute.NetworkEndpoint) error
func (*FakeNetworkEndpointGroupCloud) CreateNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) CreateNetworkEndpointGroup(neg *compute.NetworkEndpointGroup, zone string) error
func (*FakeNetworkEndpointGroupCloud) DeleteNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) DeleteNetworkEndpointGroup(name string, zone string) error
func (*FakeNetworkEndpointGroupCloud) DetachNetworkEndpoints ¶
func (f *FakeNetworkEndpointGroupCloud) DetachNetworkEndpoints(name, zone string, endpoints []*compute.NetworkEndpoint) error
func (*FakeNetworkEndpointGroupCloud) GetNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) GetNetworkEndpointGroup(name string, zone string) (*compute.NetworkEndpointGroup, error)
func (*FakeNetworkEndpointGroupCloud) ListNetworkEndpointGroup ¶
func (f *FakeNetworkEndpointGroupCloud) ListNetworkEndpointGroup(zone string) ([]*compute.NetworkEndpointGroup, error)
func (*FakeNetworkEndpointGroupCloud) ListNetworkEndpoints ¶
func (f *FakeNetworkEndpointGroupCloud) ListNetworkEndpoints(name, zone string, showHealthStatus bool) ([]*compute.NetworkEndpointWithHealthStatus, error)
func (*FakeNetworkEndpointGroupCloud) NetworkURL ¶
func (f *FakeNetworkEndpointGroupCloud) NetworkURL() string
func (*FakeNetworkEndpointGroupCloud) SubnetworkURL ¶
func (f *FakeNetworkEndpointGroupCloud) SubnetworkURL() string
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 // Service port Port int32 // Service target port TargetPort string }
NegSyncerKey includes information to uniquely identify a NEG syncer
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 EnsureSyncers(namespace, name string, portMap PortInfoMap) 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) // 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 *compute.NetworkEndpoint Healths []*compute.HealthStatusForNetworkEndpoint }
type NetworkEndpointGroupCloud ¶
type NetworkEndpointGroupCloud interface { GetNetworkEndpointGroup(name string, zone string) (*compute.NetworkEndpointGroup, error) ListNetworkEndpointGroup(zone string) ([]*compute.NetworkEndpointGroup, error) AggregatedListNetworkEndpointGroup() (map[string][]*compute.NetworkEndpointGroup, error) CreateNetworkEndpointGroup(neg *compute.NetworkEndpointGroup, zone string) error DeleteNetworkEndpointGroup(name string, zone string) error AttachNetworkEndpoints(name, zone string, endpoints []*compute.NetworkEndpoint) error DetachNetworkEndpoints(name, zone string, endpoints []*compute.NetworkEndpoint) error ListNetworkEndpoints(name, zone string, showHealthStatus bool) ([]*compute.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 NewFakeNetworkEndpointGroupCloud ¶
func NewFakeNetworkEndpointGroupCloud(subnetwork, network string) NetworkEndpointGroupCloud
type NetworkEndpointGroupNamer ¶
type NetworkEndpointGroupNamer interface { NEG(namespace, name 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{}
sets.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)
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
type PortInfo ¶ added in v1.6.0
type PortInfo struct { // TargetPort is the target port of the service port // This can be port number or a named port TargetPort 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 }
PortInfo contains information associated with service port
type PortInfoMap ¶ added in v1.6.0
PortInfoMap is a map of ServicePort:PortInfo
func NewPortInfoMap ¶ added in v1.6.0
func NewPortInfoMap(namespace, name string, svcPortMap SvcPortMap, namer NetworkEndpointGroupNamer, readinessGate bool) PortInfoMap
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 not the present in p1 2. or the portInfo entry is not the same in p1 and p2.
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
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
type SvcPortMap ¶ added in v1.6.0
SvcPortMap is a map of ServicePort:TargetPort