Skip to content

Commit 9f2ffa0

Browse files
author
Samuel Warkentin
committed
feat: auto-label icecast ingresses as type:icecast
Ingresses with tinymon.io/icecast-mounts annotation get type:icecast label instead of type:web.
1 parent 4c27b6b commit 9f2ffa0

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

internal/controller/ingress.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (r *IngressReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
6060
Address: addr,
6161
Description: fmt.Sprintf("Ingress %s/%s (%s)", ingress.Namespace, ingress.Name, strings.Join(hosts, ", ")),
6262
Topic: t,
63-
Labels: buildLabels(r.Cluster, "web", ingress.Labels),
63+
Labels: buildLabels(r.Cluster, ingressType(ingress.Annotations), ingress.Labels),
6464
Enabled: 1,
6565
}
6666

@@ -151,6 +151,14 @@ func expectedStatusCode(annotations map[string]string) int {
151151
return 0
152152
}
153153

154+
// ingressType returns "icecast" if the ingress has icecast-mounts annotation, otherwise "web".
155+
func ingressType(annotations map[string]string) string {
156+
if annotations != nil && annotations[AnnotationIcecastMounts] != "" {
157+
return "icecast"
158+
}
159+
return "web"
160+
}
161+
154162
func ingressHosts(ingress *networkingv1.Ingress) []string {
155163
var hosts []string
156164
for _, rule := range ingress.Spec.Rules {

0 commit comments

Comments
 (0)