5export const cnpgSystemNs = 'cnpg-system' 7const isNsActive = async ({cluster_name}: {cluster_name: string}): Promise<boolean> => { 10 resource: {apiVersion: 'v1', kind: 'Namespace', metadata: {name: cnpgSystemNs}}, 11 }) as {status?: {phase?: string}} | null 12 return ns?.status?.phase === 'Active' 15const isWebhookServing = async ({cluster_name}: {cluster_name: string}): Promise<boolean> => { 18 resource: {apiVersion: 'v1', kind: 'Endpoints', metadata: {name: 'cnpg-webhook-service', namespace: cnpgSystemNs}}, 19 }) as {subsets?: {addresses?: unknown[]}[]} | null 20 return !!ep?.subsets?.some(s => s.addresses?.length) 23export const awaitCnpgNsActive = async ({timeoutMs = 60 * 1000} = {}) => { 26 predicate: async () => !await isNsActive({cluster_name}), 29 timeoutLabel: `namespace ${cnpgSystemNs} active`, 33export const awaitCnpgWebhookReady = async ({timeoutMs = 3 * 60 * 1000} = {}) => { 35 process.stdout.write('waiting for cnpg webhook endpoints...') 37 predicate: async () => !await isWebhookServing({cluster_name}), 40 timeoutLabel: 'cnpg webhook endpoints ready',