MCPcopy
hub / github.com/kubernetes/kubectl / visitAnnotation

Method visitAnnotation

pkg/cmd/util/editor/editoptions.go:750–767  ·  view source on GitHub ↗
(annotationVisitor resource.Visitor)

Source from the content-addressed store, hash-verified

748}
749
750func (o *EditOptions) visitAnnotation(annotationVisitor resource.Visitor) error {
751 // iterate through all items to apply annotations
752 err := annotationVisitor.Visit(func(info *resource.Info, incomingErr error) error {
753 // put configuration annotation in "updates"
754 if o.ApplyAnnotation {
755 if err := util.CreateOrUpdateAnnotation(true, info.Object, scheme.DefaultJSONEncoder()); err != nil {
756 return err
757 }
758 }
759 if err := o.Recorder.Record(info.Object); err != nil {
760 klog.V(4).Infof("error recording current command: %v", err)
761 }
762
763 return nil
764
765 })
766 return err
767}
768
769// EditMode can be either NormalEditMode, EditBeforeCreateMode or ApplyEditMode
770type EditMode string

Callers 1

RunMethod · 0.95

Calls 3

CreateOrUpdateAnnotationFunction · 0.92
DefaultJSONEncoderFunction · 0.92
VisitMethod · 0.45

Tested by

no test coverage detected