in pkg/appgw/configbuilder.go [80:159]
func (c *appGwConfigBuilder) Build(cbCtx *ConfigBuilderContext) (*n.ApplicationGateway, error) {
err := c.HealthProbesCollection(cbCtx)
if err != nil {
e := controllererrors.NewErrorWithInnerError(
controllererrors.ErrorGeneratingProbes,
err,
"unable to generate Health Probes",
)
klog.Errorf(e.Error())
return nil, e
}
err = c.BackendHTTPSettingsCollection(cbCtx)
if err != nil {
e := controllererrors.NewErrorWithInnerError(
controllererrors.ErrorGeneratingBackendSettings,
err,
"unable to generate backend http settings",
)
klog.Errorf(e.Error())
return nil, e
}
// BackendAddressPools depend on BackendHTTPSettings
err = c.BackendAddressPools(cbCtx)
if err != nil {
e := controllererrors.NewErrorWithInnerError(
controllererrors.ErrorCreatingBackendPools,
err,
"unable to generate backend address pools",
)
klog.Errorf(e.Error())
return nil, e
}
// Listener configures the frontend listeners
// This also creates redirection configuration (if TLS is configured and Ingress is annotated).
// This configuration must be attached to request routing rules, which are created in the steps below.
// The order of operations matters.
err = c.Listeners(cbCtx)
if err != nil {
e := controllererrors.NewErrorWithInnerError(
controllererrors.ErrorGeneratingListeners,
err,
"unable to generate frontend listeners",
)
klog.Errorf(e.Error())
return nil, e
}
// Build RewriteRuleSets configuration
err = c.RewriteRuleSets(cbCtx)
if err != nil {
e := controllererrors.NewErrorWithInnerError(
controllererrors.ErrorCreatingRewrites,
err,
"unable to generate rewrite rule sets",
)
klog.Errorf(e.Error())
return nil, e
}
// SSL redirection configurations created elsewhere will be attached to the appropriate rule in this step.
err = c.RequestRoutingRules(cbCtx)
if err != nil {
e := controllererrors.NewErrorWithInnerError(
controllererrors.ErrorGeneratingRoutingRules,
err,
"unable to generate request routing rules",
)
klog.Errorf(e.Error())
return nil, e
}
// Remove unused default pool and settings
c.CleanUpUnusedDefaults()
c.addTags()
return &c.appGw, nil
}