Skip to content

Commit 8315af1

Browse files
Delyan Raychevakshaysngupta
authored andcommitted
Avoid nil pointer exception when Ingress has no Backends (#578)
1 parent 7f307cf commit 8315af1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pkg/appgw/certificates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (c *appGwConfigBuilder) getSslCertificates(cbCtx *ConfigBuilderContext) *[]
3838
sslCertificates = append(sslCertificates, c.newCert(secretID, cert))
3939
}
4040

41-
if cbCtx.EnvVariables.EnableBrownfieldDeployment {
41+
if cbCtx.EnvVariables.EnableBrownfieldDeployment && c.appGw.SslCertificates != nil {
4242
// MergePools would produce unique list of pools based on Name. Blacklisted pools, which have the same name
4343
// as a managed pool would be overwritten.
4444
sslCertificates = brownfield.MergeCerts(*c.appGw.SslCertificates, sslCertificates)

pkg/appgw/validators.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ func validateServiceDefinition(eventRecorder record.EventRecorder, config *n.App
5050
continue
5151
}
5252
for pathIdx := range rule.HTTP.Paths {
53+
if ingress.Spec.Backend == nil {
54+
continue
55+
}
5356
path := &rule.HTTP.Paths[pathIdx]
5457
backendIDs[generateBackendID(ingress, rule, path, &path.Backend)] = nil
5558
}

0 commit comments

Comments
 (0)