DodoApp: Ingress can configure label and home path
Change-Id: I55b83f54f4aa10e6fcc74b08ea081c0f040829ac
diff --git a/core/installer/server/dodo-app/server.go b/core/installer/server/dodo-app/server.go
index f921a09..858afa8 100644
--- a/core/installer/server/dodo-app/server.go
+++ b/core/installer/server/dodo-app/server.go
@@ -12,6 +12,7 @@
"io/fs"
"net/http"
"slices"
+ "sort"
"strconv"
"strings"
"sync"
@@ -594,7 +595,9 @@
}
type ingress struct {
+ Name string
Host string
+ Home string
}
type vm struct {
@@ -1747,6 +1750,10 @@
if !ok {
continue
}
+ internal, ok := r.Annotations["dodo.cloud/internal"]
+ if ok && strings.ToLower(internal) == "true" {
+ continue
+ }
switch t {
case "volume":
name, ok := r.Annotations["dodo.cloud/resource.volume.name"]
@@ -1773,11 +1780,19 @@
}
ret.PostgreSQL = append(ret.PostgreSQL, postgresql{name, version, volume})
case "ingress":
+ name, ok := r.Annotations["dodo.cloud/resource.ingress.name"]
+ if !ok {
+ return resourceData{}, fmt.Errorf("no name")
+ }
+ home, ok := r.Annotations["dodo.cloud/resource.ingress.home"]
+ if !ok {
+ home = ""
+ }
host, ok := r.Annotations["dodo.cloud/resource.ingress.host"]
if !ok {
return resourceData{}, fmt.Errorf("no host")
}
- ret.Ingress = append(ret.Ingress, ingress{host})
+ ret.Ingress = append(ret.Ingress, ingress{name, host, home})
case "virtual-machine":
name, ok := r.Annotations["dodo.cloud/resource.virtual-machine.name"]
if !ok {
@@ -1804,6 +1819,9 @@
fmt.Printf("Unknown resource: %+v\n", r.Annotations)
}
}
+ sort.Slice(ret.Ingress, func(i, j int) bool {
+ return strings.Compare(ret.Ingress[i].Name, ret.Ingress[j].Name) < 0
+ })
return ret, nil
}