Skip to content

Commit

Permalink
Protect against httproutes for GAMMA where spec.hostnames does not ex…
Browse files Browse the repository at this point in the history
…ist.
  • Loading branch information
djeinstine committed Feb 1, 2025
1 parent 141db89 commit 1bbbcfd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/utils/kubernetes/kubernetes-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,15 @@ const getSchemaFromGateway = async (gatewayRef) => {
};

async function getUrlFromHttpRoute(ingress) {
const urlHost = ingress.spec.hostnames[0];
const urlPath = ingress.spec.rules[0].matches[0].path.value;
const urlSchema = (await getSchemaFromGateway(ingress.spec.parentRefs[0])) ? "https" : "http";
return `${urlSchema}://${urlHost}${urlPath}`;

let url = null
if (ingress.spec.has("hostnames")) {
const urlHost = ingress.spec.hostnames[0];
const urlPath = ingress.spec.rules[0].matches[0].path.value;
const urlSchema = (await getSchemaFromGateway(ingress.spec.parentRefs[0])) ? "https" : "http";
url = `${urlSchema}://${urlHost}${urlPath}`;
}
return url;
}

function getUrlFromIngress(ingress) {
Expand Down

0 comments on commit 1bbbcfd

Please sign in to comment.