// ScanSA scans for serviceaccount refs.
ScanSA scans for serviceaccount refs.
// ScanSA scans for serviceaccount refs .
func (d *DaemonSet) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, error) {
	ns, n := client.Namespaced(fqn)
	oo, err := d.Factory.List(d.GVR(), ns, wait, labels.Everything())
	if err != nil {
		return nil, err
	}
	refs := make(Refs, 0, len(oo))
	for _, o := range oo {
		var ds appsv1.DaemonSet
		err = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &ds)
		if err != nil {
			return nil, errors.New("expecting DaemonSet resource")
		}
		if ds.Spec.Template.Spec.ServiceAccountName == n {
			refs = append(refs, Ref{
				GVR: d.GVR(),
				FQN: client.FQN(ds.Namespace, ds.Name),
			})
		}
	}
	return refs, nil
}
func ( d * DaemonSet ) ScanSA ( ctx context . Context , fqn string , wait bool ) ( Refs , error ) { ns , n := client . Namespaced ( fqn ) oo , err := d . Factory . List ( d . GVR ( ) , ns , wait , labels . Everything ( ) ) if err != nil { return nil , err } refs := make ( Refs , 0 , len ( oo ) ) for _ , o := range oo { var ds appsv1 . DaemonSet err = runtime . DefaultUnstructuredConverter . FromUnstructured ( o . ( * unstructured . Unstructured ) . Object , & ds ) if err != nil { return nil , errors . New ( " " ) } if ds . Spec . Template . Spec . ServiceAccountName == n { refs = append ( refs , Ref { GVR : d . GVR ( ) , FQN : client . FQN ( ds . Namespace , ds . Name ) , } ) } } return refs , nil }
ScanSA scans for serviceaccount refs.
ScanSA scans for serviceaccount refs .