1import * as _ from 'lodash-es' 8type IngressTlsEntry = { hosts: string[], secretName: string } 10type IngressTmplProps = { 11 ingressClassName?: string 17export const ingressTmpl = ({ingressClassName='nginx', hostname, hostnameA, name}: IngressTmplProps): { tls: IngressTlsEntry[], ingressClassName: string } => { 18 hostnameA ||= _.castArray(hostname) 20 const certMatchA = _.map(hostnameA, findCertForHostname) 22 const allHaveCert = _.compact(certMatchA).length == certMatchA.length 23 const noneHaveCert = _.compact(certMatchA).length == 0 25 let tls: IngressTlsEntry[] 27 tls = _.map(hostnameA, (host) => { 29 return {hosts: [host], secretName: certName} 31 } else if (noneHaveCert) { 35 ctxOptUseIgNameFromHn.getStore() ? hostname! : name + '-tls' 39 return throPtErr('someWcHn??', {certMatchA, allHaveCert, noneHaveCert}) 43 tls, ingressClassName,