Skip to content

Commit 6b8807c

Browse files
committed
fix per-stack hostname generation logic
1 parent 7e27169 commit 6b8807c

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

pkg/core/stack_resources.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,17 @@ func (sc *StackContainer) stackHostnames(
327327

328328
// Old-style autogenerated hostnames
329329
for _, host := range spec.GetHosts() {
330-
if strings.HasSuffix(host, sc.perStackDomain) {
331-
result.Insert(fmt.Sprintf("%s.%s", sc.Name(), sc.perStackDomain))
332-
} else {
333-
log.Debugf(
334-
"Ingress host: %s suffix did not match cluster-domain %s",
335-
host,
336-
sc.perStackDomain,
337-
)
330+
for _, domain := range sc.clusterDomains {
331+
if strings.HasSuffix(host, domain) {
332+
// generate the per-stack hostname using the per-stack domain suffix
333+
result.Insert(fmt.Sprintf("%s.%s", sc.Name(), sc.perStackDomain))
334+
} else {
335+
log.Debugf(
336+
"Ingress host: %s suffix did not match cluster-domain %s",
337+
host,
338+
domain,
339+
)
340+
}
338341
}
339342
}
340343
return result.List(), nil

pkg/core/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ type StackContainer struct {
8989
// Fields from the parent stackset
9090
stacksetName string
9191
scaledownTTL time.Duration
92+
clusterDomains []string
9293
perStackDomain string
9394

9495
// Ingress annotations to synchronize
@@ -354,6 +355,7 @@ func (ssc *StackSetContainer) UpdateFromResources() error {
354355
sc.syncAnnotationsInRouteGroup = syncAnnotationsInRouteGroup
355356
sc.backendPort = backendPort
356357
sc.scaledownTTL = scaledownTTL
358+
sc.clusterDomains = ssc.clusterDomains
357359
sc.perStackDomain = ssc.perStackDomain
358360
err := sc.updateStackResources()
359361
if err != nil {

0 commit comments

Comments
 (0)