Skip to content

Commit

Permalink
use JAVA_TOOL_OPTIONS to replace AGENT_OPTS (#58)
Browse files Browse the repository at this point in the history
Signed-off-by: dashanji <952129620@qq.com>
  • Loading branch information
dashanji committed Jan 10, 2022
1 parent 570b8bc commit 3161ded
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 6 additions & 12 deletions docs/examples/java-agent-injector-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
```

Expand All @@ -46,14 +46,12 @@ Get injected resources as below:
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
Expand Down Expand Up @@ -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:
Expand All @@ -181,14 +179,12 @@ Get injected resources as below:
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
Expand Down Expand Up @@ -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:
Expand All @@ -325,14 +321,12 @@ spec:
imagePullPolicy: IfNotPresent
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
Expand Down
2 changes: 1 addition & 1 deletion docs/java-agent-injector.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions operator/pkg/operator/repo/assets.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/e2e/demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3161ded

Please sign in to comment.