1import * as _ from 'lodash-es' 8 ['spec', 'template', 'spec'], 9 ['spec', 'jobTemplate', 'spec', 'template', 'spec'], 12const rewritePodSpec = (podSpec: Record<string, any>, cacheHost: string) => { 13 for (const key of ['containers', 'initContainers']) { 14 for (const container of _.castArray(podSpec[key] || [])) { 15 if (container.image) container.image = regcacheImgRef({image: container.image, cacheHost}) 22 if (!cacheHost) return resource 23 if (resource.metadata?.name === regcacheName) return resource 25 for (const path of podSpecPaths) { 26 const podSpec = _.get(resource, path) 27 if (podSpec?.containers || podSpec?.initContainers) rewritePodSpec(podSpec, cacheHost)