Skip to content

Commit

Permalink
Avoid nil pointer exception when Ingress has no Backends (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
draychev authored and akshaysngupta committed Oct 11, 2019
1 parent 7f307cf commit 8315af1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/appgw/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (c *appGwConfigBuilder) getSslCertificates(cbCtx *ConfigBuilderContext) *[]
sslCertificates = append(sslCertificates, c.newCert(secretID, cert))
}

if cbCtx.EnvVariables.EnableBrownfieldDeployment {
if cbCtx.EnvVariables.EnableBrownfieldDeployment && c.appGw.SslCertificates != nil {
// MergePools would produce unique list of pools based on Name. Blacklisted pools, which have the same name
// as a managed pool would be overwritten.
sslCertificates = brownfield.MergeCerts(*c.appGw.SslCertificates, sslCertificates)
Expand Down
3 changes: 3 additions & 0 deletions pkg/appgw/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func validateServiceDefinition(eventRecorder record.EventRecorder, config *n.App
continue
}
for pathIdx := range rule.HTTP.Paths {
if ingress.Spec.Backend == nil {
continue
}
path := &rule.HTTP.Paths[pathIdx]
backendIDs[generateBackendID(ingress, rule, path, &path.Backend)] = nil
}
Expand Down

0 comments on commit 8315af1

Please sign in to comment.