Merge pull request #1554 from mscreations/dynamic_env_vars

Enhancement: substitute environment vars in container labels
pull/1561/head
shamoon 2 years ago committed by GitHub
commit 18cf4e7d5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -86,7 +86,7 @@ export async function servicesFromDocker() {
type: 'service'
};
}
shvl.set(constructedService, label.replace("homepage.", ""), container.Labels[label]);
shvl.set(constructedService, label.replace("homepage.", ""), substituteEnvironmentVars(container.Labels[label]));
}
});
@ -175,7 +175,7 @@ export async function servicesFromKubernetes() {
const services = ingressList.items
.filter((ingress) => ingress.metadata.annotations && ingress.metadata.annotations[`${ANNOTATION_BASE}/enabled`] === 'true')
.map((ingress) => {
const constructedService = {
let constructedService = {
app: ingress.metadata.name,
namespace: ingress.metadata.namespace,
href: ingress.metadata.annotations[`${ANNOTATION_BASE}/href`] || getUrlFromIngress(ingress),
@ -202,6 +202,12 @@ export async function servicesFromKubernetes() {
}
});
try {
constructedService = JSON.parse(substituteEnvironmentVars(JSON.stringify(constructedService)));
} catch (e) {
logger.error("Error attempting k8s environment variable substitution.");
}
return constructedService;
});

Loading…
Cancel
Save