Skip to content

Commit

Permalink
Translate DNS settings correctly.
Browse files Browse the repository at this point in the history
Signed-off-by: Lior Okman <lior.okman@sap.com>
  • Loading branch information
liorokman committed Aug 6, 2024
1 parent 9ce848e commit 6aaaab9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/gatewayapi/backendtrafficpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (t *Translator) translateBackendTrafficPolicyForRoute(policy *egv1a1.Backen
errs = errors.Join(errs, err)
}
}
ds = translateDNS(policy.Spec.DNS)
ds = translateDNS(policy.Spec.ClusterSettings)

// Early return if got any errors
if errs != nil {
Expand Down Expand Up @@ -471,7 +471,7 @@ func (t *Translator) translateBackendTrafficPolicyForGateway(policy *egv1a1.Back
}
}

ds = translateDNS(policy.Spec.DNS)
ds = translateDNS(policy.Spec.ClusterSettings)

// Early return if got any errors
if errs != nil {
Expand Down
10 changes: 6 additions & 4 deletions internal/gatewayapi/clustersettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ func translateTrafficFeatures(policy *egv1a1.ClusterSettings) (*ir.TrafficFeatur

ret.HealthCheck = buildHealthCheck(*policy)

ret.DNS = translateDNS(*policy)

// If nothing was set in any of the above calls, return nil instead of an empty
// container
var empty ir.TrafficFeatures
Expand Down Expand Up @@ -481,12 +483,12 @@ func translateActiveHealthCheckPayload(p *egv1a1.ActiveHealthCheckPayload) *ir.H
return irPayload
}

func translateDNS(policy *egv1a1.DNS) *ir.DNS {
if policy == nil {
func translateDNS(policy egv1a1.ClusterSettings) *ir.DNS {
if policy.DNS == nil {
return nil
}
return &ir.DNS{
RespectDNSTTL: policy.RespectDNSTTL,
DNSRefreshRate: policy.DNSRefreshRate,
RespectDNSTTL: policy.DNS.RespectDNSTTL,
DNSRefreshRate: policy.DNS.DNSRefreshRate,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ xdsIR:
bufferLimit: 20971520
circuitBreaker:
maxConnections: 2048
dns:
respectDnsTtl: true
healthCheck:
passive:
consecutiveGatewayErrors: 4
Expand Down

0 comments on commit 6aaaab9

Please sign in to comment.