Skip to content

Commit 54b21df

Browse files
committed
[Fix] Operator: DNS handling fixed
Recent changes/refactoring caused an issue due to misplaced slice append causing only 1 subdomain entry to be handled by domain resources. This change fixes the issue.
1 parent e5aae23 commit 54b21df

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

internal/controller/dns-manager.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ func getDnsInfo[T v1alpha1.DomainEntity](c *Controller, dom T) (resolvedDNSInfo
171171
tpl := template.New("dnsTemplate").Funcs(sprig.FuncMap())
172172

173173
resolvedDNSInfo = []*dnsInfo{}
174+
checkAndAppendDNSInfo := func(dnsInfo *dnsInfo) {
175+
if dnsInfo != nil {
176+
resolvedDNSInfo = append(resolvedDNSInfo, dnsInfo)
177+
}
178+
}
174179

175180
for _, dnsTemplate := range dnsTemplates {
176181
var parsedDnsInfo *dnsInfo
@@ -180,6 +185,8 @@ func getDnsInfo[T v1alpha1.DomainEntity](c *Controller, dom T) (resolvedDNSInfo
180185
if err != nil {
181186
return nil, err
182187
}
188+
checkAndAppendDNSInfo(parsedDnsInfo)
189+
continue
183190
}
184191
for subDomain, appId := range subdomainInfo {
185192
domVars["subDomain"] = subDomain
@@ -188,9 +195,7 @@ func getDnsInfo[T v1alpha1.DomainEntity](c *Controller, dom T) (resolvedDNSInfo
188195
return nil, err
189196
}
190197
parsedDnsInfo.appId = appId
191-
}
192-
if parsedDnsInfo != nil {
193-
resolvedDNSInfo = append(resolvedDNSInfo, parsedDnsInfo)
198+
checkAndAppendDNSInfo(parsedDnsInfo)
194199
}
195200
}
196201

internal/controller/reconcile_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ const (
4545
globalAccountId = "global-id-test"
4646
primaryDomain = "app.sme.sap.com"
4747
secondaryDomain = "sec.sme.sap.com"
48-
dnsTarget = "public-ingress.some.cluster.sap"
4948
defaultVersion = "0.0.1"
5049
)
5150

0 commit comments

Comments
 (0)