#!/bin/bash

for rc in `kubectl get ing -l app.kubernetes.io/name=Rocketchat -A --no-headers -o custom-columns=":metadata.name" | sed s/-app//g |grep -v "redirect\|beta\|test"`; do
  export NS=`echo $rc | cut -d"-" -f2-`
  export SUBDOMAIN=`echo $rc | cut -d"-" -f1`
  cd /root/domains/$NS/$SUBDOMAIN;
  libre update --batch
done
