AppManager: Support exposing ports on public networks
Sets up [public ingress -> private ingress -> remote cluster] proxy chain
Change-Id: I6376a006b2692c31f3cb895bbfd6e373182e8824
diff --git a/core/installer/app_manager.go b/core/installer/app_manager.go
index 3285c19..0ec6605 100644
--- a/core/installer/app_manager.go
+++ b/core/installer/app_manager.go
@@ -216,7 +216,11 @@
for _, p := range ports {
var target string
if p.Cluster == "" {
- target = fmt.Sprintf("%s/%s", ns, p.Service.Name)
+ if p.Service.Namespace == "" {
+ target = fmt.Sprintf("%s/%s", ns, p.Service.Name)
+ } else {
+ target = fmt.Sprintf("%s/%s", p.Service.Namespace, p.Service.Name)
+ }
} else {
target = p.Service.Name
}
@@ -258,10 +262,16 @@
var retErr error
for _, p := range ports {
var buf bytes.Buffer
+ var fullName string
+ if p.Service.Namespace == "" {
+ fullName = fmt.Sprintf("%s/%s", ns, p.Service.Name)
+ } else {
+ fullName = fmt.Sprintf("%s/%s", p.Service.Namespace, p.Service.Name)
+ }
req := removePortReq{
Protocol: p.Protocol,
SourcePort: p.Port,
- TargetService: fmt.Sprintf("%s/%s", ns, p.Service.Name),
+ TargetService: fullName,
TargetPort: p.Service.Port,
}
if err := json.NewEncoder(&buf).Encode(req); err != nil {