1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-05 10:55:17 +02:00

feat: rework kubernetes annotations

New annotation: flame.pawelmalak/enabled
Changed annotations:
flame.pawelmalak/name - defaults to ingress name
flame.pawelmalak/url - defaults to first ingress host found or if first ingress tls host found it uses that
This commit is contained in:
Devin Buhl 2022-01-09 12:21:39 -05:00 committed by GitHub
parent 750891cffa
commit 09739cb4e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,15 +33,19 @@ const useKubernetes = async (apps) => {
for (const ingress of ingresses) {
const annotations = ingress.metadata.annotations;
const name = ingress.metadata.name;
let url = "http://" + ingress.spec.rules[0].host;
if (ingress.spec.tls?.[0].hosts[0]) {
url = "https://" + ingress.spec.tls[0].hosts[0];
}
if (
'flame.pawelmalak/name' in annotations &&
'flame.pawelmalak/url' in annotations &&
'flame.pawelmalak/enabled' in annotations &&
/^app/.test(annotations['flame.pawelmalak/type'])
) {
kubernetesApps.push({
name: annotations['flame.pawelmalak/name'],
url: annotations['flame.pawelmalak/url'],
name: annotations['flame.pawelmalak/name'] || name,
url: annotations['flame.pawelmalak/url'] || url,
icon: annotations['flame.pawelmalak/icon'] || 'kubernetes',
});
}