"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pilot/pkg/networking/core/v1alpha3/gateway.go" between
istio-1.10.0.tar.gz and istio-1.10.1.tar.gz

About: Istio is a platform-independent service mesh that provides a uniform way to connect, secure, control, and observe microservices.

gateway.go  (istio-1.10.0):gateway.go  (istio-1.10.1)
skipping to change at line 46 skipping to change at line 46
"istio.io/istio/pilot/pkg/networking/util" "istio.io/istio/pilot/pkg/networking/util"
authn_model "istio.io/istio/pilot/pkg/security/model" authn_model "istio.io/istio/pilot/pkg/security/model"
"istio.io/istio/pkg/config" "istio.io/istio/pkg/config"
"istio.io/istio/pkg/config/gateway" "istio.io/istio/pkg/config/gateway"
"istio.io/istio/pkg/config/host" "istio.io/istio/pkg/config/host"
"istio.io/istio/pkg/config/protocol" "istio.io/istio/pkg/config/protocol"
"istio.io/istio/pkg/proto" "istio.io/istio/pkg/proto"
"istio.io/pkg/log" "istio.io/pkg/log"
) )
// DisableGatewayPortTranslationLabel is a label on Service that declares that,
for that particular
// service, we should not translate Gateway ports to target ports. For example,
if I have a Service
// on port 80 with target port 8080, with the label. Gateways on port 80 would *
not* match. Instead,
// only Gateways on port 8080 would be used. This prevents ambiguities when ther
e are multiple
// Services on port 80 referring to different target ports. Long term, this will
be replaced by
// Gateways directly referencing a Service, rather than label selectors. Warning
: this label is
// intended solely for as a workaround for Knative's Istio integration, and not
intended for any
// other usage. It can, and will, be removed immediately after the new direct re
ference is ready for
// use.
const DisableGatewayPortTranslationLabel = "experimental.istio.io/disable-gatewa
y-port-translation"
func (configgen *ConfigGeneratorImpl) buildGatewayListeners(builder *ListenerBui lder) *ListenerBuilder { func (configgen *ConfigGeneratorImpl) buildGatewayListeners(builder *ListenerBui lder) *ListenerBuilder {
if builder.node.MergedGateway == nil { if builder.node.MergedGateway == nil {
log.Debug("buildGatewayListeners: no gateways for router ", build er.node.ID) log.Debug("buildGatewayListeners: no gateways for router ", build er.node.ID)
return builder return builder
} }
mergedGateway := builder.node.MergedGateway mergedGateway := builder.node.MergedGateway
log.Debugf("buildGatewayListeners: gateways after merging: %v", mergedGat eway) log.Debugf("buildGatewayListeners: gateways after merging: %v", mergedGat eway)
actualWildcard, _ := getActualWildcardAndLocalHost(builder.node) actualWildcard, _ := getActualWildcardAndLocalHost(builder.node)
errs := &multierror.Error{ errs := &multierror.Error{
ErrorFormat: util.MultiErrorFormat(), ErrorFormat: util.MultiErrorFormat(),
} }
listeners := make([]*listener.Listener, 0) listeners := make([]*listener.Listener, 0)
proxyConfig := builder.node.Metadata.ProxyConfigOrDefault(builder.push.Me sh.DefaultConfig) proxyConfig := builder.node.Metadata.ProxyConfigOrDefault(builder.push.Me sh.DefaultConfig)
for port, ms := range mergedGateway.MergedServers { for port, ms := range mergedGateway.MergedServers {
servers := ms.Servers servers := ms.Servers
var si *model.ServiceInstance var si *model.ServiceInstance
services := make(map[host.Name]struct{}, len(builder.node.Service Instances)) services := make(map[host.Name]struct{}, len(builder.node.Service Instances))
foundDirectPortTranslation := false
for _, w := range builder.node.ServiceInstances { for _, w := range builder.node.ServiceInstances {
_, directPortTranslation := w.Service.Attributes.Labels[D
isableGatewayPortTranslationLabel]
if directPortTranslation {
if w.Endpoint.EndpointPort == port.Number {
foundDirectPortTranslation = true
}
continue
}
if w.ServicePort.Port == int(port.Number) { if w.ServicePort.Port == int(port.Number) {
if si == nil { if si == nil {
si = w si = w
} }
services[w.Service.Hostname] = struct{}{} services[w.Service.Hostname] = struct{}{}
} }
} }
if len(services) != 1 { if len(services) == 0 && foundDirectPortTranslation {
log.Debugf("buildGatewayListeners: using direct port mapp
ing due to disable label for %v",
port.Number)
} else if len(services) != 1 {
log.Warnf("buildGatewayListeners: found %d services on po rt %d: %v", log.Warnf("buildGatewayListeners: found %d services on po rt %d: %v",
len(services), port.Number, services) len(services), port.Number, services)
} }
// if we found a ServiceInstance with matching ServicePort, liste n on TargetPort // if we found a ServiceInstance with matching ServicePort, liste n on TargetPort
if si != nil && si.Endpoint != nil { if si != nil && si.Endpoint != nil {
port.Number = si.Endpoint.EndpointPort port.Number = si.Endpoint.EndpointPort
} }
if builder.node.Metadata.UnprivilegedPod != "" && port.Number < 1 024 { if builder.node.Metadata.UnprivilegedPod != "" && port.Number < 1 024 {
log.Warnf("buildGatewayListeners: skipping privileged gat eway port %d for node %s as it is an unprivileged pod", log.Warnf("buildGatewayListeners: skipping privileged gat eway port %d for node %s as it is an unprivileged pod",
port.Number, builder.node.ID) port.Number, builder.node.ID)
continue continue
} }
bind := actualWildcard bind := actualWildcard
if len(port.Bind) > 0 { if len(port.Bind) > 0 {
bind = port.Bind bind = port.Bind
} }
 End of changes. 6 change blocks. 
1 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)