func (m *podSpecMutator) Mutate(fn ImageReferenceMutateFunc) field.ErrorList {
	var errs field.ErrorList
	for i := range m.spec.InitContainers {
		container := &m.spec.InitContainers[i]
		if !m.resolveAnnotationChanged && hasIdenticalPodSpecImage(m.oldSpec, container.Name, container.Image) {
			continue
		}
		ref := core.ObjectReference{Kind: "DockerImage", Name: container.Image}
		if err := fn(&ref); err != nil {
			errs = append(errs, FieldErrorOrInternal(err, m.path.Child("initContainers").Index(i).Child("image")))
			continue
		}
		if ref.Kind != "DockerImage" {
			errs = append(errs, FieldErrorOrInternal(fmt.Errorf("pod specs may only contain references to docker images, not %q", ref.Kind), m.path.Child("initContainers").Index(i).Child("image")))
			continue
		}
		container.Image = ref.Name
	}
	for i := range m.spec.Containers {
		container := &m.spec.Containers[i]
		if !m.resolveAnnotationChanged && hasIdenticalPodSpecImage(m.oldSpec, container.Name, container.Image) {
			continue
		}
		ref := core.ObjectReference{Kind: "DockerImage", Name: container.Image}
		if err := fn(&ref); err != nil {
			errs = append(errs, FieldErrorOrInternal(err, m.path.Child("containers").Index(i).Child("image")))
			continue
		}
		if ref.Kind != "DockerImage" {
			errs = append(errs, FieldErrorOrInternal(fmt.Errorf("pod specs may only contain references to docker images, not %q", ref.Kind), m.path.Child("containers").Index(i).Child("image")))
			continue
		}
		container.Image = ref.Name
	}
	return errs
}
// Mutate applies fn to all containers and init containers. If fn changes the Kind to
// any value other than "DockerImage", an error is set on that field.
Mutate applies fn to all containers and init containers. If fn changes the Kind to
any value other than "DockerImage", an error is set on that field.
// Mutate applies fn to all containers and init containers . If fn changes the Kind to // any value other than " DockerImage " an error is set on that field .
func (m *podSpecMutator) Mutate(fn ImageReferenceMutateFunc) field.ErrorList {
	var errs field.ErrorList
	for i := range m.spec.InitContainers {
		container := &m.spec.InitContainers[i]
		if !m.resolveAnnotationChanged && hasIdenticalPodSpecImage(m.oldSpec, container.Name, container.Image) {
			continue
		}
		ref := core.ObjectReference{Kind: "DockerImage", Name: container.Image}
		if err := fn(&ref); err != nil {
			errs = append(errs, FieldErrorOrInternal(err, m.path.Child("initContainers").Index(i).Child("image")))
			continue
		}
		if ref.Kind != "DockerImage" {
			errs = append(errs, FieldErrorOrInternal(fmt.Errorf("pod specs may only contain references to docker images, not %q", ref.Kind), m.path.Child("initContainers").Index(i).Child("image")))
			continue
		}
		container.Image = ref.Name
	}
	for i := range m.spec.Containers {
		container := &m.spec.Containers[i]
		if !m.resolveAnnotationChanged && hasIdenticalPodSpecImage(m.oldSpec, container.Name, container.Image) {
			continue
		}
		ref := core.ObjectReference{Kind: "DockerImage", Name: container.Image}
		if err := fn(&ref); err != nil {
			errs = append(errs, FieldErrorOrInternal(err, m.path.Child("containers").Index(i).Child("image")))
			continue
		}
		if ref.Kind != "DockerImage" {
			errs = append(errs, FieldErrorOrInternal(fmt.Errorf("pod specs may only contain references to docker images, not %q", ref.Kind), m.path.Child("containers").Index(i).Child("image")))
			continue
		}
		container.Image = ref.Name
	}
	return errs
}
func ( m * podSpecMutator ) Mutate ( fn ImageReferenceMutateFunc ) field . ErrorList { var errs field . ErrorList for i := range m . spec . InitContainers { container := & m . spec . InitContainers [ i ] if ! m . resolveAnnotationChanged && hasIdenticalPodSpecImage ( m . oldSpec , container . Name , container . Image ) { continue } ref := core . ObjectReference { Kind : " " , Name : container . Image } if err := fn ( & ref ) ; err != nil { errs = append ( errs , FieldErrorOrInternal ( err , m . path . Child ( " " ) . Index ( i ) . Child ( " " ) ) ) continue } if ref . Kind != " " { errs = append ( errs , FieldErrorOrInternal ( fmt . Errorf ( " " , ref . Kind ) , m . path . Child ( " " ) . Index ( i ) . Child ( " " ) ) ) continue } container . Image = ref . Name } for i := range m . spec . Containers { container := & m . spec . Containers [ i ] if ! m . resolveAnnotationChanged && hasIdenticalPodSpecImage ( m . oldSpec , container . Name , container . Image ) { continue } ref := core . ObjectReference { Kind : " " , Name : container . Image } if err := fn ( & ref ) ; err != nil { errs = append ( errs , FieldErrorOrInternal ( err , m . path . Child ( " " ) . Index ( i ) . Child ( " " ) ) ) continue } if ref . Kind != " " { errs = append ( errs , FieldErrorOrInternal ( fmt . Errorf ( " " , ref . Kind ) , m . path . Child ( " " ) . Index ( i ) . Child ( " " ) ) ) continue } container . Image = ref . Name } return errs }
Mutate applies fn to all containers and init containers.
Mutate applies fn to all containers and init containers .