Skip to content

Commit 015d10c

Browse files
committed
provider/cluster/kube: expose lb hosts
1 parent 40a515c commit 015d10c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

provider/cluster/kube/client.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,22 @@ func (c *client) LeaseStatus(lid types.LeaseID) (*types.LeaseStatusResponse, err
225225
for _, ing := range ingress.Items {
226226
service := serviceStatus[ing.Name]
227227
hosts := []string{}
228+
228229
for _, rule := range ing.Spec.Rules {
229230
hosts = append(hosts, rule.Host)
230231
}
232+
233+
if config.DeploymentIngressExposeLBHosts {
234+
for _, lbing := range ing.Status.LoadBalancer.Ingress {
235+
if val := lbing.IP; val != "" {
236+
hosts = append(hosts, val)
237+
}
238+
if val := lbing.Hostname; val != "" {
239+
hosts = append(hosts, val)
240+
}
241+
}
242+
}
243+
231244
service.URIs = hosts
232245
}
233246
response := &types.LeaseStatusResponse{}

provider/cluster/kube/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ type config_ struct {
1414
// gcp: False
1515
// others: true
1616
DeploymentIngressStaticHosts bool `env:"AKASH_DEPLOYMENT_INGRESS_STATIC_HOSTS" envDefault:"false"`
17+
18+
DeploymentIngressExposeLBHosts bool `env:"AKASH_DEPLOYMENT_INGRESS_EXPOSE_LB_HOSTS" envDefault:"true"`
1719
}
1820

1921
var config = config_{}

0 commit comments

Comments
 (0)