Skip to content

Commit 7f307cf

Browse files
Delyan Raychevakshaysngupta
authored andcommitted
brownfield: Merge Ports (#605)
1 parent 2ec1d77 commit 7f307cf

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pkg/appgw/frontend_listeners.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ func (c *appGwConfigBuilder) getListeners(cbCtx *ConfigBuilderContext) (*[]n.App
9191
listeners = brownfield.MergeListeners(existingBlacklisted, listeners)
9292
}
9393

94+
if cbCtx.EnvVariables.EnableBrownfieldDeployment {
95+
er := brownfield.NewExistingResources(c.appGw, cbCtx.ProhibitedTargets, nil)
96+
existingBlacklisted, existingNonBlacklisted := er.GetBlacklistedPorts()
97+
brownfield.LogPorts(existingBlacklisted, existingNonBlacklisted, ports)
98+
ports = brownfield.MergePorts(existingBlacklisted, ports)
99+
}
100+
94101
sort.Sort(sorter.ByListenerName(listeners))
95102
sort.Sort(sorter.ByFrontendPortName(ports))
96103

pkg/appgw/requestroutingrules.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ func (c *appGwConfigBuilder) getRules(cbCtx *ConfigBuilderContext) ([]n.Applicat
121121

122122
func (c *appGwConfigBuilder) noRulesIngress(cbCtx *ConfigBuilderContext, ingress *v1beta1.Ingress, urlPathMaps *map[listenerIdentifier]*n.ApplicationGatewayURLPathMap) {
123123
// There are no Rules. We are dealing with some very rudimentary Ingress definition.
124+
if ingress.Spec.Backend == nil {
125+
return
126+
}
124127
backendID := generateBackendID(ingress, nil, nil, ingress.Spec.Backend)
125128
_, _, serviceBackendPairMap, err := c.getBackendsAndSettingsMap(cbCtx)
126129
if err != nil {

0 commit comments

Comments
 (0)