func (as *AnnotationOverlay) GetOverlayValue(a Annotation) string {
	if v, ok := (*as)[a]; ok {
		return v
	}
	return ""
}
GetOverlayValue will get overlaied value, if not then return ""
package injector
import (
	"fmt"
	"strings"
	"github.com/ghodss/yaml"
	"github.com/apache/skywalking-swck/pkg/operator/repo"
)
type Annotation struct {
	Name string `yaml:"name"`
	DefaultValue string `yaml:"defaultValue"`
	ValidateFunc string `yaml:"validateFunc"`
	EnvName string `yaml:"envName"`
}
type Annotations struct {
	Annotations []Annotation
}
type AnnotationOverlay map[Annotation]string
func NewAnnotations() (*Annotations, error) {
	fileRepo := repo.NewRepo("injector")
	data, err := fileRepo.ReadFile("injector/templates/annotations.yaml")
	if err != nil {
		return nil, err
	}
	a := new(Annotations)
	if err := yaml.Unmarshal(data, a); err != nil {
		return nil,
			fmt.Errorf("unmarshal annotations.yaml to struct Annotations :%s", err.Error())
	}
	return a, nil
}
func GetAnnotationsByPrefix(a Annotations, prefixName string) *Annotations {
	anno := new(Annotations)
	for _, v := range a.Annotations {
		if strings.HasPrefix(v.Name, prefixName) {
			anno.Annotations = append(anno.Annotations, v)
		}
	}
	return anno
}
func NewAnnotationOverlay() *AnnotationOverlay {
	a := make(AnnotationOverlay)
	return &a
}
func (as *AnnotationOverlay) GetFinalValue(a Annotation) string {
	ov := a.DefaultValue
	if v, ok := (*as)[a]; ok {
		ov = v
	}
	return ov
}
func (as *AnnotationOverlay) SetOverlay(AnnotationOverlay *map[string]string, a Annotation) error {
	if v, ok := (*AnnotationOverlay)[a.Name]; ok {
		f := FindValidateFunc(a.ValidateFunc)
		if f != nil {
			err := f(a.Name, v)
			if err != nil {
				return err
			}
		}
		(*as)[a] = v
	}
	return nil
}