sparse-intern-71089
02/09/2022, 2:45 AMwet-soccer-72485
02/09/2022, 2:47 AMwet-soccer-72485
02/09/2022, 2:49 AMtype PlainIngressRule = Omit<networking.v1.IngressRule, 'http'> & {
http: networking.v1.HTTPIngressRuleValue & {
paths: (Omit<networking.v1.HTTPIngressPath, 'pathType' | 'backend'> & {
pathType: string;
backend: Omit<networking.v1.IngressBackend, 'service'> & {
service: networking.v1.IngressServiceBackend;
};
})[];
};
};
const createAndValidateIngressRule = (
rule: PlainIngressRule
): PlainIngressRule => {
if (!rule.host) {
throw new Error(
'Ingress rule must have a host. For example: *.<http://test.foobar.com|test.foobar.com> or <http://test.foobar.com|test.foobar.com>'
);
}
if (!rule.http) {
throw new Error('Ingress rule is missing HTTP configuration');
}
if (!rule.http.paths) {
throw new Error('Ingress rule is missing HTTP configuration');
}
for (const path of rule.http.paths) {
if (!path.pathType) {
throw new Error(`Ingress rule path type is missing`);
}
if (!['ImplementationSpecific'].includes(path.pathType)) {
throw new Error(`Ingress rule path type is not valid: ${path.pathType}`);
}
if (!path.backend) {
throw new Error(`Ingress rule path is missing backend`);
}
if (!path.backend.service) {
throw new Error(`Ingress rule path is missing backend service`);
}
if (!path.backend.service.name) {
throw new Error(`Ingress rule path is missing backend service name`);
}
if (!path.backend.service.port) {
throw new Error(`Ingress rule path is missing backend service port`);
}
}
return rule;
};
wet-soccer-72485
02/09/2022, 2:57 AMall()
is doingwet-soccer-72485
02/09/2022, 2:57 AMwet-soccer-72485
02/09/2022, 2:57 AMwet-soccer-72485
02/09/2022, 2:57 AMwet-soccer-72485
02/09/2022, 4:19 AMUnwrap
was what I was looking for those coming across this thread later.No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by