func()

in operator/pkg/operator/injector/injector.go [150:176]


func (s *SidecarInjectField) GetInjectStrategy(labels, annotation *map[string]string) {
	// set default value
	s.NeedInject = false

	// set NeedInject's value, if the pod has the label "swck-java-agent-injected=true", means need inject
	if *labels == nil {
		return
	}

	// if the pod is injected, then return
	if strings.EqualFold((*annotation)[SidecarInjectSucceedAnno], "true") {
		return
	}

	if strings.EqualFold((*labels)[ActiveInjectorLabel], "true") {
		s.NeedInject = true
	}

	if *annotation == nil {
		return
	}

	// set injectContainer's value
	if v, ok := (*annotation)[sidecarInjectContainerAnno]; ok {
		s.InjectContainer = v
	}
}