// The node passed in here is the same node as held in Referrer;
// that's how the referrer's name field is updated.
// Currently, however, this filter still needs the extra methods on Referrer
// to consult things like the resource Id, its namespace, etc.
// TODO(3455): No filter should use the Resource api; all information
// about names should come from annotations, with helper methods
// on the RNode object.  Resource should get stupider, RNode smarter.
The node passed in here is the same node as held in Referrer;
that's how the referrer's name field is updated.
Currently, however, this filter still needs the extra methods on Referrer
to consult things like the resource Id, its namespace, etc.
TODO(3455): No filter should use the Resource api; all information
about names should come from annotations, with helper methods
on the RNode object.  Resource should get stupider, RNode smarter.
// The node passed in here is the same node as held in Referrer ; // that ' s how the referrer ' s name field is updated . // Currently however this filter still needs the extra methods on Referrer // to consult things like the resource Id its namespace etc . // TODO ( 3455 ) : No filter should use the Resource api ; all information // about names should come from annotations with helper methods // on the RNode object . Resource should get stupider RNode smarter .
func (f Filter) run(node *yaml.RNode) (*yaml.RNode, error) {
	if err := f.confirmNodeMatchesReferrer(node); err != nil {
		return nil, err
	}
	if err := node.PipeE(fieldspec.Filter{
		FieldSpec: f.NameFieldToUpdate,
		SetValue:  f.set,
	}); err != nil {
		return nil, errors.Wrapf(
			err, "updating name reference in '%s' field of '%s'",
			f.NameFieldToUpdate.Path, f.Referrer.CurId().String())
	}
	return node, nil
}
func ( f Filter ) run ( node * yaml . RNode ) ( * yaml . RNode , error ) { if err := f . confirmNodeMatchesReferrer ( node ) ; err != nil { return nil , err } if err := node . PipeE ( fieldspec . Filter { FieldSpec : f . NameFieldToUpdate , SetValue : f . set , } ) ; err != nil { return nil , errors . Wrapf ( err , " " , f . NameFieldToUpdate . Path , f . Referrer . CurId ( ) . String ( ) ) } return node , nil }
The node passed in here is the same node as held in Referrer;
that's how the referrer's name field is updated.
The node passed in here is the same node as held in Referrer ; that ' s how the referrer ' s name field is updated .
// sanity check.