You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/09/14 14:04:23 UTC

[GitHub] [skywalking-swck] hanahmily commented on a change in pull request #30: add feature: java agent injector

hanahmily commented on a change in pull request #30:
URL: https://github.com/apache/skywalking-swck/pull/30#discussion_r708304186



##########
File path: pkg/operator/injector/injector.go
##########
@@ -293,6 +298,29 @@ func (s *SidecarInjectField) OverlayAgent(a Annotations, ao *AnnotationOverlay,
 	return true
 }
 
+// OverlayOptional overlays optional plugins and move optional plugins to the directory(/plugins)
+// user must ensure that the optional plugins are in the injected container's image
+// Notice , user must specify the optional plugins' version
+// such as spring-cloud-gateway-2.0.x or spring-cloud-gateway-2.1.x
+// the final command will be "mv /optional-plugins/*spring-cloud-gateway-2.0.x*  /plugins/"

Review comment:
       Is "cp" here? and Do you check java agent image contains "cp" command? @kezhenxu94 Do we use this command safely in the java agent image?

##########
File path: pkg/operator/injector/injector.go
##########
@@ -293,6 +298,29 @@ func (s *SidecarInjectField) OverlayAgent(a Annotations, ao *AnnotationOverlay,
 	return true
 }
 
+// OverlayOptional overlays optional plugins and move optional plugins to the directory(/plugins)
+// user must ensure that the optional plugins are in the injected container's image
+// Notice , user must specify the optional plugins' version
+// such as spring-cloud-gateway-2.0.x or spring-cloud-gateway-2.1.x
+// the final command will be "mv /optional-plugins/*spring-cloud-gateway-2.0.x*  /plugins/"
+func (s *SidecarInjectField) OverlayOptional(annotation *map[string]string) {
+	sourcePath := strings.Join([]string{s.SidecarVolumeMount.MountPath, "optional-plugins/"}, "/")

Review comment:
       There is another "optional" folder that need to handle: "optional-reporter-plugins"

##########
File path: pkg/operator/injector/injector.go
##########
@@ -293,6 +298,29 @@ func (s *SidecarInjectField) OverlayAgent(a Annotations, ao *AnnotationOverlay,
 	return true
 }
 
+// OverlayOptional overlays optional plugins and move optional plugins to the directory(/plugins)
+// user must ensure that the optional plugins are in the injected container's image
+// Notice , user must specify the optional plugins' version
+// such as spring-cloud-gateway-2.0.x or spring-cloud-gateway-2.1.x
+// the final command will be "mv /optional-plugins/*spring-cloud-gateway-2.0.x*  /plugins/"
+func (s *SidecarInjectField) OverlayOptional(annotation *map[string]string) {
+	sourcePath := strings.Join([]string{s.SidecarVolumeMount.MountPath, "optional-plugins/"}, "/")
+	targetPath := strings.Join([]string{s.SidecarVolumeMount.MountPath, "plugins/"}, "/")
+
+	for k, v := range *annotation {
+		if strings.HasPrefix(k, optionsAnnotationPrefix) {
+			optionalName := strings.TrimPrefix(k, optionsAnnotationPrefix)
+			command := strings.Join([]string{"cp", sourcePath}, " ")
+			if strings.ToLower(v) == "true" {
+				realName := strings.Join([]string{"*", "*"}, optionalName)

Review comment:
       We don't have to wrap the name with the start symbol. If users want to cp a collection of plugins, they must write the regular expression by themself. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org