mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
kube-proxyy: update winkernel proxier to read 'ready', 'serving' and 'terminating' conditions
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
This commit is contained in:
parent
a7333e1a3e
commit
1acdfb4e7c
@ -65,6 +65,11 @@ func (hns hnsV1) getEndpointByID(id string) (*endpointsInfo, error) {
|
|||||||
macAddress: hnsendpoint.MacAddress,
|
macAddress: hnsendpoint.MacAddress,
|
||||||
hnsID: hnsendpoint.Id,
|
hnsID: hnsendpoint.Id,
|
||||||
hns: hns,
|
hns: hns,
|
||||||
|
|
||||||
|
// only ready and not terminating endpoints were added to HNS
|
||||||
|
ready: true,
|
||||||
|
serving: true,
|
||||||
|
terminating: false,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
func (hns hnsV1) getEndpointByIpAddress(ip string, networkName string) (*endpointsInfo, error) {
|
func (hns hnsV1) getEndpointByIpAddress(ip string, networkName string) (*endpointsInfo, error) {
|
||||||
@ -90,6 +95,11 @@ func (hns hnsV1) getEndpointByIpAddress(ip string, networkName string) (*endpoin
|
|||||||
macAddress: endpoint.MacAddress,
|
macAddress: endpoint.MacAddress,
|
||||||
hnsID: endpoint.Id,
|
hnsID: endpoint.Id,
|
||||||
hns: hns,
|
hns: hns,
|
||||||
|
|
||||||
|
// only ready and not terminating endpoints were added to HNS
|
||||||
|
ready: true,
|
||||||
|
serving: true,
|
||||||
|
terminating: false,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,6 +147,10 @@ func (hns hnsV1) createEndpoint(ep *endpointsInfo, networkName string) (*endpoin
|
|||||||
hnsID: createdEndpoint.Id,
|
hnsID: createdEndpoint.Id,
|
||||||
providerAddress: ep.providerAddress, //TODO get from createdEndpoint
|
providerAddress: ep.providerAddress, //TODO get from createdEndpoint
|
||||||
hns: hns,
|
hns: hns,
|
||||||
|
|
||||||
|
ready: ep.ready,
|
||||||
|
serving: ep.serving,
|
||||||
|
terminating: ep.terminating,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
func (hns hnsV1) deleteEndpoint(hnsID string) error {
|
func (hns hnsV1) deleteEndpoint(hnsID string) error {
|
||||||
|
@ -162,6 +162,11 @@ type endpointsInfo struct {
|
|||||||
refCount *uint16
|
refCount *uint16
|
||||||
providerAddress string
|
providerAddress string
|
||||||
hns HostNetworkService
|
hns HostNetworkService
|
||||||
|
|
||||||
|
// conditions
|
||||||
|
ready bool
|
||||||
|
serving bool
|
||||||
|
terminating bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// String is part of proxy.Endpoint interface.
|
// String is part of proxy.Endpoint interface.
|
||||||
@ -174,6 +179,21 @@ func (info *endpointsInfo) GetIsLocal() bool {
|
|||||||
return info.isLocal
|
return info.isLocal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsReady returns true if an endpoint is ready and not terminating.
|
||||||
|
func (info *endpointsInfo) IsReady() bool {
|
||||||
|
return info.ready
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServing returns true if an endpoint is ready, regardless of it's terminating state.
|
||||||
|
func (info *endpointsInfo) IsServing() bool {
|
||||||
|
return info.serving
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsTerminating returns true if an endpoint is terminating.
|
||||||
|
func (info *endpointsInfo) IsTerminating() bool {
|
||||||
|
return info.terminating
|
||||||
|
}
|
||||||
|
|
||||||
// GetTopology returns the topology information of the endpoint.
|
// GetTopology returns the topology information of the endpoint.
|
||||||
func (info *endpointsInfo) GetTopology() map[string]string {
|
func (info *endpointsInfo) GetTopology() map[string]string {
|
||||||
return nil
|
return nil
|
||||||
@ -300,6 +320,10 @@ func (proxier *Proxier) newEndpointInfo(baseInfo *proxy.BaseEndpointInfo) proxy.
|
|||||||
refCount: new(uint16),
|
refCount: new(uint16),
|
||||||
hnsID: "",
|
hnsID: "",
|
||||||
hns: proxier.hns,
|
hns: proxier.hns,
|
||||||
|
|
||||||
|
ready: baseInfo.Ready,
|
||||||
|
serving: baseInfo.Serving,
|
||||||
|
terminating: baseInfo.Terminating,
|
||||||
}
|
}
|
||||||
|
|
||||||
return info
|
return info
|
||||||
@ -311,6 +335,10 @@ func newSourceVIP(hns HostNetworkService, network string, ip string, mac string,
|
|||||||
isLocal: true,
|
isLocal: true,
|
||||||
macAddress: mac,
|
macAddress: mac,
|
||||||
providerAddress: providerAddress,
|
providerAddress: providerAddress,
|
||||||
|
|
||||||
|
ready: true,
|
||||||
|
serving: true,
|
||||||
|
terminating: false,
|
||||||
}
|
}
|
||||||
ep, err := hns.createEndpoint(hnsEndpoint, network)
|
ep, err := hns.createEndpoint(hnsEndpoint, network)
|
||||||
return ep, err
|
return ep, err
|
||||||
@ -1010,13 +1038,16 @@ func (proxier *Proxier) syncProxyRules() {
|
|||||||
containsNodeIP := false
|
containsNodeIP := false
|
||||||
|
|
||||||
for _, epInfo := range proxier.endpointsMap[svcName] {
|
for _, epInfo := range proxier.endpointsMap[svcName] {
|
||||||
|
|
||||||
ep, ok := epInfo.(*endpointsInfo)
|
ep, ok := epInfo.(*endpointsInfo)
|
||||||
if !ok {
|
if !ok {
|
||||||
klog.Errorf("Failed to cast endpointsInfo %q", svcName.String())
|
klog.Errorf("Failed to cast endpointsInfo %q", svcName.String())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !ep.IsReady() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var newHnsEndpoint *endpointsInfo
|
var newHnsEndpoint *endpointsInfo
|
||||||
hnsNetworkName := proxier.network.name
|
hnsNetworkName := proxier.network.name
|
||||||
var err error
|
var err error
|
||||||
|
Loading…
Reference in New Issue
Block a user