1import * as _ from 'lodash-es' 8export const getImagePullSecrets = async () => { 13 if (action != 'delete') { 20/** Union a pull-secret into the default ServiceAccount's imagePullSecrets (idempotent, additive). 21 * Multiple registries (dockreg + regcache) coexist without last-writer-wins clobbering. */ 22export const ensureSaPullSecret = async ({secretName, action, cluster_name}: { 23 secretName: string, action?: string, cluster_name: string, 26 if (action !== 'apply') return 28 apiVersion: 'v1', kind: 'ServiceAccount', metadata: {name: 'default'}, 29 }}) as {imagePullSecrets?: {name: string}[]} | null | undefined 31 const existing = resource.imagePullSecrets || [] 32 if (_.some(existing, ({name}) => name === secretName)) return 33 Object.assign(resource, {imagePullSecrets: [...existing, {name: secretName}]}) 34 await res1Action({action, resource: resource as KubeResource, cluster_name})