You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2022/01/10 12:37:32 UTC

[skywalking-swck] branch master updated: use JAVA_TOOL_OPTIONS to replace AGENT_OPTS (#58)

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-swck.git


The following commit(s) were added to refs/heads/master by this push:
     new 3161ded  use JAVA_TOOL_OPTIONS to replace AGENT_OPTS (#58)
3161ded is described below

commit 3161dedb3de04d678c61feb830cf9ca7064ced38
Author: dashanji <71...@users.noreply.github.com>
AuthorDate: Mon Jan 10 20:36:41 2022 +0800

    use JAVA_TOOL_OPTIONS to replace AGENT_OPTS (#58)
    
    Signed-off-by: dashanji <95...@qq.com>
---
 CHANGES.md                                             |  2 +-
 docs/examples/java-agent-injector-usage.md             | 18 ++++++------------
 docs/java-agent-injector.md                            |  2 +-
 .../manifests/injector/templates/annotations.yaml      |  2 +-
 operator/pkg/operator/repo/assets.gen.go               |  6 +++---
 test/e2e/demo.yaml                                     |  2 +-
 6 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 5643669..b161fa5 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -11,7 +11,7 @@ Release Notes.
 #### Bugs
 - Update release images to set numeric user id 
 - Fix the satellite config not support number error
-
+- Use env JAVA_TOOL_OPTIONS to replace AGENT_OPTS
 #### Chores
 - Add stabilization windows feature in satellite HPA documentation
 
diff --git a/docs/examples/java-agent-injector-usage.md b/docs/examples/java-agent-injector-usage.md
index da5b19e..960e5cc 100644
--- a/docs/examples/java-agent-injector-usage.md
+++ b/docs/examples/java-agent-injector-usage.md
@@ -36,7 +36,7 @@ spec:
       - name: demo1
         image: ghcr.io/apache/skywalking-swck-spring-demo:v0.0.1
         command: ["java"]
-        args: ["-jar","$(AGENT_OPTS)","-jar","/app.jar"]
+        args: ["-jar","/app.jar"]
    
 ```
 
@@ -47,13 +47,11 @@ spec:
   containers:
   - args:
     - -jar
-    - $(AGENT_OPTS)
-    - -jar
     - /app.jar
     command:
     - java
     env:
-    - name: AGENT_OPTS
+    - name: JAVA_TOOL_OPTIONS
       value: -javaagent:/sky/agent/skywalking-agent.jar
     image: ghcr.io/apache/skywalking-swck-spring-demo:v0.0.1
     name: demo1
@@ -172,7 +170,7 @@ spec:
       - name: demo2
         image: ghcr.io/apache/skywalking-swck-spring-demo:v0.0.1
         command: ["java"]
-        args: ["-jar","$(AGENT_OPTS)","-jar","/app.jar"]
+        args: ["-jar","/app.jar"]
 ```
 
 Get injected resources as below:
@@ -182,13 +180,11 @@ spec:
   containers:
   - args:
     - -jar
-    - $(AGENT_OPTS)
-    - -jar
     - /app.jar
     command:
     - java
     env:
-    - name: AGENT_OPTS
+    - name: JAVA_TOOL_OPTIONS
       value: -javaagent:/skytest/agent/skywalking-agent.jar
     image: ghcr.io/apache/skywalking-swck-spring-demo:v0.0.1
     name: demo2
@@ -313,7 +309,7 @@ spec:
       - name: demo3
         image: ghcr.io/apache/skywalking-swck-spring-demo:v0.0.1
         command: ["java"]
-        args: ["-jar","$(AGENT_OPTS)","-jar","/app.jar"]
+        args: ["-jar","/app.jar"]
 ```
 
 Get injected resources as below:
@@ -326,13 +322,11 @@ spec:
     name: nginx
   - args:
     - -jar
-    - $(AGENT_OPTS)
-    - -jar
     - /app.jar
     command:
     - java
     env:
-    - name: AGENT_OPTS
+    - name: JAVA_TOOL_OPTIONS
       value: -javaagent:/sky/agent/skywalking-agent.jar=agent.ignore_suffix='jpg,.jpeg',agent.class_cache_mode=MEMORY,agent.sample_n_per_3_secs=6,agent.service_name=app,plugin.mount='plugins,activations',plugin.influxdb.trace_influxql=false,plugin.mongodb.trace_param=true
     image: ghcr.io/apache/skywalking-swck-spring-demo:v0.0.1
     name: demo3
diff --git a/docs/java-agent-injector.md b/docs/java-agent-injector.md
index e05e1eb..f96d001 100644
--- a/docs/java-agent-injector.md
+++ b/docs/java-agent-injector.md
@@ -164,7 +164,7 @@ The injector can recognize the following annotations to configure the sidecar:
 | `sidecar.skywalking.apache.org/configmapVolume.Name`         | The name of configmap volume.                                | `java-agent-configmap-volume`                                |
 | `sidecar.skywalking.apache.org/configmapVolumeMount.MountPath` | Mount path of the configmap in the injected container        | `/sky/agent/config`                                          |
 | `sidecar.skywalking.apache.org/configmapVolume.ConfigMap.Name` | The name pf configmap used in the injected container as `agent.config ` | `skywalking-swck-java-agent-configmap`                       |
-| `sidecar.skywalking.apache.org/env.Name`                     | Environment Name used by the injected container (application container). | `AGENT_OPTS`                                                 |
+| `sidecar.skywalking.apache.org/env.Name`                     | Environment Name used by the injected container (application container). | `JAVA_TOOL_OPTIONS`                                                 |
 | `sidecar.skywalking.apache.org/env.Value`                    | Environment variables used by the injected container (application container). | `-javaagent:/sky/agent/skywalking-agent.jar`                 |
 
 ## The ways to get the final injected agent's configuration
diff --git a/operator/pkg/operator/manifests/injector/templates/annotations.yaml b/operator/pkg/operator/manifests/injector/templates/annotations.yaml
index c8ad963..52b31fd 100644
--- a/operator/pkg/operator/manifests/injector/templates/annotations.yaml
+++ b/operator/pkg/operator/manifests/injector/templates/annotations.yaml
@@ -75,7 +75,7 @@ annotations:
     envName: nil
 
   - name: sidecar.skywalking.apache.org/env.Name
-    defaultValue: AGENT_OPTS
+    defaultValue: JAVA_TOOL_OPTIONS
     validateFunc: nil
     envName: nil
 
diff --git a/operator/pkg/operator/repo/assets.gen.go b/operator/pkg/operator/repo/assets.gen.go
index aeff096..3f0dc37 100644
--- a/operator/pkg/operator/repo/assets.gen.go
+++ b/operator/pkg/operator/repo/assets.gen.go
@@ -21,7 +21,7 @@
 // fetcher/templates/configmap.yaml (3.082kB)
 // fetcher/templates/deployment.yaml (2.084kB)
 // fetcher/templates/service_account.yaml (1.088kB)
-// injector/templates/annotations.yaml (3.362kB)
+// injector/templates/annotations.yaml (3.369kB)
 // injector/templates/configmap.yaml (1.2kB)
 // injector/templates/javaagent.yaml (1.462kB)
 // oapserver/templates/cluster_role.yaml (1.241kB)
@@ -485,7 +485,7 @@ annotations:
     envName: nil
 
   - name: sidecar.skywalking.apache.org/env.Name
-    defaultValue: AGENT_OPTS
+    defaultValue: JAVA_TOOL_OPTIONS
     validateFunc: nil
     envName: nil
 
@@ -516,7 +516,7 @@ func injectorTemplatesAnnotationsYaml() (*asset, error) {
 	}
 
 	info := bindataFileInfo{name: "injector/templates/annotations.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
-	a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd2, 0x9a, 0xe0, 0xe4, 0x15, 0x93, 0xed, 0xf7, 0xf7, 0x7b, 0xff, 0x1a, 0x27, 0x8f, 0x85, 0x54, 0xa1, 0x2d, 0x26, 0x53, 0x89, 0x7b, 0x7d, 0xf4, 0x6c, 0x32, 0xfe, 0xc, 0xbd, 0x76, 0x36, 0x59}}
+	a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa6, 0x13, 0x6c, 0x84, 0xe7, 0x3, 0x54, 0x65, 0xb9, 0x8, 0xb1, 0x22, 0xe1, 0xf2, 0xea, 0x19, 0xea, 0xde, 0xeb, 0xf, 0x60, 0xb1, 0x83, 0xaf, 0x1d, 0x14, 0xde, 0x3c, 0x92, 0x56, 0x23, 0xc3}}
 	return a, nil
 }
 
diff --git a/test/e2e/demo.yaml b/test/e2e/demo.yaml
index 8c96688..43c8211 100644
--- a/test/e2e/demo.yaml
+++ b/test/e2e/demo.yaml
@@ -36,7 +36,7 @@ spec:
         imagePullPolicy: IfNotPresent
         image: ghcr.io/apache/skywalking-swck-spring-demo:v0.0.1
         command: ["java"]
-        args: ["$(AGENT_OPTS)","-jar","/app.jar"]
+        args: ["-jar","/app.jar"]
         ports:
           - containerPort: 8085
         readinessProbe: