func VisitPodSecretNames(pod *api.Pod, visitor Visitor, containerType ContainerType) bool {
	for _, reference := range pod.Spec.ImagePullSecrets {
		if !visitor(reference.Name) {
			return false
		}
	}
	VisitContainers(&pod.Spec, containerType, func(c *api.Container, containerType ContainerType) bool {
		return visitContainerSecretNames(c, visitor)
	})
	var source *api.VolumeSource
	for i := range pod.Spec.Volumes {
		source = &pod.Spec.Volumes[i].VolumeSource
		switch {
		case source.AzureFile != nil:
			if len(source.AzureFile.SecretName) > 0 && !visitor(source.AzureFile.SecretName) {
				return false
			}
		case source.CephFS != nil:
			if source.CephFS.SecretRef != nil && !visitor(source.CephFS.SecretRef.Name) {
				return false
			}
		case source.Cinder != nil:
			if source.Cinder.SecretRef != nil && !visitor(source.Cinder.SecretRef.Name) {
				return false
			}
		case source.FlexVolume != nil:
			if source.FlexVolume.SecretRef != nil && !visitor(source.FlexVolume.SecretRef.Name) {
				return false
			}
		case source.Projected != nil:
			for j := range source.Projected.Sources {
				if source.Projected.Sources[j].Secret != nil {
					if !visitor(source.Projected.Sources[j].Secret.Name) {
						return false
					}
				}
			}
		case source.RBD != nil:
			if source.RBD.SecretRef != nil && !visitor(source.RBD.SecretRef.Name) {
				return false
			}
		case source.Secret != nil:
			if !visitor(source.Secret.SecretName) {
				return false
			}
		case source.ScaleIO != nil:
			if source.ScaleIO.SecretRef != nil && !visitor(source.ScaleIO.SecretRef.Name) {
				return false
			}
		case source.ISCSI != nil:
			if source.ISCSI.SecretRef != nil && !visitor(source.ISCSI.SecretRef.Name) {
				return false
			}
		case source.StorageOS != nil:
			if source.StorageOS.SecretRef != nil && !visitor(source.StorageOS.SecretRef.Name) {
				return false
			}
		case source.CSI != nil:
			if source.CSI.NodePublishSecretRef != nil && !visitor(source.CSI.NodePublishSecretRef.Name) {
				return false
			}
		}
	}
	return true
}
// VisitPodSecretNames invokes the visitor function with the name of every secret
// referenced by the pod spec. If visitor returns false, visiting is short-circuited.
// Transitive references (e.g. pod -> pvc -> pv -> secret) are not visited.
// Returns true if visiting completed, false if visiting was short-circuited.
VisitPodSecretNames invokes the visitor function with the name of every secret
referenced by the pod spec. If visitor returns false, visiting is short-circuited.
Transitive references  are not visited.
Returns true if visiting completed, false if visiting was short-circuited.
// VisitPodSecretNames invokes the visitor function with the name of every secret // referenced by the pod spec . If visitor returns false visiting is short - circuited . // Transitive references ( e . g . pod - > pvc - > pv - > secret ) are not visited . // Returns true if visiting completed false if visiting was short - circuited .
func VisitPodSecretNames(pod *api.Pod, visitor Visitor, containerType ContainerType) bool {
	for _, reference := range pod.Spec.ImagePullSecrets {
		if !visitor(reference.Name) {
			return false
		}
	}
	VisitContainers(&pod.Spec, containerType, func(c *api.Container, containerType ContainerType) bool {
		return visitContainerSecretNames(c, visitor)
	})
	var source *api.VolumeSource
	for i := range pod.Spec.Volumes {
		source = &pod.Spec.Volumes[i].VolumeSource
		switch {
		case source.AzureFile != nil:
			if len(source.AzureFile.SecretName) > 0 && !visitor(source.AzureFile.SecretName) {
				return false
			}
		case source.CephFS != nil:
			if source.CephFS.SecretRef != nil && !visitor(source.CephFS.SecretRef.Name) {
				return false
			}
		case source.Cinder != nil:
			if source.Cinder.SecretRef != nil && !visitor(source.Cinder.SecretRef.Name) {
				return false
			}
		case source.FlexVolume != nil:
			if source.FlexVolume.SecretRef != nil && !visitor(source.FlexVolume.SecretRef.Name) {
				return false
			}
		case source.Projected != nil:
			for j := range source.Projected.Sources {
				if source.Projected.Sources[j].Secret != nil {
					if !visitor(source.Projected.Sources[j].Secret.Name) {
						return false
					}
				}
			}
		case source.RBD != nil:
			if source.RBD.SecretRef != nil && !visitor(source.RBD.SecretRef.Name) {
				return false
			}
		case source.Secret != nil:
			if !visitor(source.Secret.SecretName) {
				return false
			}
		case source.ScaleIO != nil:
			if source.ScaleIO.SecretRef != nil && !visitor(source.ScaleIO.SecretRef.Name) {
				return false
			}
		case source.ISCSI != nil:
			if source.ISCSI.SecretRef != nil && !visitor(source.ISCSI.SecretRef.Name) {
				return false
			}
		case source.StorageOS != nil:
			if source.StorageOS.SecretRef != nil && !visitor(source.StorageOS.SecretRef.Name) {
				return false
			}
		case source.CSI != nil:
			if source.CSI.NodePublishSecretRef != nil && !visitor(source.CSI.NodePublishSecretRef.Name) {
				return false
			}
		}
	}
	return true
}
func VisitPodSecretNames ( pod * api . Pod , visitor Visitor , containerType ContainerType ) bool { for _ , reference := range pod . Spec . ImagePullSecrets { if ! visitor ( reference . Name ) { return false } } VisitContainers ( & pod . Spec , containerType , func ( c * api . Container , containerType ContainerType ) bool { return visitContainerSecretNames ( c , visitor ) } ) var source * api . VolumeSource for i := range pod . Spec . Volumes { source = & pod . Spec . Volumes [ i ] . VolumeSource switch { case source . AzureFile != nil : if len ( source . AzureFile . SecretName ) > 0 && ! visitor ( source . AzureFile . SecretName ) { return false } case source . CephFS != nil : if source . CephFS . SecretRef != nil && ! visitor ( source . CephFS . SecretRef . Name ) { return false } case source . Cinder != nil : if source . Cinder . SecretRef != nil && ! visitor ( source . Cinder . SecretRef . Name ) { return false } case source . FlexVolume != nil : if source . FlexVolume . SecretRef != nil && ! visitor ( source . FlexVolume . SecretRef . Name ) { return false } case source . Projected != nil : for j := range source . Projected . Sources { if source . Projected . Sources [ j ] . Secret != nil { if ! visitor ( source . Projected . Sources [ j ] . Secret . Name ) { return false } } } case source . RBD != nil : if source . RBD . SecretRef != nil && ! visitor ( source . RBD . SecretRef . Name ) { return false } case source . Secret != nil : if ! visitor ( source . Secret . SecretName ) { return false } case source . ScaleIO != nil : if source . ScaleIO . SecretRef != nil && ! visitor ( source . ScaleIO . SecretRef . Name ) { return false } case source . ISCSI != nil : if source . ISCSI . SecretRef != nil && ! visitor ( source . ISCSI . SecretRef . Name ) { return false } case source . StorageOS != nil : if source . StorageOS . SecretRef != nil && ! visitor ( source . StorageOS . SecretRef . Name ) { return false } case source . CSI != nil : if source . CSI . NodePublishSecretRef != nil && ! visitor ( source . CSI . NodePublishSecretRef . Name ) { return false } } } return true }
VisitPodSecretNames invokes the visitor function with the name of every secret
referenced by the pod spec.
VisitPodSecretNames invokes the visitor function with the name of every secret referenced by the pod spec .