1import * as _ from 'lodash-es' 8export const leIssuerName = 'le-wildcard-issuer' 10export const isCertReady = async ({name, namespace = 'default', cluster_name}: {name: string, namespace?: string, cluster_name: string}): Promise<boolean> => { 13 resource: {apiVersion: 'cert-manager.io/v1', kind: 'Certificate', metadata: {name, namespace}}, 14 }) as {status?: {conditions?: {type: string, status: string}[]}} | null 15 const ready = (cert?.status?.conditions || []).find(c => c.type === 'Ready') 16 return !!ready && ready.status === 'True' 19export const awaitCertsReady = async ({namespace = 'default', timeoutMs = 5 * 60 * 1000} = {}) => { 23 const certNames = Object.keys(klustCertsH) 24 process.stdout.write(`waiting for certs: ${certNames.join(', ')}`) 27 predicate: async () => { 28 for (const name of certNames) { 29 if (!await isCertReady({name, namespace, cluster_name})) return true 35 timeoutLabel: `certs ready (${certNames.join(', ')})`, 40export const k8sCerts = async ({namespace = 'default'} = {}) => { 45 const resources = _.map(klustCertsH, (dnsNamesRaw, name) => { 46 const dnsNames = Array.isArray(dnsNamesRaw) ? dnsNamesRaw : [dnsNamesRaw] 48 apiVersion: 'cert-manager.io/v1', 57 kind: 'ClusterIssuer',