Merge "app/radio: add support for following relays"
diff --git a/app/radio/kube/radio.libsonnet b/app/radio/kube/radio.libsonnet
index c13e82d..aa2d57f 100644
--- a/app/radio/kube/radio.libsonnet
+++ b/app/radio/kube/radio.libsonnet
@@ -31,7 +31,8 @@
                 },
                 hostname: "localhost",
                 listenPort: 8080,
-                mounts: [],
+                mounts: {},
+                relays: {},
         },
 
         tag: "latest",
@@ -123,7 +124,20 @@
                     ["fallback-override", "1"],
                 ] else [])
                 for m in std.objectFields(cfg.icecast.mounts)
-             ]),
+             ] + [
+                ["relay",
+                    ["server", cfg.icecast.relays[r].server],
+                    ["port", std.toString(cfg.icecast.relays[r].port)],
+                    ["mount", cfg.icecast.relays[r].mount],
+                    ["local-mount", r],
+                    ["on-demand", "0"],
+                ] + (if cfg.icecast.relays[r].username != null then [
+                    ["username", cfg.icecast.relays[r].username]
+                ] else []) + (if cfg.icecast.relays[r].password != null then [
+                    ["password", cfg.icecast.relays[r].password],
+                ] else [])
+                for r in std.objectFields(cfg.icecast.relays)
+            ]),
         },
     },
 
@@ -158,6 +172,7 @@
         spec+: {
             ports: [
                 { name: "client", port: cfg.port, targetPort: cfg.icecast.listenPort, protocol: "TCP" },
+                { name: "client80", port: 80, targetPort: cfg.icecast.listenPort, protocol: "TCP" },
             ],
             type: "LoadBalancer",
         },